[libhid-discuss] Searching for multiple hubs using force_open()

shivaprasad javali jbsp72 at gmail.com
Thu Jun 26 04:56:32 UTC 2008


Hi,

      I am trying to use libhid for my USB device. The USB device has no
serial number to distinguish between two devices of the same type. I tried
using hid_force
_open() in a loop to detect all my devices, but when I ran it It detected
the first device alright but when it tried to scan the usb ports for a
second time it tried to open the same device which it had previously opened
, and errored out.

     I started to look through the libhid code and found that libhid makes
sure it doesnot try to open the same device twice here:
http://libhid.alioth.debian.org/doc/hid__opening_8c-source.html#l00139 ,
which checks whether I have previously opened the device or not. This call
is failing and the return code from the hid_force_open() is 11.


    If there is no serial number to distinguish between two USB devices of
the same type will this always happen(as in hid_previously_matched returns
false even though it has been previously matched) . What can I do correct
this?

    Will I have to write my own custom matcher function?

Thanks
Shivaprasad


More information about the libhid-discuss mailing list