I recently had the opportunity to work with a 2d area scanner (aka Bar Code Reader) in a .NET application. Previously our client used proprietary software that just plain stunk so we decided to write our own software. One very cool thing I discovered while working on this project was that many USB devices (Like bar code scanners, joysticks, game pads, mice, keyboards, etc) sport a Human Interface Device (HID) interface. This interface communicates using the standard HID protocol defined by the USB Implementers Forum. The cool thing about this is that one standard device driver can be written and used for all USB HID devices on a particular platform. Normally you would have to write your own device driver or use an existing one to communicate with a USB device, ouch! USB HID eliminates that requirement. Windows ships with a standard USB HID device driver and automatically makes the HID interface available when a USB HID device is plugged into the system. Nothing to install, no device driver to write, yay! Windows also has a fairly easy to use API (Although a little quirky) for communicating with HID devices. This site, run by Jan Axelson, has a lot of good information on communicating with USB HID devices. His book, USB Complete, is also an invaluable resource, I would definitely recommend it if you will be doing HID development on any platform.

I have an HID .NET library available here if you want to skip most of the gory details and get right down to business. I have used this library in production and have not had any issues, please let me know if you have any feedback. Using this library, while encapsulating most of the underlying details, will require you to understand the format of data contained in the payload of the reports sent to and from the device. HID's communicate using "reports" which are analogous to packets in network terminology. The reports themselves are a standard USB HID data structure although the payload of these reports will be specific to the device or device type. Usually the payload data format can be found in the device SDK and/or by simply analyzing the payload data the device sends.

The following library, developed for the HHP IT4600/IT4800 area scanner, uses the aforementioned HID library.

IT4XXXScanner.zip (1.98 MB)