On Mon, Jun 11, 2012, at 02:45 PM, Pitichai Pitimaneeyakul wrote: > Hi Tom, > I got a keyboard which using the same chip holtek as you. I have applied > your patch and it works. However, I have dump the keyboard descriptor > (rdesc) as below, I am wondering to understand the keyboard descriptor > like (usage page, maximum, minimum ... etc) can you point out to where > to read ? I would like to apply and check with what I got from my > keyboard rdesc. Hi Pitichai, Thanks for trying out the patch :) The documentation for HID descriptors is here: http://www.usb.org/developers/devclass_docs/HID1_11.pdf , which explains what the fields mean. There are some good examples on page 25, the middle of page 41, and appendix B onwards. Briefly, the keyboard descriptor states the properties of the keyboard, such as having keys and LEDs. It describes the bit sequences sent by the keyboard when a key is pressed, and the bit sequences sent by the computer to toggle the LEDs. Here are some examples from your descriptor: > Item(Global): Report Count, data= [ 0x03 ] 3 > Item(Global): Report Size, data= [ 0x01 ] 1 > Item(Global): Usage Page, data= [ 0x08 ] 8 > LEDs > Item(Local ): Usage Minimum, data= [ 0x01 ] 1 > NumLock > Item(Local ): Usage Maximum, data= [ 0x03 ] 3 > Scroll Lock > Item(Main ): Output, data= [ 0x02 ] 2 > Data Variable Absolute No_Wrap Linear > Preferred_State No_Null_Position This is an output descriptor for keyboard LEDs, so the computer can send a message (a "report") to turn LEDs on and off. It specifies 3 x 1 bits (Report Count * Report Size) of information, i.e. one bit per LED. To map the three bits to LED names (num/caps/scroll lock), the descriptor references the Usage Page 0x08 (LEDs) lookup table, Usages 1 - 3 (the Usage Minimum -> Usage Maximum): http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf contains the usage page lookup tables. If you look for the LED Page 0x08 lookup table , you can see the descriptor is referencing the num/caps/scroll lock LEDs. As another example, the following describes input for three keys, again 3 * 1 bits: > Item(Global): Usage Page, data= [ 0x01 ] 1 > Generic Desktop Controls > Item(Local ): Usage, data= [ 0x80 ] 128 > System Control > Item(Main ): Collection, data= [ 0x01 ] 1 > Application > Item(Global): Report ID, data= [ 0x01 ] 1 > Item(Local ): Usage Minimum, data= [ 0x81 ] 129 > System Power Down > Item(Local ): Usage Maximum, data= [ 0x83 ] 131 > System Wake Up > Item(Global): Logical Minimum, data= [ 0x00 ] 0 > Item(Global): Logical Maximum, data= [ 0x01 ] 1 > Item(Global): Report Count, data= [ 0x03 ] 3 > Item(Global): Report Size, data= [ 0x01 ] 1 > Item(Main ): Input, data= [ 0x02 ] 2 > Data Variable Absolute No_Wrap Linear > Preferred_State No_Null_Position It references keys from the middle of the Generic Desktop Controls 0x01 table (0x81=system power down, 0x82=system sleep, 0x83=system wake up). These are just single bit items (key up/down, LED on/off), however you can get more complicated items: Such as a mouse sending two values x,y from -127 to 127 depending on mouse movement. Tom -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html