summaryrefslogtreecommitdiffstats
path: root/services/input/EventHub.cpp
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2013-04-10 21:14:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-10 21:14:27 +0000
commitf7104136927f45e152cec3583463b8ef1570df7b (patch)
tree9381f8828a66c3d7a7c854d23619abf0135eb8c2 /services/input/EventHub.cpp
parent5180ed141db0f1acced4f19f37391572bc18280b (diff)
parent74c8fb601ef75d8e12df5221489c41c125e3b846 (diff)
downloadframeworks_base-f7104136927f45e152cec3583463b8ef1570df7b.zip
frameworks_base-f7104136927f45e152cec3583463b8ef1570df7b.tar.gz
frameworks_base-f7104136927f45e152cec3583463b8ef1570df7b.tar.bz2
Merge "Stop marking gamepads as keyboards" into jb-mr2-dev
Diffstat (limited to 'services/input/EventHub.cpp')
-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 f4e1cec..376de96 100644
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -1188,11 +1188,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) &&
@@ -1210,6 +1205,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)) {