From: David Lawrie Subject: [v1 1/2] dinput/joystick_osx.c: debugstr_device prints location ID Message-Id: <1466818397-52671-1-git-send-email-david.dljunk@gmail.com> Date: Fri, 24 Jun 2016 18:33:14 -0700 Tested on OS X 10.10.5. Signed-off-by: David Lawrie --- dlls/dinput/joystick_osx.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index c9c30fd..fea72c1 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -175,6 +175,34 @@ static HRESULT osx_to_win32_hresult(HRESULT in) return in; } +static Boolean IOHIDDevice_GetLongProperty(IOHIDDeviceRef inIOHIDDeviceRef, CFStringRef inKey, long * outValue) +{ + Boolean result = FALSE; + CFTypeRef tCFTypeRef; + + if (inIOHIDDeviceRef) { + assert(IOHIDDeviceGetTypeID() == CFGetTypeID(inIOHIDDeviceRef)); + + tCFTypeRef = IOHIDDeviceGetProperty(inIOHIDDeviceRef, inKey); + + if ( tCFTypeRef ) { + /* if this is a number */ + if (CFNumberGetTypeID() == CFGetTypeID(tCFTypeRef)) { + /* get it's value */ + result = CFNumberGetValue((CFNumberRef)tCFTypeRef, kCFNumberSInt32Type, outValue); + } + } + } + return result; +} + +long IOHIDDevice_GetLocationID(IOHIDDeviceRef inIOHIDDeviceRef) +{ + long result = 0; + (void)IOHIDDevice_GetLongProperty(inIOHIDDeviceRef, CFSTR(kIOHIDLocationIDKey), &result); + return result; +} + static void CFSetApplierFunctionCopyToCFArray(const void *value, void *context) { CFArrayAppendValue( ( CFMutableArrayRef ) context, value ); @@ -212,8 +240,9 @@ static const char* debugstr_cf(CFTypeRef t) static const char* debugstr_device(IOHIDDeviceRef device) { - return wine_dbg_sprintf("", device, - debugstr_cf(IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey)))); + return wine_dbg_sprintf("", device, + debugstr_cf(IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey))), + IOHIDDevice_GetLocationID(device)); } static const char* debugstr_element(IOHIDElementRef element) -- 1.7.12.4 (Apple Git-37)