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

Handle device open exceptions in hidapi and skip unsupported devices #2751

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

vulpes2
Copy link
Contributor

@vulpes2 vulpes2 commented Jan 2, 2025

If VID and PID are both zero, the device is highly unlikely to be HID++ capable. On an Apple Silicon Mac, there are a lot of internal HID class devices on bus ID 0x0, none of which are what we are looking for. In both cases we shouldn't even attempt to open the devices at all.

Not all HID class devices found on the system can be opened, open_path() will fail with an unhandled exception IOHIDDeviceGetReport failed: (0xE00002C7) (iokit/common) unsupported function. That has been fixed as well.

Update gitignore to include common junk files generated by macOS, and pipenv config which this project doesn't use.

@pfps
Copy link
Collaborator

pfps commented Jan 2, 2025

@MattHag You'll have to check this PR out.

lib/hidapi/hidapi_impl.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@MattHag MattHag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change speeds up the start and detection of devices on macOS

@vulpes2
Copy link
Contributor Author

vulpes2 commented Jan 2, 2025

I'm pretty sure the failed CI checks are unrelated to my changes

lib/hidapi/hidapi_impl.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@MattHag MattHag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looks fine, the pipeline is broken.

Copy link
Collaborator

@MattHag MattHag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@pfps pfps merged commit 41e6526 into pwr-Solaar:master Jan 2, 2025
5 checks passed
@vulpes2 vulpes2 deleted the hidapi-fix branch January 3, 2025 11:23
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

Successfully merging this pull request may close these issues.

3 participants