Giter VIP home page Giter VIP logo

Comments (2)

amorphic avatar amorphic commented on August 19, 2024

There were other problems related to pyusb 1.0.0b2 as per #24. In the end we fixed the version to 1.0.0b1 because there didn't seem to be a workaround.

from temper-python.

padelt avatar padelt commented on August 19, 2024

So I just tried that again. Checked out master branch, essentially applied this patch:

diff --git a/setup.py b/setup.py
index ed992b7..24f7220 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ setup(
     long_description=open('README.md').read(),
     packages=['temperusb'],
     install_requires=[
-        'pyusb==1.0.0b1',
+        'pyusb>=1.0.0b2',
     ],
     entry_points={
         'console_scripts': [
diff --git a/temperusb/temper.py b/temperusb/temper.py
index 1e3a8ae..fef30f7 100644
--- a/temperusb/temper.py
+++ b/temperusb/temper.py
@@ -211,7 +211,7 @@ class TemperDevice(object):
         """
         Read data from device.
         """
-        data = self._device.read(ENDPOINT, REQ_INT_LEN, interface=INTERFACE, timeout=TIMEOUT)
+        data = self._device.read(ENDPOINT, REQ_INT_LEN, timeout=TIMEOUT)
         LOGGER.debug('Read data: {0}'.format(data))
         return data

Then (in a virtualenv) let setup.py install run and then

(for i in {1..30} ; do temper-poll 2>&1 | grep -i usberror ; done) | wc -l
8

That yielded 6, 8 and 8 USBErrors for 30 runs over 3 tries.

usb.core.USBError: [Errno None] error sending control message: Broken pipe

Using pyusb 1.0.0b1 (as it is in master now) yielded 7,8 and 7 USBErrors. So after all, no real difference.

Fun fact: Using pyusb 1.0.0b1 I get libusb1:

$ PYUSB_DEBUG=debug temper-poll 2>&1 | grep "using"
2015-12-22 14:23:37,832 INFO:usb.core:find(): using backend "usb.backend.libusb1"

Using pyusb 1.0.0b2 I get libusb0:

$ PYUSB_DEBUG=debug temper-poll 2>&1 | grep "using"
2015-12-22 14:24:59,943 INFO:usb.core:find(): using backend "usb.backend.libusb0"

The cause seems to be an error while trying to find symbol libusb_strerror:

2015-12-22 14:26:19,325 ERROR:usb.backend.libusb1:Error loading libusb 1.0 backend
Traceback (most recent call last):
  File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 880, in get_backend
    _setup_prototypes(_lib)
  File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 453, in _setup_prototypes
    lib.libusb_strerror.argtypes = [c_uint]
  File "/usr/lib/python2.7/ctypes/__init__.py", line 378, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/arm-linux-gnueabihf/libusb-1.0.so.0: undefined symbol: libusb_strerror
2015-12-22 14:26:19,416 ERROR:usb.libloader:'OpenUSB library' could not be found
2015-12-22 14:26:19,418 ERROR:usb.backend.openusb:Error loading OpenUSB backend
2015-12-22 14:26:19,439 INFO:usb.core:find(): using backend "usb.backend.libusb0"

(This is on Raspbian on a Raspberry Pi, Linux 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l GNU/Linux)

That - in turn - stems from pyusb 1.0.0b2 trying to use an API in libusb1 that does not seem to be consistently available in all distributions of libusb: https://github.com/walac/pyusb/issues/57
Broken source in 1.0.0b2: https://github.com/walac/pyusb/blob/1.0.0b2/usb/backend/libusb1.py
The change that might have repaired it for us: walac/pyusb@c46563c

I just tried it and the unreleased version 1.0.0rc1 of pyusb does in fact let my case run with libusb1 as backend (same error rate). Have a look at (and test) #40 .

I'll close this issue for now. I guess further discussion is best directed at the pull request.

from temper-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.