Page 1 of 1

hidtool read: 'Device or resource busy'.

Posted: Fri Jan 31, 2014 6:51 pm
by stf92
Hi: I ran examples/hid-data/commandline/hidtool:

Code: Select all

$ hidtool read
Error sending message: error sending control message: Device or resource busy
$

I checked hiddata.c. In usbhidGetReport I found

Code: Select all

    bytesReceived = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | reportNumber, 0, buffer, maxLen, 5000);

And having seen somethings in the sources (firmware), I knew the one of the fields in bmRequestType had to be 'device'. So I replaced USB_RECIP_INTERFACE above by USB_RECIP_DEVICE and, voila: 'hidtool read' worked correctly! Again with the 'write' parameter I got an error. And a new replacement at the appropiate usb_control_msg line made it run OK. Of course, the firmware in the device is that of example/hid-data, but the version of the whole package is 20080418. Being so old, I do not think this can be of any help to the readers but, who knows?

By the way, examples/usbtool did not work out either:

Code: Select all

$ usbtool -v0x16c0 -d 1,2,3,4,5 control in class device 9 0 0
USB error: error sending control message: Connection timed out

where I took the request from
RQ_HID_SET_REPORT 0x09
in the sources, and value, index I think are don't cares. But here I may be doing something wrong.