My CueCat barcode scanner is broken, my computer is misconfigured or I just forgot to read the proper documentation. I spend three days just to find out the NUM LOCK key was causing the CueCat to be misunderstood by Windows. Poor little kitty, nobody understands what it says.
I’ve been playing with a CueCat barcode scanner I bought at eBay. It is a PS2 68-1965-A model, which I think is the most common type. I’m doing this because I am testing a quick product feeding option for the osCommerce Product Manager for Windows (oscpmwin). The idea is to be able to add product as batches of UPC numbers (to be added as model numbers) or to increase the stock number of existing products quickly.
I bought a modified CueCat, one that no longer sends encrypted numbers but clear text. Well, the clear text was not really as clear as I thought. After struggling to understand why most barcode codes returned by the cuecat were segmented (that is, broken in several lines, see Figure 1) I discovered that the numbers and letters returned were not really the ASCII characters, but ALT + keypad-number combinations. C’mon! What were they thinking of when designed this feline?
So, for example, for the number nine the CueCat was really entering the combination ALT+57. Yeah, rather than sending “1″, “2″, “3″ and so on, it sends ALT+48, ALT+49, ALT+50, and so on. The problem was that Windows received a “9″ character and a “Home” keypress. This happened in Windows 2000 (but not in all applications, for example Wordpad ignored the “Home” editing code and just displayed the “9″, see Figure 2).
Figure 1. Bad kitty, another garbled barcode.
Figure 2. Good kitty, This is the correct barcode.
After a while I thought my CueCat was broken. Mmmmh, I just paid 4 dollars for this, returning it will cost me a lot more. Then I just tried one obvious test: typed the data directly with the keyboard using the ALT keypad codes. Oooooh. If I type ALT+57 I get a “9″ character plus a “Home” editing code. Ok, then I thought the problem was not the CueCat (because after all, it is acting just like my keyboard) but the problem was Windows. Time to test with another platform.
Testing in Linux was not better. I used SuSE 10 as test bed and found out that X (with Gnome) just ignored the data from the CueCat. In the console it was better: it received the numbers and ignored the keypad editing codes. Great for me because, mmmh, you know… I am a member of the Command-Line Brotherhood.
Ok, this is just silly. But wait, my program (oscpmwin) only runs (currently) in Windows, so I need to solve this in Windows only. I tested in another computer, now with Windows XP. Same result. Disabled all keyboard stuff in the Control Panel. Same problem. Ok, time to rethink this. The big question appeared in my head: how does Windows interpret the ALT+keypad combinations?
It seems I have not used the ALT+keypad combinations in Windows for a lot of years; at least not in my computers (which have their keyboards properly configured). So I decided to browse the web to find out. I discovered that Windows only get the ALT+keypad combinations when NUM LOCK is enabled in the keyboard. C’mon, give me a break! I indeed used ALT plus keypad combinations with DOS, but then it worked even if NUM LOCK was disabled.
Testing again in Windows 2000. Surprise, it works pretty well in all Windows applications when NUM LOCK is turned on. Grrrrr, I have spend three days of work just on this. I have read the code of several Linux CueCat decoders. I have even read the Linux driver code. I have read through tons of newsgroups messages, forums postings and web pages. The Linux driver code… I only read Linux kernel code when I’m very bored (or very desperate).
Am I the only one who use the keyboard with NUM LOCK disabled or what? Because I could not find any reference of this behavior. Yes, I’m an old cat, I use the numeric keypad keys for editing (moving the cursor, delete text, etc.), not for numbers. Maybe everybody knew it or it is so obvious for everyone.
Is my CueCat a weird version which send weird keyboard scancodes or what? That’s another possibility, but even then, the vendor who sold me this CueCat has sold too many of them.
Is the information out there but I could not see it? My eyeglasses are broken so I have a (lame) excuse. That would suck because I work also as a web information finder. (Yes, people pays me for finding hard-to-find information on the web).
Well, what it does matter is that I discovered the problem, learned the NUM LOCK thing, and can get back to work.