This commit is contained in:
Camilla Löwy 2017-07-04 17:22:29 +02:00
parent 6634c47e57
commit ea6c50d9e2

View File

@ -196,39 +196,31 @@ static void matchCallback(void* context,
} }
CFMutableArrayRef target = NULL; CFMutableArrayRef target = NULL;
const uint32_t usage = IOHIDElementGetUsage(native); const uint32_t usage = IOHIDElementGetUsage(native);
const uint32_t page = IOHIDElementGetUsagePage(native);
switch (IOHIDElementGetUsagePage(native)) if (page == kHIDPage_GenericDesktop)
{ {
case kHIDPage_GenericDesktop: switch (usage)
{ {
switch (usage) case kHIDUsage_GD_X:
{ case kHIDUsage_GD_Y:
case kHIDUsage_GD_X: case kHIDUsage_GD_Z:
case kHIDUsage_GD_Y: case kHIDUsage_GD_Rx:
case kHIDUsage_GD_Z: case kHIDUsage_GD_Ry:
case kHIDUsage_GD_Rx: case kHIDUsage_GD_Rz:
case kHIDUsage_GD_Ry: case kHIDUsage_GD_Slider:
case kHIDUsage_GD_Rz: case kHIDUsage_GD_Dial:
case kHIDUsage_GD_Slider: case kHIDUsage_GD_Wheel:
case kHIDUsage_GD_Dial: target = axes;
case kHIDUsage_GD_Wheel: break;
target = axes; case kHIDUsage_GD_Hatswitch:
break; target = hats;
case kHIDUsage_GD_Hatswitch: break;
target = hats;
break;
}
break;
} }
case kHIDPage_Button:
target = buttons;
break;
default:
break;
} }
else if (page == kHIDPage_Button)
target = buttons;
if (target) if (target)
{ {