@@ -314,64 +314,6 @@ static wchar_t *dup_wcs(const wchar_t *s)
314
314
return ret ;
315
315
}
316
316
317
- /* hidapi_IOHIDDeviceGetService()
318
- *
319
- * Return the io_service_t corresponding to a given IOHIDDeviceRef, either by:
320
- * - on OS X 10.6 and above, calling IOHIDDeviceGetService()
321
- * - on OS X 10.5, extract it from the IOHIDDevice struct
322
- */
323
- static io_service_t hidapi_IOHIDDeviceGetService (IOHIDDeviceRef device )
324
- {
325
- static void * iokit_framework = NULL ;
326
- typedef io_service_t (* dynamic_IOHIDDeviceGetService_t )(IOHIDDeviceRef device );
327
- static dynamic_IOHIDDeviceGetService_t dynamic_IOHIDDeviceGetService = NULL ;
328
-
329
- /* Use dlopen()/dlsym() to get a pointer to IOHIDDeviceGetService() if it exists.
330
- * If any of these steps fail, dynamic_IOHIDDeviceGetService will be left NULL
331
- * and the fallback method will be used.
332
- */
333
- if (iokit_framework == NULL ) {
334
- iokit_framework = dlopen ("/System/Library/Frameworks/IOKit.framework/IOKit" , RTLD_LAZY );
335
-
336
- if (iokit_framework != NULL )
337
- dynamic_IOHIDDeviceGetService = (dynamic_IOHIDDeviceGetService_t ) dlsym (iokit_framework , "IOHIDDeviceGetService" );
338
- }
339
-
340
- if (dynamic_IOHIDDeviceGetService != NULL ) {
341
- /* Running on OS X 10.6 and above: IOHIDDeviceGetService() exists */
342
- return dynamic_IOHIDDeviceGetService (device );
343
- }
344
- else
345
- {
346
- /* Running on OS X 10.5: IOHIDDeviceGetService() doesn't exist.
347
- *
348
- * Be naughty and pull the service out of the IOHIDDevice.
349
- * IOHIDDevice is an opaque struct not exposed to applications, but its
350
- * layout is stable through all available versions of OS X.
351
- * Tested and working on OS X 10.5.8 i386, x86_64, and ppc.
352
- */
353
- struct IOHIDDevice_internal {
354
- /* The first field of the IOHIDDevice struct is a
355
- * CFRuntimeBase (which is a private CF struct).
356
- *
357
- * a, b, and c are the 3 fields that make up a CFRuntimeBase.
358
- * See http://opensource.apple.com/source/CF/CF-476.18/CFRuntime.h
359
- *
360
- * The second field of the IOHIDDevice is the io_service_t we're looking for.
361
- */
362
- uintptr_t a ;
363
- uint8_t b [4 ];
364
- #if __LP64__
365
- uint32_t c ;
366
- #endif
367
- io_service_t service ;
368
- };
369
- struct IOHIDDevice_internal * tmp = (struct IOHIDDevice_internal * ) device ;
370
-
371
- return tmp -> service ;
372
- }
373
- }
374
-
375
317
/* Initialize the IOHIDManager. Return 0 for success and -1 for failure. */
376
318
static int init_hid_manager (void )
377
319
{
@@ -460,7 +402,7 @@ static struct hid_device_info *create_device_info_with_usage(IOHIDDeviceRef dev,
460
402
cur_dev -> next = NULL ;
461
403
462
404
/* Fill in the path (IOService plane) */
463
- iokit_dev = hidapi_IOHIDDeviceGetService (dev );
405
+ iokit_dev = IOHIDDeviceGetService (dev );
464
406
res = IORegistryEntryGetPath (iokit_dev , kIOServicePlane , path );
465
407
if (res == KERN_SUCCESS )
466
408
cur_dev -> path = strdup (path );
0 commit comments