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:
Ludovic Rousseau
2011-02-24 10:08:06 +01:00
committed by Alan Ott
parent f74e0c64e8
commit 54d32f6aa3
+2 -2
View File
@@ -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. */