Discussion:
[pyusb-users] Not implemented error on is_kernel_driver_active
Matthias Grabowski
2015-06-12 12:20:03 UTC
Permalink
Hello guys,

I'm new to this mailing list, pyusb and Linux in general. So sorry, if some of my questions may be a little stupid. I know my way around python, though.

Anyways, I got a raspberry pi with raspbian installed and I'm writing a python script to read data from an air quality sensor that identifies itself as a HID to the OS. When I try to read or write data to/from the device I get a USBError:
Could not claim interface 0: device or resource busy.

I think that happens because the os attaches a kernel driver to the device. Correct?

In that case I found some code that tries to claim the interface:
if dev.is_kernel_driver_active (0):
dev.detach_kernel_driver(0)

usb.util.claim_interface (dev, 0)

But there I get a NotImplementedError. Why? Whats wrong and what can I do?

Matt
Wander Lairson Costa
2015-06-12 13:36:52 UTC
Permalink
Post by Matthias Grabowski
Hello guys,
I'm new to this mailing list, pyusb and Linux in general. So sorry, if some
of my questions may be a little stupid. I know my way around python, though.
Anyways, I got a raspberry pi with raspbian installed and I'm writing a
python script to read data from an air quality sensor that identifies itself
as a HID to the OS. When I try to read or write data to/from the device I
Could not claim interface 0: device or resource busy.
I think that happens because the os attaches a kernel driver to the device. Correct?
dev.detach_kernel_driver(0)
usb.util.claim_interface (dev, 0)
But there I get a NotImplementedError. Why? Whats wrong and what can I do?
Hi,

Could you please run with logs (export PYUSB_DEBUG=debug) and post the result?
--
Best Regards,
Wander Lairson Costa

------------------------------------------------------------------------------
Matthias Grabowski
2015-06-12 14:15:02 UTC
Permalink
I don't know what you want me to do with
export PYUSB_DEBUG=debug
Post by Matthias Grabowski
Post by Matthias Grabowski
Hello guys,
I'm new to this mailing list, pyusb and Linux in general. So sorry,
if some
Post by Matthias Grabowski
of my questions may be a little stupid. I know my way around python,
though.
Post by Matthias Grabowski
Anyways, I got a raspberry pi with raspbian installed and I'm writing
a
Post by Matthias Grabowski
python script to read data from an air quality sensor that identifies
itself
Post by Matthias Grabowski
as a HID to the OS. When I try to read or write data to/from the
device I
Post by Matthias Grabowski
Could not claim interface 0: device or resource busy.
I think that happens because the os attaches a kernel driver to the
device.
Post by Matthias Grabowski
Correct?
dev.detach_kernel_driver(0)
usb.util.claim_interface (dev, 0)
But there I get a NotImplementedError. Why? Whats wrong and what can
I do?
Hi,
Could you please run with logs (export PYUSB_DEBUG=debug) and post the result?
--
Best Regards,
Wander Lairson Costa
------------------------------------------------------------------------------
_______________________________________________
pyusb-users mailing list
https://lists.sourceforge.net/lists/listinfo/pyusb-users
Wander Lairson Costa
2015-06-12 14:14:55 UTC
Permalink
Post by Matthias Grabowski
I don't know what you want me to do with
export PYUSB_DEBUG=debug
This is an environment variable to define before running your script.
You can also define inside your Python code before you import the
pyusb modules. If you need further details, you might want to give a
look in the tutorial [1]

[1] https://github.com/walac/pyusb/blob/master/docs/tutorial.rst
Post by Matthias Grabowski
Am 12. Juni 2015 15:36:52 MESZ, schrieb Wander Lairson Costa
Post by Wander Lairson Costa
Post by Matthias Grabowski
Hello guys,
I'm new to this mailing list, pyusb and Linux in general. So sorry, if some
of my questions may be a little stupid. I know my way around python, though.
Anyways, I got a raspberry pi with raspbian installed and I'm writing a
python script to read data from an air quality sensor that identifies itself
as a HID to the OS. When I try to read or write data to/from the device I
Could not claim interface 0: device or resource busy.
I think that happens because the os attaches a kernel driver to the
device.
Correct?
dev.detach_kernel_driver(0)
usb.util.claim_interface (dev, 0)
But there I get a NotImplementedError. Why? Whats wrong and what can I do?
Hi,
Could you please run with logs (export PYUSB_DEBUG=debug) and post the result?
------------------------------------------------------------------------------
_______________________________________________
pyusb-users mailing list
https://lists.sourceforge.net/lists/listinfo/pyusb-users
--
Best Regards,
Wander Lairson Costa

