mirror of
https://github.com/RPCS3/hidapi.git
synced 2026-07-19 13:34:37 -04:00
mac: Use exclusivce device access
Use kIOHIDOptionsTypeSeizeDevice instead of kIOHIDOptionsTypeNone to avoid interferences with other applications trying to use the HID device at the same time.
This commit is contained in:
committed by
Alan Ott
parent
f74e0c64e8
commit
54d32f6aa3
@@ -693,7 +693,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
|
||||
len = make_path(os_dev, cbuf, sizeof(cbuf));
|
||||
if (!strcmp(cbuf, path)) {
|
||||
// Matched Paths. Open this Device.
|
||||
IOReturn ret = IOHIDDeviceOpen(os_dev, kIOHIDOptionsTypeNone);
|
||||
IOReturn ret = IOHIDDeviceOpen(os_dev, kIOHIDOptionsTypeSeizeDevice);
|
||||
if (ret == kIOReturnSuccess) {
|
||||
char str[32];
|
||||
|
||||
@@ -982,7 +982,7 @@ void HID_API_EXPORT hid_close(hid_device *dev)
|
||||
been unplugged. If it's been unplugged, then calling
|
||||
IOHIDDeviceClose() will crash. */
|
||||
if (!dev->disconnected) {
|
||||
IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone);
|
||||
IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeSeizeDevice);
|
||||
}
|
||||
|
||||
/* Clear out the queue of received reports. */
|
||||
|
||||
Reference in New Issue
Block a user