Am 24.11.2010 19:55, schrieb nick caruso: > I'm trying to use pyusb-1.0 under Ubuntu 10.10. > > I've tried using the example that comes along with the source > distribution but it doesn't work. > In particular, running it as root, I get the error "USBError: Resource Busy". > I think this is because the kernel has a driver on the device. > > I can fix this, but I'm wondering if there are any better examples out > there that anyone can point me to? > Yes, you are correct.
When I tried to read the data via USB from my GPS logger recently (via itrackutil), I got the same message, but not only in Ubuntu 10.10, but also in 10.04. The utility did work perfectly just a few days ago. I had to find out that the kernel module cdc_acm had claimed the device. When the GPS data logger was plugged in, the cdc_acm driver created a device that allowed real-time access to the current GPS data. The more complicated "direct" communication performed by itrackutil to access *stored* GPS data failed, because the device was already busy. After some google-ing, I solved the problem. The function you are looking for is "detachKernelDriver". It does, what it says it does. It will complain however if there is no kernel driver to detach, so you have to catch the exception: ... determine device, interface, and configuration ... try: handle = device.open() handle.detachKernelDriver(interface) except usb.USBError, err: if str(err).find('could not detach kernel driver from interface') >= 0: pass else: raise usb.USBError,err # any other USB error handle.setConfiguration(configuration) ... I did not find anything to (re)attach the device later. Any hints? Mike ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users