Ports and Interfaces > USB

libusb with hid feature requests?

(1/1)

ulao:
Jan, I know HIDAPI is preferred over libUSB but wondered if you could comment on why a common HID gampead does not allow feature request? It seems both C and JAVA have issues using feature requests. 

libusb_control_transfer returns -2 (invalid param)(edited) on windows but the same code works fine on linux


Jan Axelson:
If the device supports the request, one reason could be that the parameter is invalid on Windows. If you post the code, someone might see something.

ulao:
Code is copyritghted but relevant section is this

--- Code: ---
   ret = libusb_set_configuration(autoconfig_libusb_handle, 1);

   if (ret < 0)
   {
      RARCH_ERR("[Autoconf]: Error during libusb_set_configuration.\n");
      goto error;
   }

   ret = libusb_claim_interface(autoconfig_libusb_handle, 0);

   if (ret < 0)
   {
      RARCH_ERR("[Autoconf]: Error during libusb_claim_interface.\n");
      goto error;
   }

   ret = libusb_control_transfer(autoconfig_libusb_handle, USB_CTRL_IN, USB_HID_GET_REPORT, BLISSBOX_USB_FEATURE_REPORT_ID, 0, answer, USB_PACKET_CTRL_LEN, USB_TIMEOUT);

   if (ret < 0)
      RARCH_ERR("[Autoconf]: Error during libusb_control_transfer.\n");

   libusb_release_interface(autoconfig_libusb_handle, 0);
--- End code ---

It more then likely will not tell much as the error is in the libusb but if it helps I can get the defined data.

Jan Axelson:
That looks like code for IN Feature requests (device-host Data stage), if that makes a difference. Of course it also depends on what parameters are actually passed and if they are the correct type, size, etc.

ulao:
yes correct and when sent 'in' it fails.  I did more reading and I here libusb requires drivers. It apparently is a mess. HIDAPI fix things up so libusb is out.

Navigation

[0] Message Index

Go to full version