On Wed, May 19, 2010 at 8:59 AM, Karl Palsson <tw...@tweak.net.au> wrote:
> But on linux, even as root, I just get USBError('Resource busy',) exceptions
> when I try and read from the device.  I know that I'm meant to have a 
> cfg.set()
> line, but I didn't need it on windows, and if I add it for linux, I just get a
> "Resource busy" exception when it tries to set the config, instead of when it
> tries to read.
>
> Is it possibly related to needing to "detach" the kernel driver?  I've found
> some wild references to that, but I have no idea how to do so...
>

Yes I think you need to detach the kernel HID driver.

For pyusb, I think you can use detach_kernel_driver().
http://pyusb.svn.sourceforge.net/viewvc/pyusb/trunk/usb/core.py?revision=61&view=markup

  679     def detach_kernel_driver(self, interface):
  680         r"""Detach a kernel driver.
  681
  682         If successful, you will then be able to perform I/O.
  683         """
  684         self._ctx.managed_open()
  685         self._ctx.backend.detach_kernel_driver(self._ctx.handle,
interface)

Alternative solutions (not using pyusb):
1) If you have libhid installed, you can use libhid-detach-device.
2) Or you can manually detach the HID device driver.
http://old.nabble.com/How-to-dump-HID-report-descriptor-under-Linux-td19609562.html


-- 
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------

_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to