Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Barcode Scanner Communication

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
0
0
US
Sorry this might be terse, I didn't want to get overly verbose and wanted to get straight to the point.

I'm having trouble finding anything on how to read from a barcode scanner in HID mode.

No, I do not want to use: Windows.Devices.PointOfService.BarcodeScanner - I need to be able to target Win7 (and higher of course).

No, I do not want to use: POS for .NET - tried it and failed at it, most likely needs special drivers in serial mode.

I've seen in the USB POS specification usage page 0x8C targets barcode scanners. Theoretically something should work from here when the scanner is in HID mode, but when using RegisterRawInputDevices I haven't been seen WM_INPUT raised (I was successfully reading keyboard data, so the supporting code works).

I'm looking to find or build a library for getting data from barcode readers with the following requirements:
[ol 1]
[li]Scanner must be in HID mode[/li]
[li]ANY scanner brand[/li]
[li]No special drivers should need to be installed[/li]
[li]Must work in WinForms[/li]
[/ol]

I've just about exhausted my searching powers and can't find anything. I've tested that BarcodeScanner class in the universal api, and it works great, but I need to target Win7 - not just 10. I've attempted to figure out how that class works, to no avail. I suspect it might use the USB HID specification - but I'm not sure how, and my tests in RegisterRawInputDevices haven't gotten any Usage ID in the 0x8C usage page to reveal any data.

Any thoughts on the direction I need to take, where to look, etc... would be greatly appreciated.
 
HID means the scanner is acting as if there was an additional keyboard, that's all to it.
Put a textbox on your form and set the text cursor into it, then scan, it doesn't matter, that you see no WM_INPUT message, you'll likelier find WM_KEYDOWN and WM_KEYUP messages.

Bye, Olaf.

 
That's what I originally thought too, but that's not exactly what HID means (though it can mean that - depending on the scanner).

I actually have used a textbox in the past, and it would actually be required for some barcode scanners - but I've found some users (and there seems to be a growing number of them) find it a difficult concept that they must focus a textbox first before scanning.

By using a method other than the textbox, it is simpler for user - plus there is the advantage of being able to get the type of barcode (UPC, EAN, ISBN, etc...).

Which is why I'm investigating the USB HID Point of Sale usage tables: [URL unfurl="true"]http://www.usb.org/developers/hidpage/#Point of Sale[/url].

I'll post back some details on the difference between keyboard and HID mode when I have some documentation in front of me.
 
Got some docs. I've been testing on some Honeywell scanners (Granit 1981i, Voyager 1202g-bf, and Xenon 1902g), and the configuration seemed to work the same on all of them.

There is a few USB keyboard modes though I've tested only config code PAP124 (Keyboard [PC]) and this worked as expected, just like a second keyboard on the system.

There is however a USB HID mode called "USB HID Bar Code Scanner" (config code PAP131) and this is the mode I'm interested in. This worked with the BarcodeScanner class of Win 10 apps, and I would have assumed worked according to the USB specification linked above. I just don't know how to work with the device in that mode.
 
So it's a hidden human interface device ;)

Well, I fear I can't help you with these modes. What I did was programming scanners to "preamble" everything with a function key F8. And in the application, that function key was configured to focus a textbox (or vice versa), so users wouldn't need to press F8 manually, but I see how this mode could help getting to the scanned barcode and even further info without such tricky configuration.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top