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

hid.HIDException: unable to open device #36

Open
tailgrabik opened this issue Apr 22, 2020 · 2 comments
Open

hid.HIDException: unable to open device #36

tailgrabik opened this issue Apr 22, 2020 · 2 comments

Comments

@tailgrabik
Copy link

tailgrabik commented Apr 22, 2020

I'll use python 3.8.
I'm using MacOS 10.15 and as the iohidmanager backend
It works like this.

>>> import hid
>>> hidraw = hid.Device(0x2341, 0x8036)
>>> hidraw.close()

However, if you just pull usb and call hidraw = hid.Device(0x2341, 0x8036) again, an error will appear:

>>> hidraw = hid.Device(0x2341, 0x8036).
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>.
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/hid/__init__.py", line 130, in __init__.
    raise HIDException('unable to open device')
hid.HIDException: unable to open device

Once the python is restarted, it's back to normal.

@apmorton
Copy link
Owner

This is probably better posed as a question to the upstream maintainers of hidapi, since all this exception indicates is that hid_open is returning 0

When you say you are pulling the USB, do you mean after calling hidraw.close?

https://github.com/libusb/hidapi

@tailgrabik
Copy link
Author

When you say you are pulling the USB, do you mean after calling hidraw.close?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants