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.
This commit is contained in:
parent
131c97e87c
commit
200fb26148
|
@ -39,7 +39,10 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Axes
|
// Axes
|
||||||
NSDictionary* axisDict = @{ @kIOHIDElementTypeKey : @(kIOHIDElementTypeInput_Misc) };
|
NSDictionary* axisDict = @{
|
||||||
|
@kIOHIDElementTypeKey : @(kIOHIDElementTypeInput_Misc),
|
||||||
|
@kIOHIDElementUsagePageKey : @(kHIDPage_GenericDesktop)
|
||||||
|
};
|
||||||
|
|
||||||
CFArrayRef axes =
|
CFArrayRef axes =
|
||||||
IOHIDDeviceCopyMatchingElements(m_device, (CFDictionaryRef)axisDict, kIOHIDOptionsTypeNone);
|
IOHIDDeviceCopyMatchingElements(m_device, (CFDictionaryRef)axisDict, kIOHIDOptionsTypeNone);
|
||||||
|
|
Loading…
Reference in New Issue