Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] pybricksdev HID does not work in all environments. #1915

Open
laurensvalk opened this issue Nov 4, 2024 · 2 comments
Open

[Bug] pybricksdev HID does not work in all environments. #1915

laurensvalk opened this issue Nov 4, 2024 · 2 comments
Labels
bug Something isn't working software: pybricksdev Issues related to the pybrickdev Python package topic: flashing firmware Issues related to fhe firmware flashing process

Comments

@laurensvalk
Copy link
Member

Describe the bug

 pybricksdev flash ev3/build/firmware.zip

only seems to work in some environments but not in others.

To reproduce

The actual flashing code seems irrelevant. Just testing on a local REPL will do.

In my pybricksdev development folder I can do:

(.venv) laurens@laurens-ubuntu:~/git-pybricks/pybricksdev$ python
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hid
>>> dev = hid.device()
>>> dev.open(1684, 6)
>>> dev.close()

Anywhere else on the same system with the same privileges I get:

pybricks-micropython-py3.10laurens@laurens-ubuntu:~/git-pybricks/pybricks-micropython$ python
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hid
>>> dev = hid.device()
>>> dev.open(1684, 6)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "hidraw.pyx", line 143, in hid.device.open
OSError: open failed
>>> 

And this is after bumping the pybricksdev dependency there.

I can't think of any differences between these environments. Since this is the same system, the udev rules seem fine.

Expected behavior
Work the same everywhere on the same system.

@laurensvalk laurensvalk added bug Something isn't working topic: flashing firmware Issues related to fhe firmware flashing process software: pybricksdev Issues related to the pybrickdev Python package labels Nov 4, 2024
@dlech
Copy link
Member

dlech commented Nov 4, 2024

Just because pybricksdev was updated, it doesn't mean that other dependencies were updated. The .pyx file extension tells me that it has something to do with Cython, like it didn't get compiled correctly on install.

EDIT: Actually, I guess the error isn't about the .pyx file. 😐

@laurensvalk
Copy link
Member Author

laurensvalk commented Nov 5, 2024

Thank you. The offending package seems to be hidapi at 0.14.0.post". My pybricksdev development folder was still on 0.14.0, which works. Forcing it to =0.14.0 seems to work around the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working software: pybricksdev Issues related to the pybrickdev Python package topic: flashing firmware Issues related to fhe firmware flashing process
Projects
None yet
Development

No branches or pull requests

2 participants