@@ -288,64 +288,6 @@ static wchar_t *dup_wcs(const wchar_t *s)
288
288
return ret ;
289
289
}
290
290
291
- /* hidapi_IOHIDDeviceGetService()
292
- *
293
- * Return the io_service_t corresponding to a given IOHIDDeviceRef, either by:
294
- * - on OS X 10.6 and above, calling IOHIDDeviceGetService()
295
- * - on OS X 10.5, extract it from the IOHIDDevice struct
296
- */
297
- static io_service_t hidapi_IOHIDDeviceGetService (IOHIDDeviceRef device )
298
- {
299
- static void * iokit_framework = NULL ;
300
- typedef io_service_t (* dynamic_IOHIDDeviceGetService_t )(IOHIDDeviceRef device );
301
- static dynamic_IOHIDDeviceGetService_t dynamic_IOHIDDeviceGetService = NULL ;
302
-
303
- /* Use dlopen()/dlsym() to get a pointer to IOHIDDeviceGetService() if it exists.
304
- * If any of these steps fail, dynamic_IOHIDDeviceGetService will be left NULL
305
- * and the fallback method will be used.
306
- */
307
- if (iokit_framework == NULL ) {
308
- iokit_framework = dlopen ("/System/Library/IOKit.framework/IOKit" , RTLD_LAZY );
309
-
310
- if (iokit_framework != NULL )
311
- dynamic_IOHIDDeviceGetService = (dynamic_IOHIDDeviceGetService_t ) dlsym (iokit_framework , "IOHIDDeviceGetService" );
312
- }
313
-
314
- if (dynamic_IOHIDDeviceGetService != NULL ) {
315
- /* Running on OS X 10.6 and above: IOHIDDeviceGetService() exists */
316
- return dynamic_IOHIDDeviceGetService (device );
317
- }
318
- else
319
- {
320
- /* Running on OS X 10.5: IOHIDDeviceGetService() doesn't exist.
321
- *
322
- * Be naughty and pull the service out of the IOHIDDevice.
323
- * IOHIDDevice is an opaque struct not exposed to applications, but its
324
- * layout is stable through all available versions of OS X.
325
- * Tested and working on OS X 10.5.8 i386, x86_64, and ppc.
326
- */
327
- struct IOHIDDevice_internal {
328
- /* The first field of the IOHIDDevice struct is a
329
- * CFRuntimeBase (which is a private CF struct).
330
- *
331
- * a, b, and c are the 3 fields that make up a CFRuntimeBase.
332
- * See http://opensource.apple.com/source/CF/CF-476.18/CFRuntime.h
333
- *
334
- * The second field of the IOHIDDevice is the io_service_t we're looking for.
335
- */
336
- uintptr_t a ;
337
- uint8_t b [4 ];
338
- #if __LP64__
339
- uint32_t c ;
340
- #endif
341
- io_service_t service ;
342
- };
343
- struct IOHIDDevice_internal * tmp = (struct IOHIDDevice_internal * ) device ;
344
-
345
- return tmp -> service ;
346
- }
347
- }
348
-
349
291
/* Initialize the IOHIDManager. Return 0 for success and -1 for failure. */
350
292
static int init_hid_manager (void )
351
293
{
@@ -459,7 +401,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
459
401
cur_dev -> next = NULL ;
460
402
461
403
/* Fill in the path (IOService plane) */
462
- iokit_dev = hidapi_IOHIDDeviceGetService (dev );
404
+ iokit_dev = IOHIDDeviceGetService (dev );
463
405
res = IORegistryEntryGetPath (iokit_dev , kIOServicePlane , path );
464
406
if (res == KERN_SUCCESS )
465
407
cur_dev -> path = strdup (path );
0 commit comments