Extend USB-capable drivers and nut-scanner to detect multiple interfaces and try the one(s) with large Report Descriptor #2821
Labels
enhancement
nut-scanner
USB non-zero interface numbers
Most UPSes serve USB interactions on interface 0 which is default. Recent "composite devices" differ
USB
Milestone
In the few past years we see more and more devices where several USB interface numbers are implemented (not only experiments with Arduino, but also UPSes on the market like in issues #2271 and #2816), and NUT's default attempt to use interface number 0 (often with a 27-byte descriptor) is misguided and useless: the USB HID payloads are typically in 600-900 byte range or larger.
Due to this we have had a haphazard attempt to at least avoid hard-coded interface/config/descriptor and in/out endpoint numbers, allowing users to configure them (and hopefully having updated most or all drivers to honour the setting) starting with PR #2149 - for more details see issues and PRs tagged as https://github.com/networkupstools/nut/issues?q=state%3Aopen%20label%3A%22USB%20non-zero%20interface%20numbers%22
The next level of convenience would be to actually look up the amount of interfaces, their data sizes, and only walk those large enough when trying to parse USB HID information. Also check how many data points were actually extracted - if the descriptor told us nothing with some mapping table, that combo is useless anyway.
This could be useful both in drivers with auto-detection, and in
nut-scanner
to generate the needed settings forusb_config_index=0 usb_hid_rep_index=0 usb_hid_desc_index=0 usb_hid_ep_in=1 usb_hid_ep_out=1
(default numbers here).Finally, some USB devices may be non-HID at all. A lack of a large HID descriptor (or any HID descriptor) can be an indication to try non-HID USB protocols (serial-over-usb - probably a Megatec dialect then; modbus; etc.)
The text was updated successfully, but these errors were encountered: