javalinuxraspberry-piusbusb4java

I can't figure out this barcode scanner's encoding


The output of the scanner

I'm making an application in Java that is meant to run on my Raspberry Pi. It uses usb4java to detach the kernel's driver and give me its data directly. The scanner itself works like a keyboard. When it detects something, it sends it with a new-line character. The barcode that was scanned above corresponded to "K1215500". I'm not sure why there were several inputs that were just 0s (might be delimiters for a driver), but now I have no idea what kind of encoding this is. It is definitely not ASCII. If the first row is "K", then it seems like "1" is 30, "2" is 31, "5" is 34, "0" is 39, and "\n" is 40, so there is some coherence to this, I just don't know what it is. Do they correspond to some sort of keycode schema a keyboard driver would know? Thanks in advance


Solution

  • I figured it out after some more research. For anyone interested, this encoding is specifically the USB keyboard specification for keyboard commands. Check out page 83 of this PDF:

    https://www.usb.org/sites/default/files/hut1_22.pdf

    Cheers!