From 54d32f6aa3db25f4293c22119cba85192b3fe068 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Thu, 24 Feb 2011 10:08:06 +0100 Subject: [PATCH] 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. --- mac/hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mac/hid.c b/mac/hid.c index 7aa7c36..8cac198 100644 --- a/mac/hid.c +++ b/mac/hid.c @@ -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. */