aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChris Moeller <kode54@gmail.com>2011-07-04 22:21:59 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-07-04 22:31:06 -0400
commitb514d4f7c6506b696d7de6a4426d0886753e43c9 (patch)
treeed9ae6af01557cd31e0f5cfc500bae6e1e5e70e0 /drivers
parenta93d4f2d023ea5e84c0104d4e479243c6ac77d17 (diff)
Input: xpad - enable rumble support for XBox360 Wireless Controllers
This patch implements rumble support for XBox360 Wireless Controllers. Signed-off-by: Chris Moeller <kode54@gmail.c> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/joystick/xpad.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index e91838c83dbc..d72887585a14 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -549,7 +549,7 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
549 struct usb_endpoint_descriptor *ep_irq_out; 549 struct usb_endpoint_descriptor *ep_irq_out;
550 int error; 550 int error;
551 551
552 if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX) 552 if (xpad->xtype == XTYPE_UNKNOWN)
553 return 0; 553 return 0;
554 554
555 xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, 555 xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN,
@@ -583,13 +583,13 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
583 583
584static void xpad_stop_output(struct usb_xpad *xpad) 584static void xpad_stop_output(struct usb_xpad *xpad)
585{ 585{
586 if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX) 586 if (xpad->xtype != XTYPE_UNKNOWN)
587 usb_kill_urb(xpad->irq_out); 587 usb_kill_urb(xpad->irq_out);
588} 588}
589 589
590static void xpad_deinit_output(struct usb_xpad *xpad) 590static void xpad_deinit_output(struct usb_xpad *xpad)
591{ 591{
592 if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX) { 592 if (xpad->xtype != XTYPE_UNKNOWN) {
593 usb_free_urb(xpad->irq_out); 593 usb_free_urb(xpad->irq_out);
594 usb_free_coherent(xpad->udev, XPAD_PKT_LEN, 594 usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
595 xpad->odata, xpad->odata_dma); 595 xpad->odata, xpad->odata_dma);
@@ -636,6 +636,23 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
636 636
637 return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); 637 return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
638 638
639 case XTYPE_XBOX360W:
640 xpad->odata[0] = 0x00;
641 xpad->odata[1] = 0x01;
642 xpad->odata[2] = 0x0F;
643 xpad->odata[3] = 0xC0;
644 xpad->odata[4] = 0x00;
645 xpad->odata[5] = strong / 256;
646 xpad->odata[6] = weak / 256;
647 xpad->odata[7] = 0x00;
648 xpad->odata[8] = 0x00;
649 xpad->odata[9] = 0x00;
650 xpad->odata[10] = 0x00;
651 xpad->odata[11] = 0x00;
652 xpad->irq_out->transfer_buffer_length = 12;
653
654 return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
655
639 default: 656 default:
640 dbg("%s - rumble command sent to unsupported xpad type: %d", 657 dbg("%s - rumble command sent to unsupported xpad type: %d",
641 __func__, xpad->xtype); 658 __func__, xpad->xtype);
@@ -648,7 +665,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
648 665
649static int xpad_init_ff(struct usb_xpad *xpad) 666static int xpad_init_ff(struct usb_xpad *xpad)
650{ 667{
651 if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX) 668 if (xpad->xtype == XTYPE_UNKNOWN)
652 return 0; 669 return 0;
653 670
654 input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); 671 input_set_capability(xpad->dev, EV_FF, FF_RUMBLE);