diff options
author | Ingo Ruhnke <grumbel@gmail.com> | 2012-10-29 09:29:30 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-10-31 11:03:32 -0400 |
commit | f8e86d054686d9090549476ea2394aa04c614a93 (patch) | |
tree | 555d07a600ea98f6569ac0dfd6200c33183c697f /drivers/hid | |
parent | c10354d4a6c9256c3393feafcbd030cb392a9baf (diff) |
HID: fix incorrect handling of devices with high button count
Button names for USB gamepads are currently assigned incorrectly, as the evdev
code assigned to buttons is "BTN_GAMEPAD + code", which on devices with more
then 16 buttons bleeds over into button names reserved for graphic tablets
(BTN_TOOL_PEN, etc.). This causes problems further down the line as the device
are now no longer detected as joystick. This patch fixes that by assigning
buttons outside the range to BTN_TRIGGER_HAPPY (as is already the case for USB
joysticks).
Furthermore this patch corrects the assignment to BTN_TRIGGER_HAPPY, as
currently the first button over 16 is assigned to BTN_TRIGGER_HAPPY17 (i.e.
BTN_TRIGGER_HAPPY+0x10) not BTN_TRIGGER_HAPPY.
Signed-off-by: Ingo Ruhnke <grumbel@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-input.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index d917c0d53685..10248cf548fc 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -502,9 +502,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
502 | if (code <= 0xf) | 502 | if (code <= 0xf) |
503 | code += BTN_JOYSTICK; | 503 | code += BTN_JOYSTICK; |
504 | else | 504 | else |
505 | code += BTN_TRIGGER_HAPPY; | 505 | code += BTN_TRIGGER_HAPPY - 0x10; |
506 | break; | ||
507 | case HID_GD_GAMEPAD: | ||
508 | if (code <= 0xf) | ||
509 | code += BTN_GAMEPAD; | ||
510 | else | ||
511 | code += BTN_TRIGGER_HAPPY - 0x10; | ||
506 | break; | 512 | break; |
507 | case HID_GD_GAMEPAD: code += BTN_GAMEPAD; break; | ||
508 | default: | 513 | default: |
509 | switch (field->physical) { | 514 | switch (field->physical) { |
510 | case HID_GD_MOUSE: | 515 | case HID_GD_MOUSE: |