4
\$\begingroup\$

I have interfaced a HID bar-code scanner with LPC2468. It is sending data when i scan a bar-code, it sends a lot of bytes when i make a scan, how can i know out of these bytes which are the bytes corresponding to the scanned bar-code.

For eg:If i scan a bar-code having value 2M12264185 it send following data

 1: Input Report:
    2: Input Report: 0, 0, 0, 0, 0, 0, 0, 0, 
    3: Input Report: 0, 0, 1F, 0, 0, 0, 0, 0,
    4: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    5: Input Report: 2, 0, 0, 0, 0, 0, 0, 0,
    6: Input Report: 2, 0, 10, 0, 0, 0, 0, 0,
    7: Input Report: 2, 0, 0, 0, 0, 0, 0, 0,
    8: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    9: Input Report: 0, 0, 1E, 0, 0, 0, 0, 0,
    10: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    11: Input Report: 0, 0, 1F, 0, 0, 0, 0, 0,
    12: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    13: Input Report: 0, 0, 1F, 0, 0, 0, 0, 0,
    14: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    15: Input Report: 0, 0, 23, 0, 0, 0, 0, 0,
    16: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    17: Input Report: 0, 0, 21, 0, 0, 0, 0, 0,
    18: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    19: Input Report: 0, 0, 1E, 0, 0, 0, 0, 0,
    20: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    21: Input Report: 0, 0, 25, 0, 0, 0, 0, 0,
    22: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    23: Input Report: 0, 0, 22, 0, 0, 0, 0, 0,
    24: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,
    25: Input Report: 0, 0, 28, 0, 0, 0, 0, 0,
    26: Input Report: 0, 0, 0, 0, 0, 0, 0, 0,

How to distinguish data bytes from other bytes.

\$\endgroup\$
  • \$\begingroup\$ That information should be available in the datasheet/user manual of the HID bar-code scanner. Do you have that? \$\endgroup\$ – Gustavo Litovsky Jan 19 '13 at 4:05
  • \$\begingroup\$ @Gustavo Litovsky yes i have but m not able to find some useful information in it. here is the link posmicro.com/downloads/eclipse5145_ds_reva_0510_en.pdf \$\endgroup\$ – Sarao Jan 19 '13 at 4:11
  • \$\begingroup\$ Does it operate like a keyboard when attached to a PC? If so maybe try search on "hid scan codes" or refer to the HID docs on the various codes for a keyboard. I just did a search and check the following, it seems to line up: mindrunway.ru/IgorPlHex/USBKeyScan.pdf \$\endgroup\$ – PeterJ Jan 19 '13 at 4:16
  • \$\begingroup\$ This website seems to include related software: honeywellaidc.com/en-AP/Pages/… \$\endgroup\$ – Gustavo Litovsky Jan 19 '13 at 4:33
9
\$\begingroup\$

While I'm not going to guess what every field is, your barcode scanner is emulating a USB HID keyboard. Each line with non-zero fields indicates a key-press, and all zeros indicates no key presses.

The third field is the USB HID key code. See this link from the USB group, starting with page 53. Note that the USB HID codes do not align with ASCII or other barcode languages. Checking the key codes versus what you say the barcode should be gives a 1:1 match.

The second field appears to be a modifier column, when it is equal to 2 the 'Shift' key is depressed. That would make your "input report 5-7" look like this:

4: 
5: <Shift>
6: <Shift> <M>
7: <Shift>
8: 
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.