The source project of this merge request has been removed.
hidtools: Add support for BUS_HOST
Currently, hid-tools does not support BUS_HOST
. This can, for example,
cause hid-recorder
to crash when it encounters a device with that bus
with the following stack trace:
Traceback (most recent call last):
File "/home/ukas/hid-tools/./hid-recorder", line 23, in <module>
hidtools.cli.record.main()
File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/ukas/hid-tools/hidtools/cli/record.py", line 75, in main
device_list = [open(list_devices())]
File "/home/ukas/hid-tools/hidtools/cli/record.py", line 36, in list_devices
d = HidrawDevice(f)
File "/home/ukas/hid-tools/hidtools/hidraw.py", line 199, in __init__
self.bustype = BusType(bustype)
File "/usr/lib/python3.9/enum.py", line 360, in __call__
return cls.__new__(cls, value)
File "/usr/lib/python3.9/enum.py", line 678, in __new__
raise ve_exc
ValueError: 25 is not a valid BusType
BUS_HOST
is for example used on HID devices connected via the Microsoft
Surface Aggregator, an embedded controller found on newer Microsoft
Surface devices. On those devices the surface_hid
kernel driver provides
a HID transport channel to that EC.
Add support for BUS_HOST
to prevent crashes like this.