-
Notifications
You must be signed in to change notification settings - Fork 900
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
Option to open hid device with exclusive access #302
Comments
This actually varies by OS right now. On OS X hidapi does open the device exclusively (which is the subject of a different pull request.) I'd love to see this become an option. |
I'm resuming this thread because I think I've "done my homework" but I've not found a definitive answer to my doubts. TL;DR question: is it possible, in any way, to get exclusive acces to a HID device under Windows 10, using hidapi? By exclusive access I mean that only my hidapi based application should be able to receive inputs from the device. Full description below. What I have:
In general a pedal is a HID device ("Less common HIDs: Driving simulator devices and flight simulator devices have HIDs such as gear sticks, steering wheels and pedals"). I've tried both the latest official release 0.7.0 and the latest commit in master at the moment. For my problem, the main difference is in the function I've found the followind threads about this change over time:
However, I don't understand why it couldn't keep at least trying to open it in exclusive mode instead of open the device directly in shared mode. For my particular situation, I've verified that with the 0.7.0 version the device is successfully opened in exclusive mode, but sadly this does not prevent other running applications to receive inputs from the device. Hence, I'm still searching an answer to my original question stated in bold at the beginning ot this post. Thank you very much. |
Update: in my particular case (class 0 device with two class 3 (HID) interfaces), it looks like it is possible to get exclusive access by changing the drivers of both interfaces to WinUSB with Zadig and using libusb, as explained in the issue linked above. Note: after changing to WinUSB the drivers, hidapi does not see the device anymore (weel, I guess it is the expected behaviour). |
When hidapi opens a device it does so with shared access. This means another process could also send and receive commands from the hid device at the same time. Would it be possible to add an exclusive access mode? I think this should be possible if the FILE_SHARE_READ|FILE_SHARE_WRITE attributes are removed from the call to CreateFile.
The text was updated successfully, but these errors were encountered: