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

hidapi-libusb don't reattach kernel driver #305

Open
Milek7 opened this issue Dec 29, 2016 · 2 comments
Open

hidapi-libusb don't reattach kernel driver #305

Milek7 opened this issue Dec 29, 2016 · 2 comments

Comments

@Milek7
Copy link

Milek7 commented Dec 29, 2016

hidapi with libusb backend detach device kernel driver in hid_open, but don't reattach it in hid_close. It needs to either call libusb_attach_kernel_driver or use libusb_set_auto_detach_kernel_driver to make libusb automatically detach/attach driver in libusb_claim_interface/libusb_release_interface.

@signal11
Copy link
Owner

And what happens when the application crashes or otherwise exits uncleanly? There's no way to ensure that it's ever actually done.

HIDAPI is for custom devices. If you have a custom device that you made that you're making the software for, then the default kernel driver won't be of much help.

@seysn
Copy link

seysn commented Apr 9, 2018

Hello,

I encounter the same problem, my mouse and my keyboard are stuck when I try to use hid_open with libusb.
I think this is because, as said before, the device is not reattached to the kernel.
With this line in hid_close after libusb_release_interface I can regain control of my devices when running hidtest :

libusb_attach_kernel_driver(dev->device_handle, dev->interface);

Is it intended that you do not reattach the device to the kernel at any moment in the code ?
Also, since I don't want my devices to be stuck, is there a better way to reattach my device other than this line at the start of hid_close?

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

3 participants