From fef170af85e4f7727c4145f2c2ad4b2d169c9a1b Mon Sep 17 00:00:00 2001 From: David Lawrie Date: Mon, 11 Jul 2016 04:06:00 -0700 Subject: [PATCH] dinput: Print location ID in debugstr_device on the Mac. Signed-off-by: David Lawrie Signed-off-by: Ken Thomases Signed-off-by: Alexandre Julliard --- dlls/dinput/joystick_osx.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index c9c30fdef03..21d8d5121ef 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -175,6 +175,30 @@ static HRESULT osx_to_win32_hresult(HRESULT in) return in; } +static long get_device_property_long(IOHIDDeviceRef device, CFStringRef key) +{ + CFTypeRef ref; + long result = 0; + + if (device) + { + assert(IOHIDDeviceGetTypeID() == CFGetTypeID(device)); + + ref = IOHIDDeviceGetProperty(device, key); + + if (ref && CFNumberGetTypeID() == CFGetTypeID(ref)) + CFNumberGetValue((CFNumberRef)ref, kCFNumberLongType, &result); + } + + return result; +} + +static long get_device_location_ID(IOHIDDeviceRef device) +{ + return get_device_property_long(device, CFSTR(kIOHIDLocationIDKey)); +} + + static void CFSetApplierFunctionCopyToCFArray(const void *value, void *context) { CFArrayAppendValue( ( CFMutableArrayRef ) context, value ); @@ -212,8 +236,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))), + get_device_location_ID(device)); } static const char* debugstr_element(IOHIDElementRef element) -- 2.11.4.GIT