mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 15:58:47 +00:00
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>
This commit is contained in:
parent
a93d4f2d02
commit
b514d4f7c6
@ -549,7 +549,7 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
|
||||
struct usb_endpoint_descriptor *ep_irq_out;
|
||||
int error;
|
||||
|
||||
if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX)
|
||||
if (xpad->xtype == XTYPE_UNKNOWN)
|
||||
return 0;
|
||||
|
||||
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)
|
||||
|
||||
static void xpad_stop_output(struct usb_xpad *xpad)
|
||||
{
|
||||
if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX)
|
||||
if (xpad->xtype != XTYPE_UNKNOWN)
|
||||
usb_kill_urb(xpad->irq_out);
|
||||
}
|
||||
|
||||
static void xpad_deinit_output(struct usb_xpad *xpad)
|
||||
{
|
||||
if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX) {
|
||||
if (xpad->xtype != XTYPE_UNKNOWN) {
|
||||
usb_free_urb(xpad->irq_out);
|
||||
usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
|
||||
xpad->odata, xpad->odata_dma);
|
||||
@ -636,6 +636,23 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
|
||||
|
||||
return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
|
||||
|
||||
case XTYPE_XBOX360W:
|
||||
xpad->odata[0] = 0x00;
|
||||
xpad->odata[1] = 0x01;
|
||||
xpad->odata[2] = 0x0F;
|
||||
xpad->odata[3] = 0xC0;
|
||||
xpad->odata[4] = 0x00;
|
||||
xpad->odata[5] = strong / 256;
|
||||
xpad->odata[6] = weak / 256;
|
||||
xpad->odata[7] = 0x00;
|
||||
xpad->odata[8] = 0x00;
|
||||
xpad->odata[9] = 0x00;
|
||||
xpad->odata[10] = 0x00;
|
||||
xpad->odata[11] = 0x00;
|
||||
xpad->irq_out->transfer_buffer_length = 12;
|
||||
|
||||
return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
|
||||
|
||||
default:
|
||||
dbg("%s - rumble command sent to unsupported xpad type: %d",
|
||||
__func__, xpad->xtype);
|
||||
@ -648,7 +665,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
|
||||
|
||||
static int xpad_init_ff(struct usb_xpad *xpad)
|
||||
{
|
||||
if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX)
|
||||
if (xpad->xtype == XTYPE_UNKNOWN)
|
||||
return 0;
|
||||
|
||||
input_set_capability(xpad->dev, EV_FF, FF_RUMBLE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user