Controllers must have buttons and a movement mechanism.
Some devices have joystick axes or DPad keys, but no gamepad buttons (or vice versa). We shouldn't count these as gamepads since games can't really be expected to work with this setup in the general case. Instead, require that a device has a movement mechanism (joystick axes or DPad buttons), as well as at least one gamepad button before considering it a controller. Bug: 13432364 Change-Id: I64372e69d29c775094e2b1faa89714da8c29e2be
This commit is contained in:
parent
71b16e81f9
commit
42f2c6a92c
@ -1291,7 +1291,8 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
|
|||||||
device->classes |= INPUT_DEVICE_CLASS_EXTERNAL;
|
device->classes |= INPUT_DEVICE_CLASS_EXTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->classes & (INPUT_DEVICE_CLASS_JOYSTICK | INPUT_DEVICE_CLASS_GAMEPAD)) {
|
if (device->classes & (INPUT_DEVICE_CLASS_JOYSTICK | INPUT_DEVICE_CLASS_DPAD)
|
||||||
|
&& device->classes & INPUT_DEVICE_CLASS_GAMEPAD) {
|
||||||
device->controllerNumber = getNextControllerNumberLocked(device);
|
device->controllerNumber = getNextControllerNumberLocked(device);
|
||||||
setLedForController(device);
|
setLedForController(device);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user