Skip to content

Better arrays support

Benjamin Tissoires requested to merge bentiss/hid-tools:wip/arrays into master

This was triggered by the USI pens as discussed in https://lore.kernel.org/all/4c87f439-f6d0-97e7-156e-90e9baab4b01@linux.intel.com/

The device is having the following (valid) HID report descriptor

       Physical(Digitizers.Stylus)
       Logical(Digitizers.Preferred Line Style)
       Application(Digitizers.Pen)
       Usage(6)
         Digitizers.Ink
         Digitizers.Pencil
         Digitizers.Highlighter
         Digitizers.Chisel Marker
         Digitizers.Brush
         Digitizers.No Preference
       Logical Minimum(1)
       Logical Maximum(6)
       Physical Minimum(0)
       Physical Maximum(255)
       Unit Exponent(-1)
       Unit(SI Linear : Centimeter)
       Report Size(8)
       Report Count(1)
       Flags( Variable Absolute NoPreferredState )

This is a nice way of ensuring we only have one style at any given time: the input will contain the index between 1 to 6 of the usages, and we then ensure we have only one available. It's an array of one element.

The current implementation of arrays was working thanks to a band-aid in tests/test_keyboard.py where the array part was computed in the device but not in the generic implementation.

This series builds a better generic implementation of arrays witha a couple of fixes allowing to test those new devices (in a followup MR).

Merge request reports