summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2013-04-08 18:01:29 -0700
committerMichael Wright <michaelwr@google.com>2013-04-08 20:05:32 -0700
commit74c8fb601ef75d8e12df5221489c41c125e3b846 (patch)
treea77590f8fe7e6a9be11a4d5e1b0915c2d1e2585a /services
parentb482a001f117d0da3599475a293da736fccd4d2c (diff)
downloadframeworks_base-74c8fb601ef75d8e12df5221489c41c125e3b846.zip
frameworks_base-74c8fb601ef75d8e12df5221489c41c125e3b846.tar.gz
frameworks_base-74c8fb601ef75d8e12df5221489c41c125e3b846.tar.bz2
Stop marking gamepads as keyboards
Change-Id: I0ba49aa3235b2e0a50405cf6d68632e268fe4183
Diffstat (limited to 'services')
-rw-r--r--services/input/EventHub.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
index 0773afb..a2443e7 100644
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -1162,11 +1162,6 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
mBuiltInKeyboardId = device->id;
}
- // 'Q' key support = cheap test of whether this is an alpha-capable kbd
- if (hasKeycodeLocked(device, AKEYCODE_Q)) {
- device->classes |= INPUT_DEVICE_CLASS_ALPHAKEY;
- }
-
// See if this device has a DPAD.
if (hasKeycodeLocked(device, AKEYCODE_DPAD_UP) &&
hasKeycodeLocked(device, AKEYCODE_DPAD_DOWN) &&
@@ -1184,6 +1179,14 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
}
}
+ // 'Q' key support = cheap test of whether this is an alpha-capable kbd. Many gamepads will
+ // report a broader set of HID usages than they need, however, so we only want to mark this
+ // device as a keyboard if it is not a gamepad.
+ if (hasKeycodeLocked(device, AKEYCODE_Q) &&
+ !(device->classes & INPUT_DEVICE_CLASS_GAMEPAD)) {
+ device->classes |= INPUT_DEVICE_CLASS_ALPHAKEY;
+ }
+
// Disable kernel key repeat since we handle it ourselves
unsigned int repeatRate[] = {0,0};
if (ioctl(fd, EVIOCSREP, repeatRate)) {