On Wed, 16 Dec 2009, Dmitry Torokhov wrote: > > > #define BTN_TRIGGER_HAPPY01 0x210 > > > ... > > > #define BTN_TRIGGER_HAPPY40 0x238 > > > > > > :-P Assuming 40 additional buttons should be crazy enough (but I know > > > this has been said before about other things). > > > > Dmitry, do you have any preference here yourself? > > "Trigger happy" sounds fine. OK, so how about something along the lines below? From: Jiri Kosina <jkosina@xxxxxxx> Subject: [PATCH] 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. Signed-off-by: Jiri Kosina <jkosina@xxxxxxx> --- drivers/hid/hid-input.c | 7 ++++++- include/linux/input.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletions(-) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 5862b0f..dad7aae 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 switch (field->application) { case HID_GD_MOUSE: case HID_GD_POINTER: code += 0x110; break; - case HID_GD_JOYSTICK: code += 0x120; break; + case HID_GD_JOYSTICK: + if (code <= 0xf) + code += BTN_JOYSTICK; + else + code += BTN_TRIGGER_HAPPY; + break; case HID_GD_GAMEPAD: code += 0x130; break; default: switch (field->physical) { diff --git a/include/linux/input.h b/include/linux/input.h index 7be8a65..7c54287 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -597,6 +597,48 @@ struct input_absinfo { #define KEY_CAMERA_FOCUS 0x210 +#define BTN_TRIGGER_HAPPY 0x220 +#define BTN_TRIGGER_HAPPY1 0x220 +#define BTN_TRIGGER_HAPPY2 0x221 +#define BTN_TRIGGER_HAPPY3 0x222 +#define BTN_TRIGGER_HAPPY4 0x223 +#define BTN_TRIGGER_HAPPY5 0x224 +#define BTN_TRIGGER_HAPPY6 0x225 +#define BTN_TRIGGER_HAPPY7 0x226 +#define BTN_TRIGGER_HAPPY8 0x227 +#define BTN_TRIGGER_HAPPY9 0x228 +#define BTN_TRIGGER_HAPPY10 0x229 +#define BTN_TRIGGER_HAPPY11 0x22a +#define BTN_TRIGGER_HAPPY12 0x22b +#define BTN_TRIGGER_HAPPY13 0x22c +#define BTN_TRIGGER_HAPPY14 0x22d +#define BTN_TRIGGER_HAPPY15 0x22e +#define BTN_TRIGGER_HAPPY16 0x22f +#define BTN_TRIGGER_HAPPY17 0x230 +#define BTN_TRIGGER_HAPPY18 0x231 +#define BTN_TRIGGER_HAPPY19 0x232 +#define BTN_TRIGGER_HAPPY20 0x233 +#define BTN_TRIGGER_HAPPY21 0x234 +#define BTN_TRIGGER_HAPPY22 0x235 +#define BTN_TRIGGER_HAPPY23 0x236 +#define BTN_TRIGGER_HAPPY24 0x237 +#define BTN_TRIGGER_HAPPY25 0x238 +#define BTN_TRIGGER_HAPPY26 0x239 +#define BTN_TRIGGER_HAPPY27 0x23a +#define BTN_TRIGGER_HAPPY28 0x23b +#define BTN_TRIGGER_HAPPY29 0x23c +#define BTN_TRIGGER_HAPPY30 0x23d +#define BTN_TRIGGER_HAPPY31 0x23e +#define BTN_TRIGGER_HAPPY32 0x23f +#define BTN_TRIGGER_HAPPY33 0x240 +#define BTN_TRIGGER_HAPPY34 0x241 +#define BTN_TRIGGER_HAPPY35 0x242 +#define BTN_TRIGGER_HAPPY36 0x243 +#define BTN_TRIGGER_HAPPY37 0x244 +#define BTN_TRIGGER_HAPPY38 0x245 +#define BTN_TRIGGER_HAPPY39 0x246 +#define BTN_TRIGGER_HAPPY40 0x247 + /* We avoid low common keys in module aliases so they don't get huge. */ #define KEY_MIN_INTERESTING KEY_MUTE #define KEY_MAX 0x2ff -- 1.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html