mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
OSX USB: Close more handles properly
This commit is contained in:
parent
3f11c398db
commit
cf1c986550
@ -436,8 +436,12 @@ static void free_all_hid(void)
|
||||
static void hid_close(hid_t *hid)
|
||||
{
|
||||
if (!hid || !hid->open || !hid->ref) return;
|
||||
IOHIDManagerRef hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, NULL, NULL);
|
||||
IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, NULL, NULL);
|
||||
IOHIDDeviceUnscheduleFromRunLoop(hid->ref, CFRunLoopGetCurrent( ), kCFRunLoopDefaultMode);
|
||||
IOHIDDeviceClose(hid->ref, kIOHIDOptionsTypeNone);
|
||||
IOHIDManagerClose(hid_manager, 0);
|
||||
hid->ref = NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user