------------------------------------------------------------------------------
Matthias Grabowski
2015-06-13 11:33:16 UTC
Permalink
hey guys,

i got it now, thanks :) The log follows below, it seems that pyusb was
unable to load the propper backend? when installing i did all the steps
in the documentation:
sudo apt-get install python libusb-1.0-0
sudo python setup.py install

Both run fine.

Heres the Log dump:
2015-06-12 16:38:05,805 ERROR:usb.backend.libusb1:Error loading libusb
1.0 backend
Traceback (most recent call last):
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/libusb1.py",
line 880, in get_backend
_setup_prototypes(_lib)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/libusb1.py",
line 453, in _setup_prototypes
lib.libusb_strerror.argtypes = [c_uint]
File "/usr/lib/python3.2/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python3.2/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/arm-linux-gnueabihf/libusb-1.0.so.0: undefined
symbol: libusb_strerror
2015-06-12 16:38:06,407 ERROR:usb.libloader:'OpenUSB library' could not
be found
2015-06-12 16:38:06,408 ERROR:usb.backend.openusb:Error loading OpenUSB
backend
2015-06-12 16:38:06,439 INFO:usb.core:find(): using backend
"usb.backend.libusb0"
2015-06-12 16:38:06,441
DEBUG:usb.backend.libusb0:_LibUSB.enumerate_devices()
2015-06-12 16:38:06,444
DEBUG:usb.backend.libusb0:_LibUSB.get_device_descriptor(<usb.backend.libusb0._usb_device
object at 0x150dc60>)
2015-06-12 16:38:06,446
DEBUG:usb.backend.libusb0:_LibUSB.get_device_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>)
2015-06-12 16:38:06,447
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,449
DEBUG:usb.backend.libusb0:_LibUSB.get_interface_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0, 0, 0)
2015-06-12 16:38:06,450
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,452
DEBUG:usb.backend.libusb0:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 1, 0, 0, 0)
2015-06-12 16:38:06,453
DEBUG:usb.backend.libusb0:_LibUSB.get_interface_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0, 0, 0)
2015-06-12 16:38:06,453
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,455
DEBUG:usb.backend.libusb0:_LibUSB.open_device(<usb.backend.libusb0._usb_device
object at 0x151c4e0>)
2015-06-12 16:38:06,514
DEBUG:usb.backend.libusb0:_LibUSB.close_device(22698048)

And from the console when i run my script:
Traceback (most recent call last):
File "testusb.py", line 65, in <module>
if dev.is_kernel_driver_active(0):
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/core.py",
line 992, in is_kernel_driver_active
interface)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/__init__.py",
line 363, in is_kernel_driver_active
_not_implemented(self.is_kernel_driver_active)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/__init__.py",
line 79, in _not_implemented
raise NotImplementedError(func.__name__)
NotImplementedError: is_kernel_driver_active

