walac/pyusb — pull request #11 by Norberg (2012-12-25 14:16:46+00:00)
Title: Fixed crach after introduction of port_number support

The port_number commit broke usb.core.find() in all bakends, and some test, this 2 commits fix all bakends and make the test pass again :)

exceptions before this commit:
simon@squeeze:~/pyusb$ export PYUSB_DEBUG_LEVEL=debug
simon@squeeze:~/pyusb$ bpython
>>> import usb
>>> usb.core.find()
2012-12-25 13:19:54,967 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend
Traceback (most recent call last):
File "usb/backend/libusb1.py", line 661, in get_backend
_setup_prototypes(_lib)
File "usb/backend/libusb1.py", line 394, in _setup_prototypes
lib.libusb_get_port_number.argtypes = [c_void_p]
File "/usr/lib/python2.6/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.6/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/libusb-1.0.so.0: undefined symbol: libusb_get_port_number
2012-12-25 13:19:55,513 ERROR:usb.backend.openusb:Error loading OpenUSB backend
Traceback (most recent call last):
File "usb/backend/openusb.py", line 702, in get_backend
_lib = _load_library()
File "usb/backend/openusb.py", line 248, in _load_library
raise OSError('USB library could not be found')
OSError: USB library could not be found
2012-12-25 13:19:55,643 INFO:usb.core:find(): using backend "usb.backend.libusb0"
2012-12-25 13:19:55,645 DEBUG:usb.backend.libusb0:_LibUSB.enumerate_devices()
2012-12-25 13:19:55,805 DEBUG:usb.backend.libusb0:_LibUSB.get_device_descriptor()
Traceback (most recent call last):
File "", line 1, in
File "usb/core.py", line 870, in find
return _interop._next(device_iter(k, v))
File "usb/_interop.py", line 60, in _next
return next(iter)
File "usb/core.py", line 838, in device_iter
d = Device(dev, backend)
File "usb/core.py", line 532, in __init__
'port_number'
File "usb/core.py", line 56, in _set_attr	setattr(output, f, int(getattr(input, f)))
TypeError: int() argument must be a string or a number, not 'NoneType'