aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-01-04 06:20:56 -0500
committerJiri Kosina <jkosina@suse.cz>2010-01-04 06:20:56 -0500
commitcf2f765f1896064e34c6f0f2ef896ff058dd5c06 (patch)
tree5bb51af0bfcd5f72a740dee0c8b97ae358643d05
parent92688c0c3c1c9e2daf705d307e8fda1b5a180d26 (diff)
HID: handle joysticks with large number of buttons
Current HID code doesn't properly handle HID joysticks which have larger number of buttons than what fits into current range reserved for BTN_JOYSTICK. One such joystick reported to not work properly is Saitek X52 Pro Flight System. We can't extend the range to fit more buttons in, because of backwards compatibility reasons. Therefore this patch introduces a new BTN_TRIGGER_HAPPY range, and uses these to map the buttons which are over BTN_JOYSTICK limit. Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> [for the input.h part] Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-input.c7
-rw-r--r--include/linux/input.h42
2 files changed, 48 insertions, 1 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 5862b0f3b55d..dad7aae9c975 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -198,7 +198,12 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
198 switch (field->application) { 198 switch (field->application) {
199 case HID_GD_MOUSE: 199 case HID_GD_MOUSE:
200 case HID_GD_POINTER: code += 0x110; break; 200 case HID_GD_POINTER: code += 0x110; break;
201 case HID_GD_JOYSTICK: code += 0x120; break; 201 case HID_GD_JOYSTICK:
202 if (code <= 0xf)
203 code += BTN_JOYSTICK;
204 else
205 code += BTN_TRIGGER_HAPPY;
206 break;
202 case HID_GD_GAMEPAD: code += 0x130; break; 207 case HID_GD_GAMEPAD: code += 0x130; break;
203 default: 208 default:
204 switch (field->physical) { 209 switch (field->physical) {
diff --git a/include/linux/input.h b/include/linux/input.h
index 7be8a6537b57..97f98ca9b040 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -597,6 +597,48 @@ struct input_absinfo {
597 597
598#define KEY_CAMERA_FOCUS 0x210 598#define KEY_CAMERA_FOCUS 0x210
599 599
600#define BTN_TRIGGER_HAPPY 0x2c0
601#define BTN_TRIGGER_HAPPY1 0x2c0
602#define BTN_TRIGGER_HAPPY2 0x2c1
603#define BTN_TRIGGER_HAPPY3 0x2c2
604#define BTN_TRIGGER_HAPPY4 0x2c3
605#define BTN_TRIGGER_HAPPY5 0x2c4
606#define BTN_TRIGGER_HAPPY6 0x2c5
607#define BTN_TRIGGER_HAPPY7 0x2c6
608#define BTN_TRIGGER_HAPPY8 0x2c7
609#define BTN_TRIGGER_HAPPY9 0x2c8
610#define BTN_TRIGGER_HAPPY10 0x2c9
611#define BTN_TRIGGER_HAPPY11 0x2ca
612#define BTN_TRIGGER_HAPPY12 0x2cb
613#define BTN_TRIGGER_HAPPY13 0x2cc
614#define BTN_TRIGGER_HAPPY14 0x2cd
615#define BTN_TRIGGER_HAPPY15 0x2ce
616#define BTN_TRIGGER_HAPPY16 0x2cf
617#define BTN_TRIGGER_HAPPY17 0x2d0
618#define BTN_TRIGGER_HAPPY18 0x2d1
619#define BTN_TRIGGER_HAPPY19 0x2d2
620#define BTN_TRIGGER_HAPPY20 0x2d3
621#define BTN_TRIGGER_HAPPY21 0x2d4
622#define BTN_TRIGGER_HAPPY22 0x2d5
623#define BTN_TRIGGER_HAPPY23 0x2d6
624#define BTN_TRIGGER_HAPPY24 0x2d7
625#define BTN_TRIGGER_HAPPY25 0x2d8
626#define BTN_TRIGGER_HAPPY26 0x2d9
627#define BTN_TRIGGER_HAPPY27 0x2da
628#define BTN_TRIGGER_HAPPY28 0x2db
629#define BTN_TRIGGER_HAPPY29 0x2dc
630#define BTN_TRIGGER_HAPPY30 0x2dd
631#define BTN_TRIGGER_HAPPY31 0x2de
632#define BTN_TRIGGER_HAPPY32 0x2df
633#define BTN_TRIGGER_HAPPY33 0x2e0
634#define BTN_TRIGGER_HAPPY34 0x2e1
635#define BTN_TRIGGER_HAPPY35 0x2e2
636#define BTN_TRIGGER_HAPPY36 0x2e3
637#define BTN_TRIGGER_HAPPY37 0x2e4
638#define BTN_TRIGGER_HAPPY38 0x2e5
639#define BTN_TRIGGER_HAPPY39 0x2e6
640#define BTN_TRIGGER_HAPPY40 0x2e7
641
600/* We avoid low common keys in module aliases so they don't get huge. */ 642/* We avoid low common keys in module aliases so they don't get huge. */
601#define KEY_MIN_INTERESTING KEY_MUTE 643#define KEY_MIN_INTERESTING KEY_MUTE
602#define KEY_MAX 0x2ff 644#define KEY_MAX 0x2ff