Tuesday, May 4, 2010

Elusive HID Mouse Format

The problem is that I don't understand (yet) how Windows & Linux seem to understand the 4-byte Wheel format for HID Mouse that is declared as a Boot (Interface) Mouse (see Device Class Definition for HID Version 1.11 @ usb.org). Boot Interface subclass defines descriptors for Keyboard and Mouse boot devices. The packet format for Mouse data is similar to the PS/2 format except that the Sign & Overflow bits are not used in the first byte and the X-Y range is -128 to +127 (instead of -256 to +255 supported by PS/2).

Maybe the fact that devices are allowed to append additional data to boot reports (for keyboard and mouse) must be the key here. So even though the BIOS may ignore anything beyond the first 3 bytes of a mouse report, the HID driver under Windows or Linux understands the additional data (such as Wheel). However, this is still interesting because as per  Microsoft documentation the Mouse data formats (for PS/2 and USB) require the PS/2 format (see the document here). This implies that the Boot Mouse HID drivers are intelligent to understand the extended packet format that contains the Wheel data in a Boot Mouse report. So the question is what else does this driver support? I haven't found any information on the implementation of generic HID driver for mouse that would explain the behavior.

No comments:

Post a Comment