-
Notifications
You must be signed in to change notification settings - Fork 411
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
mac: Option to open device in non-exclusive mode #27
Comments
I think signal11/hidapi#335 refers to the same general issue, but on Windows or not? |
a.k.a #1 On Windows it seems it's not possible to open some devices in exclusive mode. On Mac both is possible, so no fallback is possible on the hidapi side. About Linux, I don't know :). |
hmm, yes, it is different on the other hand, we could add something like: |
I opened PR #148 to solve this |
So I give this problem some thinking, and here what I suggest:
Motivation:
We still have 2 options for
@z3ntu @libusb/hidapi thoughts? |
I think adding an api like We could add a flag Not sure if there are other "options" we could implement (or are already implemented somehow) If possible I wouldn't change the behavior of existing APIs (so I don't think
Sounds horrible, as an application developer I don't want to add extra ifdefs for platform support (which probably differs between different hidapi versions). That's why we have hidapi and don't ifdef support for all platforms manually. |
Yep, I like this way better too. (Hello from WINAPI world:
I'll try & give it additional thinking. On the plate right now:
|
Any movement on this? There are a lot of projects who have macOS support blocked by this. |
A suggestion from my side: Setting such option would change the behavior of |
From signal11/hidapi#335 it looks like Windows has the option of exclusive/non-exclusive modes too (I'm assuming opening R/W is "exclusive" vs R being "non-exclusive". bad assumption?) In libusb on Linux I recall you could "claim" the interface and that was the exclusive lock. And hidraw uses normal unix So, could we make |
On Windows, in read-only mode you cannot hid_write. It is also possible to open in write-only (no hid_read), or without access specifier at all. In such mode you can the device and get its properties/some descriptor info, but cannot really interact with it. And I believe it this no-mode allows to open a device, which is opened by someone else in read-write mode.
Without claiming the interface you cannot interact with it at all, so that's not it either.
Yes, which allows to open in read-only, write-only, or read-write. But doesn't allow opening a device without specifier at all, so not exactly the same semantics as on Windows. And I've never thought is is possible to open same HID device with hidraw by multiple clients. |
Recent updates on libusb under macOS for reference. |
I have a plan how to make it happen, just can't get my hands to it. |
Example: If you open a mouse currently (on macOS), the mouse input doesn't reach the OS, so you can't move the cursor with the mouse anymore while the device is opened in hidapi. That can be solved by not opening the device in exclusive mode, so z3ntu@fc9077c / signal11/hidapi#297
For my specific use case I have to look if it's possible to open a different usb device interface from the same device that doesn't block mouse input, but it seems that this feature is wanted by at least one other person too.
The text was updated successfully, but these errors were encountered: