I have a cheap barcode scanner that works well as a keyboard wedge - that is it appears as a keyboard and barcodes appear as though typed into the keyboard.
I need to capture that data (and stop it appearing as keyboard data). In an ideal world it would appear as a TTY (serial) device instead.
Is there any way I can do this or do I need a different scanner?
Mark
On 18/09/13 10:47, Mark Rogers wrote:
I need to capture that data (and stop it appearing as keyboard data). In an ideal world it would appear as a TTY (serial) device instead.
Is there any way I can do this or do I need a different scanner?
I think last time I faced this sort of problem I solved it with uinput which I think can intercept the raw input from a HID and spit it out as a pseudo character device. I left the details of exactly how I did it at my previous employers I'm afraid. :-(
I'd say if you can solve it do...using serial TTY scanner complicates life somewhat because you have to power it. Though from memory both Wasp and I think Datalogic make devices that can appear as a USB Serial device rather than a USB HID.
On 19 September 2013 19:10, Wayne Stallwood ALUGlist@digimatic.co.uk wrote:
I'd say if you can solve it do...using serial TTY scanner complicates life somewhat because you have to power it. Though from memory both Wasp and I think Datalogic make devices that can appear as a USB Serial device rather than a USB HID.
Well I'm making progress of sorts but can't find relevant documentation anywhere, so far at least.
With a Dell USB keyboard plugged in, looking at the HID data from event13 (the keyboard), when I press the "0" key I get: E913445200000000 35 CC 0C 00 00 00 00 00 04 00 04 00 27 00 07 00 E913445200000000 35 CC 0C 00 00 00 00 00 01 00 0B 00 01 00 00 00 E913445200000000 35 CC 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 E913445200000000 A0 04 0E 00 00 00 00 00 04 00 04 00 27 00 07 00 E913445200000000 A0 04 0E 00 00 00 00 00 01 00 0B 00 00 00 00 00 E913445200000000 A0 04 0E 00 00 00 00 00 00 00 00 00 00 00 00 00
When the barcode scanner sends a zero I get[*]: BB14445200000000 EB FB 0A 00 00 00 00 00 04 00 04 00 27 00 07 00 BB14445200000000 EB FB 0A 00 00 00 00 00 01 00 0B 00 01 00 00 00 BB14445200000000 EB FB 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 BB14445200000000 55 13 0B 00 00 00 00 00 04 00 04 00 27 00 07 00 BB14445200000000 55 13 0B 00 00 00 00 00 01 00 0B 00 00 00 00 00
I assume in there I have key press and key release and no doubt other stuff too, but the key bit appears to be the "27", on the basis that when I type/scan "7" this changes to 24 (on a keyboard 0 is 3 keys up from 7 so this makes sense). Assuming this to be correct, other keys that I have tested "make sense" too ("1" = 1E, "4" = 21, "9" = 26). I also have "-" giving me 2D, for what that's worth.
However I can't find any keyboard key code maps that make and of that make sense. I'd expect "0" to give me something like 30 not 27, for example.
Short of working out a map of all relevant characters, any suggestions as to a reference that'll make sense of this?
NB: The barcode scanner always gives the same first 8 bytes in each block of 24 bytes, which is why they're grouped the way they are. The keyboard seems to use this as some kind of timestamp based on the way it appears to increment every second, but I guess that's not important given the scanner doesn't bother.
[*] I think this is the bit of the input stream which relates to the "0" but can't be sure as that's not all I get from scanning a barcode. The test barcode I have to scan returns "0714-0097" hence the choices of characters above.
On 26/09/13 12:25, Mark Rogers wrote:
On 19 September 2013 19:10, Wayne Stallwood ALUGlist@digimatic.co.uk wrote:
I'd say if you can solve it do...using serial TTY scanner complicates life somewhat because you have to power it. Though from memory both Wasp and I think Datalogic make devices that can appear as a USB Serial device rather than a USB HID.
Well I'm making progress of sorts but can't find relevant documentation anywhere, so far at least.
With a Dell USB keyboard plugged in, looking at the HID data from event13 (the keyboard), when I press the "0" key I get: E913445200000000 35 CC 0C 00 00 00 00 00 04 00 04 00 27 00 07 00 E913445200000000 35 CC 0C 00 00 00 00 00 01 00 0B 00 01 00 00 00 E913445200000000 35 CC 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 E913445200000000 A0 04 0E 00 00 00 00 00 04 00 04 00 27 00 07 00 E913445200000000 A0 04 0E 00 00 00 00 00 01 00 0B 00 00 00 00 00 E913445200000000 A0 04 0E 00 00 00 00 00 00 00 00 00 00 00 00 00
When the barcode scanner sends a zero I get[*]: BB14445200000000 EB FB 0A 00 00 00 00 00 04 00 04 00 27 00 07 00 BB14445200000000 EB FB 0A 00 00 00 00 00 01 00 0B 00 01 00 00 00 BB14445200000000 EB FB 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 BB14445200000000 55 13 0B 00 00 00 00 00 04 00 04 00 27 00 07 00 BB14445200000000 55 13 0B 00 00 00 00 00 01 00 0B 00 00 00 00 00
I assume in there I have key press and key release and no doubt other stuff too, but the key bit appears to be the "27", on the basis that when I type/scan "7" this changes to 24 (on a keyboard 0 is 3 keys up from 7 so this makes sense). Assuming this to be correct, other keys that I have tested "make sense" too ("1" = 1E, "4" = 21, "9" = 26). I also have "-" giving me 2D, for what that's worth.
However I can't find any keyboard key code maps that make and of that make sense. I'd expect "0" to give me something like 30 not 27, for example.
Short of working out a map of all relevant characters, any suggestions as to a reference that'll make sense of this?
NB: The barcode scanner always gives the same first 8 bytes in each block of 24 bytes, which is why they're grouped the way they are. The keyboard seems to use this as some kind of timestamp based on the way it appears to increment every second, but I guess that's not important given the scanner doesn't bother.
[*] I think this is the bit of the input stream which relates to the "0" but can't be sure as that's not all I get from scanning a barcode. The test barcode I have to scan returns "0714-0097" hence the choices of characters above.
My first thought was that you had keyboard scan codes. Looking that up I got http://en.wikipedia.org/wiki/Scancode and http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html but that didn't fit with the data you posted. I looked at the wikipedia page more and realised they were likely to be USB HID (or keyboard scan) codes, so I googled USB keyboard scan codes which pointed me to this: http://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&...
which downloads a pdf of codes to keys - I hope that marries up with what you're getting and helps in some way.
Steve
On 26 September 2013 23:38, steve-ALUG@hst.me.uk wrote:
My first thought was that you had keyboard scan codes.
Me too! Surprisingly when I Googled for keyboard maps with scan codes on them I didn't find them to be consistent, except in one respect: not matching what I was seeing!
I looked at the wikipedia page more and realised they were likely to be USB HID (or keyboard scan) codes, so I googled USB keyboard scan codes which pointed me to this:
Ah, that's the bit I was clearly missing, thanks!
which downloads a pdf of codes to keys - I hope that marries up with what you're getting and helps in some way.
It certainly looks to be in the right ballpark, that's been a great help. Thanks Steve!