Number "unknown" axes in OSX rather than call them all "unk".

This commit is contained in:
Jordan Woyak 2013-02-05 13:51:08 -06:00
parent 937d9e9007
commit f506783c37

View file

@ -121,7 +121,9 @@ Joystick::Axis::Axis(IOHIDElementRef element, IOHIDDeviceRef device, direction d
// Need to parse the element a bit first // Need to parse the element a bit first
std::string description("unk"); std::string description("unk");
switch (IOHIDElementGetUsage(m_element)) { int const usage = IOHIDElementGetUsage(m_element);
switch (usage)
{
case kHIDUsage_GD_X: case kHIDUsage_GD_X:
description = "X"; description = "X";
break; break;
@ -146,6 +148,13 @@ Joystick::Axis::Axis(IOHIDElementRef element, IOHIDDeviceRef device, direction d
case kHIDUsage_Csmr_ACPan: case kHIDUsage_Csmr_ACPan:
description = "Pan"; description = "Pan";
break; break;
default:
{
std::ostringstream s;
s << usage;
description = s.str();
break;
}
} }
m_name = std::string("Axis ") + description; m_name = std::string("Axis ") + description;