From 200fb26148630d59e77f7a1574617b496df082a7 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 1 Aug 2017 01:58:30 +0200 Subject: [PATCH] Fix axis not working with Switch Pro controller on macOS Each axis would appear as multiple elements with 0 min/max. Filter the list of elements using the correct usage page like done for buttons. --- .../Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm index e8595153f2..9bbd953a4b 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm @@ -39,7 +39,10 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name) } // Axes - NSDictionary* axisDict = @{ @kIOHIDElementTypeKey : @(kIOHIDElementTypeInput_Misc) }; + NSDictionary* axisDict = @{ + @kIOHIDElementTypeKey : @(kIOHIDElementTypeInput_Misc), + @kIOHIDElementUsagePageKey : @(kHIDPage_GenericDesktop) + }; CFArrayRef axes = IOHIDDeviceCopyMatchingElements(m_device, (CFDictionaryRef)axisDict, kIOHIDOptionsTypeNone);