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)


Am 14.06.2015 um 02:54 schrieb Wander Lairson Costa:
> 2015-06-13 8:33 GMT-03:00 Matthias Grabowski <em...@mailbox.org>:
>> hey guys,
>>
> Hi, so what's going on here is a chain of unfortunate events.
>
>> 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
> 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
>
>> 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
>
>> 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
>>
> But libusb 0.1 does not implement is_kernel_driver_active function...
>
>> matt
>>
>



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

Reply via email to