MCPcopy Create free account
hub / github.com/kiibohd/controller / init_hid_manager

Function init_hid_manager

LoadFile/teensy_loader_cli.c:412–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412void init_hid_manager(void)
413{
414 CFMutableDictionaryRef dict;
415 IOReturn ret;
416
417 if (hid_manager) return;
418 hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
419 if (hid_manager == NULL || CFGetTypeID(hid_manager) != IOHIDManagerGetTypeID()) {
420 if (hid_manager) CFRelease(hid_manager);
421 printf_verbose("no HID Manager - maybe this is a pre-Leopard (10.5) system?\n");
422 return;
423 }
424 dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
425 &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
426 if (!dict) return;
427 IOHIDManagerSetDeviceMatching(hid_manager, dict);
428 CFRelease(dict);
429 IOHIDManagerScheduleWithRunLoop(hid_manager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
430 IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, attach_callback, NULL);
431 IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, detach_callback, NULL);
432 ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
433 if (ret != kIOReturnSuccess) {
434 IOHIDManagerUnscheduleFromRunLoop(hid_manager,
435 CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
436 CFRelease(hid_manager);
437 printf_verbose("Error opening HID Manager");
438 }
439}
440
441static void do_run_loop(void)
442{

Callers 1

open_usb_deviceFunction · 0.85

Calls 1

printf_verboseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…