From b0aa4822f59ac39e736f67e76b0a7742ca4c3da9 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Wed, 12 Mar 2014 12:56:51 -0700 Subject: 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: Ia113c8441557d4c858c1e5740a3e1c7e0e9fdcdd --- libs/input/EventHub.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libs/input/EventHub.cpp') diff --git a/libs/input/EventHub.cpp b/libs/input/EventHub.cpp index 0f1da51d5878..0bb1c4561ffc 100644 --- a/libs/input/EventHub.cpp +++ b/libs/input/EventHub.cpp @@ -1243,7 +1243,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); } -- cgit v1.2.3-59-g8ed1b