diff options
Diffstat (limited to 'drivers/input/joystick/xpad.c')
-rw-r--r-- | drivers/input/joystick/xpad.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 804dbcc37d3f..3438e98c145a 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -1031,17 +1031,17 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect | |||
1031 | 1031 | ||
1032 | case XTYPE_XBOXONE: | 1032 | case XTYPE_XBOXONE: |
1033 | packet->data[0] = 0x09; /* activate rumble */ | 1033 | packet->data[0] = 0x09; /* activate rumble */ |
1034 | packet->data[1] = 0x08; | 1034 | packet->data[1] = 0x00; |
1035 | packet->data[2] = xpad->odata_serial++; | 1035 | packet->data[2] = xpad->odata_serial++; |
1036 | packet->data[3] = 0x08; /* continuous effect */ | 1036 | packet->data[3] = 0x09; |
1037 | packet->data[4] = 0x00; /* simple rumble mode */ | 1037 | packet->data[4] = 0x00; |
1038 | packet->data[5] = 0x03; /* L and R actuator only */ | 1038 | packet->data[5] = 0x0F; |
1039 | packet->data[6] = 0x00; /* TODO: LT actuator */ | 1039 | packet->data[6] = 0x00; |
1040 | packet->data[7] = 0x00; /* TODO: RT actuator */ | 1040 | packet->data[7] = 0x00; |
1041 | packet->data[8] = strong / 512; /* left actuator */ | 1041 | packet->data[8] = strong / 512; /* left actuator */ |
1042 | packet->data[9] = weak / 512; /* right actuator */ | 1042 | packet->data[9] = weak / 512; /* right actuator */ |
1043 | packet->data[10] = 0x80; /* length of pulse */ | 1043 | packet->data[10] = 0xFF; |
1044 | packet->data[11] = 0x00; /* stop period of pulse */ | 1044 | packet->data[11] = 0x00; |
1045 | packet->data[12] = 0x00; | 1045 | packet->data[12] = 0x00; |
1046 | packet->len = 13; | 1046 | packet->len = 13; |
1047 | packet->pending = true; | 1047 | packet->pending = true; |
@@ -1437,16 +1437,6 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
1437 | break; | 1437 | break; |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | if (xpad_device[i].xtype == XTYPE_XBOXONE && | ||
1441 | intf->cur_altsetting->desc.bInterfaceNumber != 0) { | ||
1442 | /* | ||
1443 | * The Xbox One controller lists three interfaces all with the | ||
1444 | * same interface class, subclass and protocol. Differentiate by | ||
1445 | * interface number. | ||
1446 | */ | ||
1447 | return -ENODEV; | ||
1448 | } | ||
1449 | |||
1450 | xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL); | 1440 | xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL); |
1451 | if (!xpad) | 1441 | if (!xpad) |
1452 | return -ENOMEM; | 1442 | return -ENOMEM; |
@@ -1478,6 +1468,8 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
1478 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { | 1468 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { |
1479 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) | 1469 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) |
1480 | xpad->xtype = XTYPE_XBOX360W; | 1470 | xpad->xtype = XTYPE_XBOX360W; |
1471 | else if (intf->cur_altsetting->desc.bInterfaceProtocol == 208) | ||
1472 | xpad->xtype = XTYPE_XBOXONE; | ||
1481 | else | 1473 | else |
1482 | xpad->xtype = XTYPE_XBOX360; | 1474 | xpad->xtype = XTYPE_XBOX360; |
1483 | } else { | 1475 | } else { |
@@ -1492,6 +1484,17 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
1492 | xpad->mapping |= MAP_STICKS_TO_NULL; | 1484 | xpad->mapping |= MAP_STICKS_TO_NULL; |
1493 | } | 1485 | } |
1494 | 1486 | ||
1487 | if (xpad->xtype == XTYPE_XBOXONE && | ||
1488 | intf->cur_altsetting->desc.bInterfaceNumber != 0) { | ||
1489 | /* | ||
1490 | * The Xbox One controller lists three interfaces all with the | ||
1491 | * same interface class, subclass and protocol. Differentiate by | ||
1492 | * interface number. | ||
1493 | */ | ||
1494 | error = -ENODEV; | ||
1495 | goto err_free_in_urb; | ||
1496 | } | ||
1497 | |||
1495 | error = xpad_init_output(intf, xpad); | 1498 | error = xpad_init_output(intf, xpad); |
1496 | if (error) | 1499 | if (error) |
1497 | goto err_free_in_urb; | 1500 | goto err_free_in_urb; |