Querela / termux-usb-python

USB access with Python on Termux (Android)
MIT License
62 stars 13 forks source link

No backend available #6

Open Lolmc0587 opened 1 year ago

Lolmc0587 commented 1 year ago

i already installed libusb from https://wiki.termux.com/wiki/Termux-usb but cant start to work

blinry commented 1 year ago

Same! The specific error I get when running termux-usb -r -e ./usbtest_rw1.py.sh /dev/bus/usb/001/002 is:

Run usbtest_rw1.py ...
./usbtest_rw1.py.sh: line 15: cd: /data/data/com.termux/files/home/tools/usb: No such file or directory
[D] __main__: args: ['usbtest_rw1.py', '7']
[E] usb.backend.libusb1: Error loading libusb 1.0 backend
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/wip/termux-usb-python/venv/lib/python3.11/site-packages/usb/backend/libusb1.py", line 963, in get_backend
    _lib_object = _LibUSB(_lib)
                  ^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/wip/termux-usb-python/venv/lib/python3.11/site-packages/usb/backend/libusb1.py", line 717, in __init__
    _check(self.lib.libusb_init(byref(self.ctx)))
  File "/data/data/com.termux/files/home/wip/termux-usb-python/venv/lib/python3.11/site-packages/usb/backend/libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/wip/termux-usb-python/usbtest_rw1.py", line 90, in <module>
    main(fd)
  File "/data/data/com.termux/files/home/wip/termux-usb-python/usbtest_rw1.py", line 18, in main
    device = device_from_fd(fd)
             ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/wip/termux-usb-python/usblib.py", line 101, in device_from_fd
    lib = backend.lib
          ^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'lib'

Deleting line 15 in the .sh script fixed the first error (I cloned the repo to a different location), but the rest of the error remains.