[libhid-discuss] help
Roberto Diaz
robdiaz at ti.com
Thu Jun 17 23:22:22 UTC 2010
Hello,
I'm developing an application that would communicate with an HID device
either through interrupt or control transfers. So far, I have succeeded with
HID control transfer by using "libhid" any how I have a problems using both
the hid_interrupt_write( ) and hid_interrupt_read( ) functions. I'm using as
skeleton program the lshid.c example file that is provided by
libhid-0.2.16.tar.gz package, I'm simply changing the hid_set_output_report
function ( this function is correctly working for the same device) with the
hid_interrup_write( ) funtion; and this is the output messages that I get
when I'm using hid_interrup_write( ).
NOTICE: hid_force_open(): successfully opened USB device 001/005[0].
************************************************************************
Sending Report...***.
TRACE: hid_interrupt_write(): writing interrupt report to device
001/005[0] ...
WARNING: hid_interrupt_write(): failed to perform interrupt write to device
001/005[0]: error submitting URB: Device or resource busy
hid_set_output_report failed with return code 21
TRACE: hid_close(): closing USB device 001/005[0]...
TRACE: hid_close(): closing handle of USB device 001/005[0]...
NOTICE: hid_close(): successfully closed USB device 001/005[0].
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/005[0]...
TRACE: hid_close(): freeing memory allocated for HID parser...
TRACE: hid_close(): resetting HIDInterface...
ERROR: hid_reset_HIDInterface(): ************NULL HIDInterface reseted.
NOTICE: hid_cleanup(): successfully deinitialised HID library.
This is the source code that I'm using
/* data init */
for (i = 0 ; i < 32 ; i++)
hid_id[i] = NULL;
ret = hid_init();
hid = hid_new_HIDInterface();
matcher.vendor_id = HID_ID_MATCH_ANY;
matcher.product_id = HID_ID_MATCH_ANY;
matcher.matcher_fn = device_iterator;
/* open recursively all HID devices found */
while ( (ret = hid_force_open(hid, 0, &matcher, 2)) !=
HID_RET_DEVICE_NOT_FOUND)
{
printf("********************************************************************
****\n");
//hid_write_identification(stdout, hid);
/* Only dump HID tree if asked */
/* hid_dump_tree(stdout, hid); */
char packet2[4] = { 0x07, 0x01, 0, 0, 0, 0, 0,0,0};
unsigned int timeout = 1000; // milliseconds
ret = hid_interrupt_write(hid, 0x01, packet2, 9, timeout);
hid_close(hid);
}
hid_delete_HIDInterface(&hid);
ret = hid_cleanup();
return 0;
I hope that someone can help me to understand what is happening or what I'm
doing wrong.
P.S. The device I'm using supports both HID interrupt and control transfers
and I have confirm that this specific device works whitout problems trought
a similar windows application.
Thanks in advance for your comments
Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20100617/2c4ba950/attachment.htm>
More information about the libhid-discuss
mailing list