Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid taking an exclusive lock on Litra devices on macOS (#93)
Currently, when a Litra handle device is opened with `open()`, on macOS we take an exclusive lock on the device, which stops it being managed by other applications. This isn't a problem if the device handle is quickly closed again (e.g. if the application exits), but it can be annoying if you have a long-running application that holds onto the device handle for a long time (e.g. `litra auto-toggle`). As an example, if you run `litra auto-toggle` and then try to turn the device on or off with `litra on` or `litra off` in another shell, it would fail with an error: > HID error occurred: hidapi error: hid_open_path: failed to open IOHIDDevice from mach entry: (0xE00002C5) (iokit/common) exclusive access and device already open This switches to taking a non-exclusive lock on macOS, affecting use of this code as a Rust library and our long-running `auto-toggle` command.
- Loading branch information