PORTS Forum
Ports and Interfaces => USB => Topic started by: ulao on November 30, 2017, 10:49:47 pm
-
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
-
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.
-
Code is copyritghted but relevant section is this
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);
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.
-
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.
-
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.