matt
Post by Wander Lairson Costa
Post by Matthias Grabowski
I don't know what you want me to do with
export PYUSB_DEBUG=debug
This is an environment variable to define before running your script.
You can also define inside your Python code before you import the
pyusb modules. If you need further details, you might want to give a
look in the tutorial [1]
[1] https://github.com/walac/pyusb/blob/master/docs/tutorial.rst
Post by Matthias Grabowski
Am 12. Juni 2015 15:36:52 MESZ, schrieb Wander Lairson Costa
Post by Wander Lairson Costa
Post by Matthias Grabowski
Hello guys,
I'm new to this mailing list, pyusb and Linux in general. So sorry, if some
of my questions may be a little stupid. I know my way around python, though.
Anyways, I got a raspberry pi with raspbian installed and I'm writing a
python script to read data from an air quality sensor that identifies itself
as a HID to the OS. When I try to read or write data to/from the device I
Could not claim interface 0: device or resource busy.
I think that happens because the os attaches a kernel driver to the
device.
Correct?
dev.detach_kernel_driver(0)
usb.util.claim_interface (dev, 0)
But there I get a NotImplementedError. Why? Whats wrong and what can I do?
Hi,
Could you please run with logs (export PYUSB_DEBUG=debug) and post the result?
------------------------------------------------------------------------------
_______________________________________________
pyusb-users mailing list
https://lists.sourceforge.net/lists/listinfo/pyusb-users
------------------------------------------------------------------------------
Wander Lairson Costa
2015-06-14 00:54:23 UTC
Permalink
Post by Matthias Grabowski
hey guys,
Hi, so what's going on here is a chain of unfortunate events.
Post by Matthias Grabowski
i got it now, thanks :) The log follows below, it seems that pyusb was
unable to load the propper backend? when installing i did all the steps
sudo apt-get install python libusb-1.0-0
sudo python setup.py install
Both run fine.
2015-06-12 16:38:05,805 ERROR:usb.backend.libusb1:Error loading libusb
1.0 backend
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/libusb1.py",
line 880, in get_backend
_setup_prototypes(_lib)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/libusb1.py",
line 453, in _setup_prototypes
lib.libusb_strerror.argtypes = [c_uint]
File "/usr/lib/python3.2/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python3.2/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/arm-linux-gnueabihf/libusb-1.0.so.0: undefined
symbol: libusb_strerror
So, you have a pretty old libusb 1.0 version installed, which does not
implement libusb_strerror yet. I solved this issue recently in PyUSB,
either upgrading libusb 1.0 or using git version of PyUSB must solve
the problem
Post by Matthias Grabowski
2015-06-12 16:38:06,407 ERROR:usb.libloader:'OpenUSB library' could not
be found
2015-06-12 16:38:06,408 ERROR:usb.backend.openusb:Error loading OpenUSB
backend
2015-06-12 16:38:06,439 INFO:usb.core:find(): using backend
"usb.backend.libusb0"
But you have libusb 0.1 installed, so PyUSB goes for it
Post by Matthias Grabowski
2015-06-12 16:38:06,441
DEBUG:usb.backend.libusb0:_LibUSB.enumerate_devices()
2015-06-12 16:38:06,444
DEBUG:usb.backend.libusb0:_LibUSB.get_device_descriptor(<usb.backend.libusb0._usb_device
object at 0x150dc60>)
2015-06-12 16:38:06,446
DEBUG:usb.backend.libusb0:_LibUSB.get_device_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>)
2015-06-12 16:38:06,447
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,449
DEBUG:usb.backend.libusb0:_LibUSB.get_interface_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0, 0, 0)
2015-06-12 16:38:06,450
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,452
DEBUG:usb.backend.libusb0:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 1, 0, 0, 0)
2015-06-12 16:38:06,453
DEBUG:usb.backend.libusb0:_LibUSB.get_interface_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0, 0, 0)
2015-06-12 16:38:06,453
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,455
DEBUG:usb.backend.libusb0:_LibUSB.open_device(<usb.backend.libusb0._usb_device
object at 0x151c4e0>)
2015-06-12 16:38:06,514
DEBUG:usb.backend.libusb0:_LibUSB.close_device(22698048)
File "testusb.py", line 65, in <module>
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/core.py",
line 992, in is_kernel_driver_active
interface)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/__init__.py",
line 363, in is_kernel_driver_active
_not_implemented(self.is_kernel_driver_active)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/__init__.py",
line 79, in _not_implemented
raise NotImplementedError(func.__name__)
NotImplementedError: is_kernel_driver_active
But libusb 0.1 does not implement is_kernel_driver_active function...
Post by Matthias Grabowski
matt
--
Best Regards,
Wander Lairson Costa

