hidutils / hid-recorder

A utility to record HID data from /dev/hidraw devices
MIT License
1 stars 4 forks source link

Improve the report printing by shortening repeats #18

Closed whot closed 4 months ago

whot commented 4 months ago

This refactors the report printing so we can put limits on things, in particular: a device with 3 or more vendor reports in a row or 3 or more identical fields in a row will now shorten these.

My Wacom Intuos Pro hid-recorder goes from 6235 lines to 844 lines which is a lot more manageable with puny eyes. Example for repeated vendor usages:

# ------- Input Report -------
# Report ID: 33
#    Report size: 352 bits
#  | Bits:   8..=15  | Usage: ff00/0054: Vendor Defined Usage ff00 / 0054            | Logical Range:     0..=255
#  | Bits:  16..=23  | Usage: ff00/0051: Vendor Defined Usage ff00 / 0051            | Logical Range:     0..=255
#  | Bit:   24       | Usage: ff00/0042: Vendor Defined Usage ff00 / 0042            | Logical Range:     0..=1
#  | Bits:  25..=31  | ######### Padding
#  | Bits:  32..=47  | Usage: ff00/0130: Vendor Defined Usage ff00 / 0130            | Logical Range:     0..=8960  | Physical Range:     0..=22400 | Unit: SILinear: cm
#  | Bits:  48..=63  | Usage: ff00/0131: Vendor Defined Usage ff00 / 0131            | Logical Range:     0..=5920  | Physical Range:     0..=14800 | Unit: SILinear: cm
#  | Bits:  64..=71  | Usage: ff00/0048: Vendor Defined Usage ff00 / 0048            | Logical Range:     0..=41    | Physical Range:     0..=2238  | Unit: SILinear: cm
#  |                 | Total of 6 vendor usages, ... use --full to see all

and for repeated usages:

#  | Bits:   8..=15  | Usage: ff0d/0001: Wacom / Wacom Digitizer                     | Logical Range:     0..=255   | Physical Range:     0..=359
#  | Bits:  16..=23  | Usage: ff0d/0001: Wacom / Wacom Digitizer                     | Logical Range:     0..=255   | Physical Range:     0..=359
#  | Bits:  24..=31  | Usage: ff0d/0001: Wacom / Wacom Digitizer                     | Logical Range:     0..=255   | Physical Range:     0..=359
#  | Bits:  32..=39  | Usage: ff0d/0001: Wacom / Wacom Digitizer                     | Logical Range:     0..=255   | Physical Range:     0..=359
#  |                 | Total of 511 repeated usages, ... use --full to see all

cc @bentiss for awareness