diff options
Diffstat (limited to 'drivers/input/joystick/xpad.c')
-rw-r--r-- | drivers/input/joystick/xpad.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 3aa2f3f3da5b..61c761156371 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -31,12 +31,14 @@ | |||
31 | * - the iForce driver drivers/char/joystick/iforce.c | 31 | * - the iForce driver drivers/char/joystick/iforce.c |
32 | * - the skeleton-driver drivers/usb/usb-skeleton.c | 32 | * - the skeleton-driver drivers/usb/usb-skeleton.c |
33 | * - Xbox 360 information http://www.free60.org/wiki/Gamepad | 33 | * - Xbox 360 information http://www.free60.org/wiki/Gamepad |
34 | * - Xbox One information https://github.com/quantus/xbox-one-controller-protocol | ||
34 | * | 35 | * |
35 | * Thanks to: | 36 | * Thanks to: |
36 | * - ITO Takayuki for providing essential xpad information on his website | 37 | * - ITO Takayuki for providing essential xpad information on his website |
37 | * - Vojtech Pavlik - iforce driver / input subsystem | 38 | * - Vojtech Pavlik - iforce driver / input subsystem |
38 | * - Greg Kroah-Hartman - usb-skeleton driver | 39 | * - Greg Kroah-Hartman - usb-skeleton driver |
39 | * - XBOX Linux project - extra USB id's | 40 | * - XBOX Linux project - extra USB id's |
41 | * - Pekka Pöyry (quantus) - Xbox One controller reverse engineering | ||
40 | * | 42 | * |
41 | * TODO: | 43 | * TODO: |
42 | * - fine tune axes (especially trigger axes) | 44 | * - fine tune axes (especially trigger axes) |
@@ -828,6 +830,23 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect | |||
828 | 830 | ||
829 | return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); | 831 | return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); |
830 | 832 | ||
833 | case XTYPE_XBOXONE: | ||
834 | xpad->odata[0] = 0x09; /* activate rumble */ | ||
835 | xpad->odata[1] = 0x08; | ||
836 | xpad->odata[2] = 0x00; | ||
837 | xpad->odata[3] = 0x08; /* continuous effect */ | ||
838 | xpad->odata[4] = 0x00; /* simple rumble mode */ | ||
839 | xpad->odata[5] = 0x03; /* L and R actuator only */ | ||
840 | xpad->odata[6] = 0x00; /* TODO: LT actuator */ | ||
841 | xpad->odata[7] = 0x00; /* TODO: RT actuator */ | ||
842 | xpad->odata[8] = strong / 256; /* left actuator */ | ||
843 | xpad->odata[9] = weak / 256; /* right actuator */ | ||
844 | xpad->odata[10] = 0x80; /* length of pulse */ | ||
845 | xpad->odata[11] = 0x00; /* stop period of pulse */ | ||
846 | xpad->irq_out->transfer_buffer_length = 12; | ||
847 | |||
848 | return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); | ||
849 | |||
831 | default: | 850 | default: |
832 | dev_dbg(&xpad->dev->dev, | 851 | dev_dbg(&xpad->dev->dev, |
833 | "%s - rumble command sent to unsupported xpad type: %d\n", | 852 | "%s - rumble command sent to unsupported xpad type: %d\n", |
@@ -841,7 +860,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect | |||
841 | 860 | ||
842 | static int xpad_init_ff(struct usb_xpad *xpad) | 861 | static int xpad_init_ff(struct usb_xpad *xpad) |
843 | { | 862 | { |
844 | if (xpad->xtype == XTYPE_UNKNOWN || xpad->xtype == XTYPE_XBOXONE) | 863 | if (xpad->xtype == XTYPE_UNKNOWN) |
845 | return 0; | 864 | return 0; |
846 | 865 | ||
847 | input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); | 866 | input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); |