From 42f2c6a92ca54ff77003ac174e0771351fbe537c Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Wed, 12 Mar 2014 10:33:03 -0700 Subject: [PATCH] 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 --- services/inputflinger/EventHub.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp index e2efd17f5..94fc0af12 100644 --- a/services/inputflinger/EventHub.cpp +++ b/services/inputflinger/EventHub.cpp @@ -1291,7 +1291,8 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { 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); setLedForController(device); }