0
$\begingroup$

I am trying to get the usb.find command to work properly in a python script I'm writing on Angstrom for the Beagleboard.

Here is my code:

#!/usr/bin/env python

import usb.core 
import usb.util 
import usb.backend.libusb01 as libusb


PYUSB_DEBUG_LEVEL = 'debug'
# find our device
# Bus 002 Device 006: ID 1208:0815
#  idVendor           0x1208
#  idProduct          0x0815
# dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
# iManufacturer           1 TOROBOT.com

dev = usb.core.find(idVendor=0x1208, idProduct=0x0815,
backend=libusb.get_backend() )

I don't know what's missing, but here is what I do know. When I don't specify the backend, no backend is found. When I do specify the backend usb.backend.libusb01 I get the following error:

root@beagleboard:~/servo# ./pyServo.py
Traceback (most recent call last):
  File "./pyServo.py", line 17, in <module>
    dev = usb.core.find(idVendor=0x1208, idProduct=0x0815, backend=libusb.get_backend() )
  File "/usr/lib/python2.6/site-packages/usb/core.py", line 854, in find
    return _interop._next(device_iter(k, v))
  File "/usr/lib/python2.6/site-packages/usb/_interop.py", line 60, in _next
    return next(iter)
  File "/usr/lib/python2.6/site-packages/usb/core.py", line 821, in device_iter
    for dev in backend.enumerate_devices():
  File "/usr/lib/python2.6/site-packages/usb/backend/libusb01.py", line 390, in enumerate_devices
    _check(_lib.usb_find_busses())
  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: python: undefined symbol: usb_find_busses

What am I missing so that this will work properly?

Thank you.

$\endgroup$
4
  • $\begingroup$ It looks like you could be missing the libusb library, or have the wrong version installed somehow; the error doesn't seem to be coming from the python side. $\endgroup$
    – Ian
    Dec 9, 2013 at 2:52
  • $\begingroup$ Libusb is installed and everything that I knew to install has been done so with OPKG package manager. That includes python-core, python-pyusb, python-ctypes, python-setup. $\endgroup$
    – ChronoFish
    Dec 9, 2013 at 13:23
  • $\begingroup$ @ChronoFish, if you have happened to discover the solution, please provide it as an answer to this question (and accept it too). $\endgroup$
    – Shahbaz
    Dec 9, 2014 at 17:42
  • $\begingroup$ @Shahbaz, I did not find a solution for this specific problem. I found a work-a-round: The device I was trying to interface responded to a generic arduino driver so my needs were met... $\endgroup$
    – ChronoFish
    Dec 10, 2014 at 23:16

1 Answer 1

1
$\begingroup$

At the time of writing, OP is still missing some info so this is only my guess.

TLDR; My guess of a cause of the problem is you didn't have libusb version 0.1

As in unix.stackexchange.com#q428927, there seems to be API breakage b/w 0.1 and 1.0 of libusb, and the symbol in the error you got, usb_find_busses, was removed in 1.0.

However, in your code you're specifying to use 0.1, so API breakage shouldn't matter here (esp. knowing pyusb is capable of handling libusb 0.1).

The only situation I can think of for why you still see this error is that pyusb expects libusb 0.1 to be available on your environment but it is unavailable somehow.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.