Hi -- I've found an issue with HID report descriptor parsing that causes a
field to be generated for what are supposed to be padding bits in the
report.  One device that triggers this problem, a Logitech Marble Mouse
trackball, works normally as mouse but causes the /dev/input/eventX
interface to report a bogus axis.

The problem seems to be that when hid-core parses the HID report
descriptor it incorrectly attributes one 'usage' to the 1x6 bit constant
padding item in the MarbleMouse's report and so adds a field for it (see
MarbleMouse report descriptor and the hid-debug device dump below.)

Later on when hid-input prepares the device capabilities for evdev, it
generates BTN_LEFT, BTN_RIGHT, REL_X, REL_Y, and ABS_MISC.  The ABS_MISC
is generated from the bogus padding field because the Usage Page is 0
(which is undefined and reserved in USB spec.)

The following change in hid-core.c (kernel 2.4.14) causes the usages for
the padding item to be 0 (and so avoids adding the field for lack of
usages), but I suspect that someone made usages=report_count for a reason.  
Usages being recorded differently for arrays vs. variables seems
curious...

hid-core.c:hid_add_field( ... )
{
  // ...
  if (HID_MAIN_ITEM_VARIABLE & ~flags) { /* ARRAY */
    // ...
    usages = parser->local.usage_index;
  } else { /* VARIABLE */
-   usages = parser->global.report_count;
+   usages = parser->local.usage_index;
  }
  // ...
}

-- Richard Moats ([EMAIL PROTECTED])


-------
Logitech Marble Mouse HID report descriptor:

05 01   Usage Page      Generic Desktop
09 02   Usage           Mouse
a1 01   Collection      Application
05 09   Usage Page      Button
19 01   Usage Min       Button 1
29 02   Usage Max       Button 2
15 00   Logical Min     0
25 01   Logical Max     1
95 02   Report Count    2
75 01   Report Size     1
81 02   Input           (Data,Variable,Absolute)
95 01   Report Count    1
75 06   Report Size     6
81 03   Input           (Constant,Variable,Absolute)
05 01   Usage Page      Generic Desktop
09 01   Usage           Pointer
a1 00   Collection      Physical
09 30   Usage           X
09 31   Usage           Y
15 81   Logical Min     -127
25 7f   Logical Max     127
75 08   Report Size     8
95 02   Report Count    2
81 06   Input           (Data,Variable,Relative)
c0      End Collection
c0      End Collection

----------

The hid-debug.c output:

kernel: Manufacturer: Logitech
kernel: Product: USB-PS/2 Trackball
kernel: Application(GenericDesktop.Mouse)
kernel:   INPUT[INPUT]
kernel:     Field(0)
kernel:       Usage(2)
kernel:         Button.0001
kernel:         Button.0002
kernel:       Logical Minimum(0)
kernel:       Logical Maximum(1)
kernel:       Report Size(1)
kernel:       Report Count(2)
kernel:       Report Offset(0)
kernel:       Flags( Variable Absolute )
kernel:     Field(1)                     <---- field erroneously added
kernel:       Usage(1)
kernel:         Pointer.0000
kernel:       Logical Minimum(0)
kernel:       Logical Maximum(1)
kernel:       Report Size(6)
kernel:       Report Count(1)
kernel:       Report Offset(2)
kernel:       Flags( Constant Variable Absolute )
kernel:     Field(2)
kernel:       Physical(GenericDesktop.Pointer)
kernel:       Usage(2)
kernel:         GenericDesktop.X
kernel:         GenericDesktop.Y
kernel:       Logical Minimum(-127)
kernel:       Logical Maximum(127)
kernel:       Report Size(8)
kernel:       Report Count(2)
kernel:       Report Offset(8)
kernel:       Flags( Variable Relative )



_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to