From 75073d0a8478441cc97a6efa10b566c5fb1dac81 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 17 Apr 2020 20:57:17 +0100 Subject: New upstream version 1.4.0 --- src/hid_osx.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/hid_osx.c') diff --git a/src/hid_osx.c b/src/hid_osx.c index b705b43..5c40747 100644 --- a/src/hid_osx.c +++ b/src/hid_osx.c @@ -197,7 +197,7 @@ copy_info(fido_dev_info_t *di, IOHIDDeviceRef dev) } int -fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) +fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) { IOHIDManagerRef manager = NULL; CFSetRef devset = NULL; @@ -240,6 +240,12 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) for (CFIndex i = 0; i < devcnt; i++) { if (copy_info(&devlist[*olen], devs[i]) == 0) { + devlist[*olen].io = (fido_dev_io_t) { + fido_hid_open, + fido_hid_close, + fido_hid_read, + fido_hid_write, + }; if (++(*olen) == ilen) break; } @@ -378,15 +384,18 @@ fido_hid_read(void *handle, unsigned char *buf, size_t len, int ms) IOHIDDeviceScheduleWithRunLoop(dev->ref, CFRunLoopGetCurrent(), dev->loop_id); - do - r = CFRunLoopRunInMode(dev->loop_id, 0.003, true); - while (r != kCFRunLoopRunHandledSource); + r = CFRunLoopRunInMode(dev->loop_id, 0.3, true); IOHIDDeviceRegisterInputReportCallback(dev->ref, buf, len, NULL, NULL); IOHIDDeviceRegisterRemovalCallback(dev->ref, NULL, NULL); IOHIDDeviceUnscheduleFromRunLoop(dev->ref, CFRunLoopGetCurrent(), dev->loop_id); + if (r != kCFRunLoopRunHandledSource) { + fido_log_debug("%s: CFRunLoopRunInMode=%d", __func__, (int)r); + return (-1); + } + return (REPORT_LEN - 1); } -- cgit v1.2.3