Merge pull request #6224 from hackbar/input-fix-moga

Android: Handle missing mappings for the Moga Pro 2 HID controller.
This commit is contained in:
Markus Wick 2017-12-19 09:55:57 +01:00 committed by GitHub
commit f547703660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -45,6 +45,14 @@ public class ControllerMappingHelper
return 0.0f;
}
}
else if (isMogaPro2Hid(inputDevice))
{
// This controller has a broken axis that reports a constant value. Ignore it.
if (axis == MotionEvent.AXIS_GENERIC_1)
{
return 0.0f;
}
}
return value;
}
@ -59,4 +67,10 @@ public class ControllerMappingHelper
// Microsoft Xbox One controller
return inputDevice.getVendorId() == 0x45e && inputDevice.getProductId() == 0x2e0;
}
private boolean isMogaPro2Hid(InputDevice inputDevice)
{
// Moga Pro 2 HID
return inputDevice.getVendorId() == 0x20d6 && inputDevice.getProductId() == 0x6271;
}
}