carlossless / sinowealth-kb-tool

A utility for reading and writing flash contents on Sinowealth 8051-based HID devices through the commonly found ISP bootloader
MIT License
52 stars 13 forks source link

setting & using a specific interface number #43

Closed carlossless closed 6 months ago

carlossless commented 6 months ago

Addresses the issue encountered in https://github.com/carlossless/sinowealth-kb-tool/issues/28#issuecomment-1880002380 and possibly https://github.com/carlossless/sinowealth-kb-tool/issues/40#issuecomment-1879929586.

I initially thought the selected device per interface would not matter for libusb and that any interface would accept a report that was declared for a different interface, but apparently, it does not. Also, libusb might enumerate these interfaces in varying orders, but that seems purely dependent on the USB descriptor.

Because of this, it's necessary to specify the interface where the ISP report declaration resides. I'm adding in a default (interface_number = 1) and a new argument to customize it. This might unfortunately break the previously declared parts/devices, but from the device reports I saw myself, the ISP report always lives on interface #1, so perhaps there won't be any issues.

Also, just to document this about USBHID somewhere: