Make sure the joystick actually has relevant axes to avoid FPing on some weird keyboards

This commit is contained in:
Cameron Gutman 2018-03-20 19:47:33 -07:00
parent a170e1efd7
commit 8bac873e67

View File

@ -161,7 +161,9 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
continue;
}
if ((dev.getSources() & InputDevice.SOURCE_JOYSTICK) != 0) {
if ((dev.getSources() & InputDevice.SOURCE_JOYSTICK) != 0 &&
getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_X) != null &&
getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_Y) != null) {
LimeLog.info("Counting InputDevice: "+dev.getName());
mask |= 1 << count++;
}