Displaying 4 results from an estimated 4 matches for "hid_rep_index".
2023 Nov 05
1
Passing hid_rep_index to libusb_get_config_descriptor is wrong?
...libusb1.c
+++ b/drivers/libusb1.c
@@ -420,7 +420,7 @@ static int nut_libusb_open(libusb_device_handle **udevp,
upsdebugx(2, "Reading first configuration descriptor");
ret = libusb_get_config_descriptor(device,
- (uint8_t)usb_subdriver.hid_rep_index,
+ 0, //(uint8_t)usb_subdriver.hid_rep_index,
&conf_desc);
/*ret = libusb_get_active_config_descriptor(device,
&conf_desc);*/
When running from commit ab55bc0 on master, I end up with
usb_subdriver.hid_rep_index = 2 and libusb_...
2023 Nov 05
1
Passing hid_rep_index to libusb_get_config_descriptor is wrong?
...nfiguration has at least one interface. An interface may define zero or
more endpoints.
Reading about multiple configurations, they appear to be intended for
things like a USB device operating in high-speed or low-speed mode, or a
debug vs normal mode, or maybe high vs low power mode. Given this,
hid_rep_index (which libusb1.h defines as "number of the interface we use
in a composite USB device") is absolutely not the right thing to pass to
libusb_get_config_descriptor(), because the number of configurations are
not related to the index of the interface being used. Passing 0 would be
better tha...
2023 Nov 05
1
Passing hid_rep_index to libusb_get_config_descriptor is wrong?
...b1.c
> @@ -420,7 +420,7 @@ static int nut_libusb_open(libusb_device_handle
> **udevp,
>
> upsdebugx(2, "Reading first configuration descriptor");
> ret = libusb_get_config_descriptor(device,
> - (uint8_t)usb_subdriver.hid_rep_index,
> + 0, //(uint8_t)usb_subdriver.hid_rep_index,
> &conf_desc);
> /*ret = libusb_get_active_config_descriptor(device,
> &conf_desc);*/
>
> When running from commit ab55bc0 on master, I end up with
> usb_subdri...
2023 Nov 05
1
Passing hid_rep_index to libusb_get_config_descriptor is wrong?
@jimklimov: Looking at the code that uses hid_rep_index, hid_desc_index,
and hid_ep_in|out in usb_subdriver (all in nut_libusb.h)
I don't see any use of the addvars mechanism. If I follow the examples that
set and use those struct members, it looks like everything relies on them
being initialized to 0 by default, then only set in subdrivers or
situa...