On Wed, Sep 8, 2010 at 11:59 PM, Hans Petter Selasky <hselasky_at_c2i.net> wrote: > >> In kernel and userspace this is currently a feature in the HID libraries. > > And I agree that maybe this should be changed. Before changing anything please > grep the kernel sources for this function and check that no callers are using > this feature, or add this missing 1 << hid_collection mask. thanks for the answer! i was not going to change anything, not immediately at least :) someone pointed me at a bluetooth mouse with a somewhat "interesting" hid descriptor, i.e. hid descriptor = { 0x05 0x01 0x09 0x02 0xa1 0x01 0x85 0x03 0x09 0x01 0xa1 0x00 0x05 0x09 0x19 0x01 0x29 0x05 0x15 0x00 0x25 0x01 0x75 0x01 0x95 0x05 0x81 0x02 0x75 0x03 0x95 0x01 0x81 0x01 0x05 0x01 0x09 0x30 0x09 0x31 0x16 0x00 0x80 0x26 0xff 0x7f 0x75 0x10 0x95 0x02 0x81 0x06 0xa1 0x02 0x85 0x03 0x05 0x01 0x09 0x38 0x15 0x81 0x25 0x7f 0x75 0x08 0x95 0x01 0x81 0x06 0xc0 0xa1 0x02 0x85 0x03 0x05 0x0c 0x0a 0x38 0x02 0x15 0x81 0x25 0x7f 0x75 0x08 0x95 0x01 0x81 0x06 0xc0 0xc0 0xc0 } which (if i did everything right) decodes to Collection page=Generic_Desktop usage=Mouse Collection page=Generic_Desktop usage=Pointer Input id=3 size=1 count=1 page=Button usage=Button_1 Variable, logical range 0..1 Input id=3 size=1 count=1 page=Button usage=Button_2 Variable, logical range 0..1 Input id=3 size=1 count=1 page=Button usage=Button_3 Variable, logical range 0..1 Input id=3 size=1 count=1 page=Button usage=Button_4 Variable, logical range 0..1 Input id=3 size=1 count=1 page=Button usage=Button_5 Variable, logical range 0..1 Input id=3 size=16 count=1 page=Generic_Desktop usage=X Variable Relative, logical range -32768..32767 Input id=3 size=16 count=1 page=Generic_Desktop usage=Y Variable Relative, logical range -32768..32767 Collection page=Generic_Desktop usage=Y Input id=3 size=8 count=1 page=Generic_Desktop usage=Wheel Variable Relative, logical range -127..127 End collection Collection page=Generic_Desktop usage=Wheel Input id=3 size=8 count=1 page=Consumer usage=AC_Pan Variable Relative, logical range -127..127 End collection End collection End collection please notice two nested collections one with usage "Y" and another with usage "Wheel". the problem is that when for (d = hid_start_parse(desc, 1 << hid_input, -1); hid_get_item(d, &h) > 0; ) { switch(page) { case Generic_Desktop: switch(usage) { case X: break; case Y: break; case Wheel: break; } break; } } hid_end_parse(d); code used to parse the descriptor and extract data from input reports, "page" and "usage" on collection items override data from real input items :( so it looks like we are getting two "X" and two "Wheel" values -- one from real input item (which comes first) and then one from collection item (which comes after and has garbage value in it). in any case, workaround is quite simple (please see my latest commit to bthidd(8)), i.e. just check h.kind and make sure it set to hid_input. thanks, maxReceived on Thu Sep 09 2010 - 12:07:47 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:07 UTC