summaryrefslogtreecommitdiff
path: root/src/hid_osx.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2020-04-17 20:57:34 +0100
committerColin Watson <cjwatson@debian.org>2020-04-18 09:48:21 +0100
commitdf7226c4b684fd229dc046388225c69ded877721 (patch)
treee69014e1ee868c4ec178b8a36baae7de31786beb /src/hid_osx.c
parentf794345c2d734f593da8ed7754e5dbb5809c688d (diff)
parent75073d0a8478441cc97a6efa10b566c5fb1dac81 (diff)
Update upstream source from tag 'upstream/1.4.0'
Update to upstream version '1.4.0' with Debian dir 64889867df57bd13ea0cb964223697d378d391ce
Diffstat (limited to 'src/hid_osx.c')
-rw-r--r--src/hid_osx.c17
1 files changed, 13 insertions, 4 deletions
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)
197} 197}
198 198
199int 199int
200fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) 200fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen)
201{ 201{
202 IOHIDManagerRef manager = NULL; 202 IOHIDManagerRef manager = NULL;
203 CFSetRef devset = NULL; 203 CFSetRef devset = NULL;
@@ -240,6 +240,12 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen)
240 240
241 for (CFIndex i = 0; i < devcnt; i++) { 241 for (CFIndex i = 0; i < devcnt; i++) {
242 if (copy_info(&devlist[*olen], devs[i]) == 0) { 242 if (copy_info(&devlist[*olen], devs[i]) == 0) {
243 devlist[*olen].io = (fido_dev_io_t) {
244 fido_hid_open,
245 fido_hid_close,
246 fido_hid_read,
247 fido_hid_write,
248 };
243 if (++(*olen) == ilen) 249 if (++(*olen) == ilen)
244 break; 250 break;
245 } 251 }
@@ -378,15 +384,18 @@ fido_hid_read(void *handle, unsigned char *buf, size_t len, int ms)
378 IOHIDDeviceScheduleWithRunLoop(dev->ref, CFRunLoopGetCurrent(), 384 IOHIDDeviceScheduleWithRunLoop(dev->ref, CFRunLoopGetCurrent(),
379 dev->loop_id); 385 dev->loop_id);
380 386
381 do 387 r = CFRunLoopRunInMode(dev->loop_id, 0.3, true);
382 r = CFRunLoopRunInMode(dev->loop_id, 0.003, true);
383 while (r != kCFRunLoopRunHandledSource);
384 388
385 IOHIDDeviceRegisterInputReportCallback(dev->ref, buf, len, NULL, NULL); 389 IOHIDDeviceRegisterInputReportCallback(dev->ref, buf, len, NULL, NULL);
386 IOHIDDeviceRegisterRemovalCallback(dev->ref, NULL, NULL); 390 IOHIDDeviceRegisterRemovalCallback(dev->ref, NULL, NULL);
387 IOHIDDeviceUnscheduleFromRunLoop(dev->ref, CFRunLoopGetCurrent(), 391 IOHIDDeviceUnscheduleFromRunLoop(dev->ref, CFRunLoopGetCurrent(),
388 dev->loop_id); 392 dev->loop_id);
389 393
394 if (r != kCFRunLoopRunHandledSource) {
395 fido_log_debug("%s: CFRunLoopRunInMode=%d", __func__, (int)r);
396 return (-1);
397 }
398
390 return (REPORT_LEN - 1); 399 return (REPORT_LEN - 1);
391} 400}
392 401