Dealing with Usage Page

Aug 21, 2012 at 7:55 PM

Thanks for posting this project, it's been very helpful.  I too have valued the HID project at CodeProject and have used it successfully to read credit card readers and USB scales.

But now I've run into a problem with a Datalogic scanner.  It posts two HID entries:  A "Table Top Scanner" and a "Flash Update".  Both have a Usage Page value of xFF45.  The Flash Update has a Usage of xA000 and the Scanner has x4A00.  Both entities have non-zero inputReportByteLengths and outputReportByteLengths.

With my prior projects I never had to send the devices any data-- I just listened.  But for the scanner I need to send it an 'E' to enable it and a 'D' to enable it.  I just don't know how to do that and how the Usage values play into this. 

In my scale and credit card apps, I simply opened the device handle with CreateFile and then created a FileStream to read the input.  I tried using the FileStream to send the 'E' but it throws an exception.  But I think this is where the usage value comes into play.

On a related front, the main page of your project has some sample code.  However, I don't see the following member functions of device -- CreateOutputReport and SetUsage.  Have you implemented these functions in another way.  I have the SimpleHID.DLL as a reference in my project.

// Create and send a report
var outputReport = device.CreateOutputReport();
device.SendOutputReport(outputReport);

// Set individual usages
device.SetUsage(my_usagepage, my_usage1);
device.SetUsage(my_usagepage, my_usage2);
device.UnsetUsage(my_usagepage, my_usage3);
device.UnsetUsage(my_usagepage, my_usage4);

Any guidence you can give me would be most appreciated!

Best

Harry