aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/joystick/xpad.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 923c57236c51..3438e98c145a 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -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;