USB : USB Classes    A Closer Look at HID Class  

A real HID device (not those free demo programs that you see on the Web) has to be able to handle data items of any size between 1 bit and 32 bits. That means that a real HID device has to be able to put the data items into the right place in each data packet of a Report before sending it out, and it has to be able to extract the data items from the packets of any Reports that the device has received. We refer to this as packing and unpacking.

Packing and unpacking odd size data items is also tricky business to do fast and to always get right, but it's an essential part of making real USB HID class devices that can do everything that the USB standards say they should. The code that HIDmaker FS creates for both peripheral and PC automatically packs and unpacks data for you, on the fly, without wasting time or precious data memory on the peripheral device. It even automatically handles tricky situations like where a data item actually straddles the boundary between two packets in the Report.

It's part of the standard. You have a right to expect your HID device to be able to handle Reports that are larger than one packet, and you have a right to expect your HID device to be able to pack and unpack odd sized data items for you. If you don't have a tool that can do that for you, than get a tool that can! (Hint: It's HIDmaker FS.)

In our next tutorial, we'll show how packing and unpacking provides the real power for your USB device.


17 of 17
Copyright Notice and Author Information