------------------------------------------------------------------------------
Matthias Grabowski
2015-06-14 11:21:24 UTC
Permalink
Hey,

my version that i downloaded from sourceforge seems to have indeed been
quite old. I got the latest version from github now. After some more
googling, im now using this code:

import usb.backend.libusb1 as libusb

backend = libusb.get_backend(find_library=lambda x:
"usr/lib/arm-linux-gnueabihf/libusb-1.0.so")

dev = usb.core.find(idVendor=VENDOR, idProduct = PRODUCT, backend=backend)

This works, the kernel_driver functions dont throw errors anymore. I can
even send data to my device and get a valid return code. However, when
reading from the device, there still seem to be problems.

ret = endpoint_out.write(message, 1000)
print(ret)
ret = endpoint_in.read(16)

On that last line i (again) get a undefined symbol error:
AttributeError: /usr/lib/arm-linux-gnueabihf/libusb-1.0.so: undefined
symbol: libusb_strerror

Whats happening now?

Heres the log file:

2015-06-14 13:14:00,122 ERROR:usb.backend.libusb1:Error loading libusb
1.0 backend
Traceback (most recent call last):
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/libusb1.py",
line 880, in get_backend
_setup_prototypes(_lib)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/libusb1.py",
line 453, in _setup_prototypes
lib.libusb_strerror.argtypes = [c_uint]
File "/usr/lib/python3.2/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python3.2/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/arm-linux-gnueabihf/libusb-1.0.so: undefined
symbol: libusb_strerror
2015-06-14 13:14:00,166 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<CDLL
'/usr/lib/arm-linux-gnueabihf/libusb-1.0.so', handle 10bb3c8 at 769023f0>)
2015-06-14 13:14:00,169 INFO:usb.core:find(): using backend
"usb.backend.libusb1"
2015-06-14 13:14:00,170
DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices()
2015-06-14 13:14:00,176
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>)
2015-06-14 13:14:00,178
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x766e44d0>)
2015-06-14 13:14:00,181
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x766e4450>)
2015-06-14 13:14:00,183
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x766e44f0>)
2015-06-14 13:14:00,185
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>)
2015-06-14 13:14:00,189
DEBUG:usb.backend.libusb1:_LibUSB.open_device(<usb.backend.libusb1._Device
object at 0x766e43f0>)
2015-06-14 13:14:00,190
DEBUG:usb.backend.libusb1:_LibUSB.is_kernel_driver_active(<usb.backend.libusb1._DeviceHandle
object at 0x769d8d50>, 0)
2015-06-14 13:14:00,192
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,194
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,196
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,198
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0, 0)
2015-06-14 13:14:00,200
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,201
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,203
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,205
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,206
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,208
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 1, 0, 0, 0)
2015-06-14 13:14:00,209
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,210
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,212
DEBUG:usb.backend.libusb1:_LibUSB.claim_interface(<usb.backend.libusb1._DeviceHandle
object at 0x769d8d50>, 0)
2015-06-14 13:14:00,214
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration(<usb.backend.libusb1._DeviceHandle
object at 0x769d8d50>)
2015-06-14 13:14:00,217
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,220
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,222
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,226
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0, 0)
2015-06-14 13:14:00,228
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,230
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,233
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 1, 0, 0, 0)
2015-06-14 13:14:00,235
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,236
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,239
DEBUG:usb.backend.libusb1:_LibUSB.intr_write(<usb.backend.libusb1._DeviceHandle
object at 0x769d8d50>, 2, 0, array('B', [40, 68, 42, 54, 52, 10, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32]), 1000)
2015-06-14 13:14:00,498
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,500
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,502
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,504
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0, 0)
2015-06-14 13:14:00,505
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0, 0, 0)
2015-06-14 13:14:00,506
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x766e43f0>, 0)
2015-06-14 13:14:00,508
DEBUG:usb.backend.libusb1:_LibUSB.intr_read(<usb.backend.libusb1._DeviceHandle
object at 0x769d8d50>, 129, 0, array('B', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0]), 1000)
Post by Wander Lairson Costa
Post by Matthias Grabowski
hey guys,
Hi, so what's going on here is a chain of unfortunate events.
Post by Matthias Grabowski
i got it now, thanks :) The log follows below, it seems that pyusb was
unable to load the propper backend? when installing i did all the steps
sudo apt-get install python libusb-1.0-0
sudo python setup.py install
Both run fine.
2015-06-12 16:38:05,805 ERROR:usb.backend.libusb1:Error loading libusb
1.0 backend
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/libusb1.py",
line 880, in get_backend
_setup_prototypes(_lib)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/libusb1.py",
line 453, in _setup_prototypes
lib.libusb_strerror.argtypes = [c_uint]
File "/usr/lib/python3.2/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python3.2/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/arm-linux-gnueabihf/libusb-1.0.so.0: undefined
symbol: libusb_strerror
So, you have a pretty old libusb 1.0 version installed, which does not
implement libusb_strerror yet. I solved this issue recently in PyUSB,
either upgrading libusb 1.0 or using git version of PyUSB must solve
the problem
Post by Matthias Grabowski
2015-06-12 16:38:06,407 ERROR:usb.libloader:'OpenUSB library' could not
be found
2015-06-12 16:38:06,408 ERROR:usb.backend.openusb:Error loading OpenUSB
backend
2015-06-12 16:38:06,439 INFO:usb.core:find(): using backend
"usb.backend.libusb0"
But you have libusb 0.1 installed, so PyUSB goes for it
Post by Matthias Grabowski
2015-06-12 16:38:06,441
DEBUG:usb.backend.libusb0:_LibUSB.enumerate_devices()
2015-06-12 16:38:06,444
DEBUG:usb.backend.libusb0:_LibUSB.get_device_descriptor(<usb.backend.libusb0._usb_device
object at 0x150dc60>)
2015-06-12 16:38:06,446
DEBUG:usb.backend.libusb0:_LibUSB.get_device_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>)
2015-06-12 16:38:06,447
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,449
DEBUG:usb.backend.libusb0:_LibUSB.get_interface_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0, 0, 0)
2015-06-12 16:38:06,450
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,452
DEBUG:usb.backend.libusb0:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 1, 0, 0, 0)
2015-06-12 16:38:06,453
DEBUG:usb.backend.libusb0:_LibUSB.get_interface_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0, 0, 0)
2015-06-12 16:38:06,453
DEBUG:usb.backend.libusb0:_LibUSB.get_configuration_descriptor(<usb.backend.libusb0._usb_device
object at 0x151c4e0>, 0)
2015-06-12 16:38:06,455
DEBUG:usb.backend.libusb0:_LibUSB.open_device(<usb.backend.libusb0._usb_device
object at 0x151c4e0>)
2015-06-12 16:38:06,514
DEBUG:usb.backend.libusb0:_LibUSB.close_device(22698048)
File "testusb.py", line 65, in <module>
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/core.py",
line 992, in is_kernel_driver_active
interface)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/__init__.py",
line 363, in is_kernel_driver_active
_not_implemented(self.is_kernel_driver_active)
File
"/usr/local/lib/python3.2/dist-packages/pyusb-1.0.0b2-py3.2.egg/usb/backend/__init__.py",
line 79, in _not_implemented
raise NotImplementedError(func.__name__)
NotImplementedError: is_kernel_driver_active
But libusb 0.1 does not implement is_kernel_driver_active function...
Post by Matthias Grabowski
matt
------------------------------------------------------------------------------
Xiaofan Chen
2015-06-15 03:34:52 UTC
Permalink
Post by Matthias Grabowski
Hey,
my version that i downloaded from sourceforge seems to have indeed been
quite old. I got the latest version from github now. After some more
AttributeError: /usr/lib/arm-linux-gnueabihf/libusb-1.0.so: undefined
symbol: libusb_strerror
Whats happening now?
As mentioned before, your libusb is old.

Please download latest version of libusb (1.0.19) from Sourceforge.
http://libusb.info/
http://sourceforge.net/projects/libusb/
--
Xiaofan

------------------------------------------------------------------------------
Loading...