diff options
Diffstat (limited to 'drivers/input/joystick/xpad.c')
-rw-r--r-- | drivers/input/joystick/xpad.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 89524954ab46..b48f7051bf30 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -144,12 +144,19 @@ static const struct xpad_device { | |||
144 | { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN, XTYPE_UNKNOWN } | 144 | { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN, XTYPE_UNKNOWN } |
145 | }; | 145 | }; |
146 | 146 | ||
147 | static const signed short xpad_btn[] = { | 147 | /* buttons shared with xbox and xbox360 */ |
148 | BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, /* "analog" buttons */ | 148 | static const signed short xpad_common_btn[] = { |
149 | BTN_A, BTN_B, BTN_X, BTN_Y, /* "analog" buttons */ | ||
149 | BTN_START, BTN_BACK, BTN_THUMBL, BTN_THUMBR, /* start/back/sticks */ | 150 | BTN_START, BTN_BACK, BTN_THUMBL, BTN_THUMBR, /* start/back/sticks */ |
150 | -1 /* terminating entry */ | 151 | -1 /* terminating entry */ |
151 | }; | 152 | }; |
152 | 153 | ||
154 | /* original xbox controllers only */ | ||
155 | static const signed short xpad_btn[] = { | ||
156 | BTN_C, BTN_Z, /* "analog" buttons */ | ||
157 | -1 /* terminating entry */ | ||
158 | }; | ||
159 | |||
153 | /* only used if MAP_DPAD_TO_BUTTONS */ | 160 | /* only used if MAP_DPAD_TO_BUTTONS */ |
154 | static const signed short xpad_btn_pad[] = { | 161 | static const signed short xpad_btn_pad[] = { |
155 | BTN_LEFT, BTN_RIGHT, /* d-pad left, right */ | 162 | BTN_LEFT, BTN_RIGHT, /* d-pad left, right */ |
@@ -679,11 +686,14 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
679 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 686 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
680 | 687 | ||
681 | /* set up buttons */ | 688 | /* set up buttons */ |
682 | for (i = 0; xpad_btn[i] >= 0; i++) | 689 | for (i = 0; xpad_common_btn[i] >= 0; i++) |
683 | set_bit(xpad_btn[i], input_dev->keybit); | 690 | set_bit(xpad_common_btn[i], input_dev->keybit); |
684 | if (xpad->xtype == XTYPE_XBOX360) | 691 | if (xpad->xtype == XTYPE_XBOX360) |
685 | for (i = 0; xpad360_btn[i] >= 0; i++) | 692 | for (i = 0; xpad360_btn[i] >= 0; i++) |
686 | set_bit(xpad360_btn[i], input_dev->keybit); | 693 | set_bit(xpad360_btn[i], input_dev->keybit); |
694 | else | ||
695 | for (i = 0; xpad_btn[i] >= 0; i++) | ||
696 | set_bit(xpad_btn[i], input_dev->keybit); | ||
687 | if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) | 697 | if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) |
688 | for (i = 0; xpad_btn_pad[i] >= 0; i++) | 698 | for (i = 0; xpad_btn_pad[i] >= 0; i++) |
689 | set_bit(xpad_btn_pad[i], input_dev->keybit); | 699 | set_bit(xpad_btn_pad[i], input_dev->keybit); |