[libhid-discuss] Digital Arts & Crafts Studio - HID help needed

Bill Kendrick nbs at sonic.net
Thu Nov 8 17:39:50 UTC 2007


On Thu, Nov 08, 2007 at 07:39:32AM -0500, Charles Lepple wrote:
> > Indeed.  I've decided to start using libusb directly, but currently  
> > have two problems:
> >
> > (1) Reads fail :)
> 
> Which error code? (Once you detach the device, you should be able to  
> do anything with libusb/libhid that you can do with the /dev/usb/ 
> hiddev* interface, but it's a matter of finding out exactly what to do)

I get timeouts.  I've updated the code to specifically examine the USB
device for it's wMaxPacketSize, to make sure I'm not trying to read too
much or too little at a time, but still get timeouts.  (Specifically,
error -110, which is negative ETIMEDOUT.)


> > (2) I have not successfully detatched the device from the kernel.
> >   libhid did this for me via the 'force' open call.
> >   For now, I need to use the 'libhid-detatch-device' (I think?)  
> > tool first. :(
> 
> All of the magic is contained in hid_os_force_claim() in linux.c. The  
> loop is a good idea for robustness, because sometimes the kernel does  
> not let go of the device immediately. Two or three retries should  
> suffice.

Got it.  I COULD detatch, I just forgot by the time I wrote that email. :^)
My issue was getting errors when I tried to detatch again.  So now I do like
libhid: try to open, if that fails, try (a few times) to detatch, and open
again.  Seems to work great. :)


<snip>
> Short answer: keep asking until people get annoyed :-)

Heh, thanks. :)

Well, for your reference, I've posted the current test code, using libusb,
and its output, on my website:

  http://www.sonic.net/~nbs/daacs/

:)

-- 
-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/



More information about the libhid-discuss mailing list