Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions xpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,10 +1668,14 @@ static int xpad_start_xbox_360(struct usb_xpad *xpad)
}

if ((xpad->quirks & QUIRK_360_START_PKT_1) || is_shanwan) {
/* Get_Report(0x01), Default Controller Input Report(0x0100) */
status = usb_control_msg(xpad->udev,
usb_rcvctrlpipe(xpad->udev, 0),
0x1, 0xc1,
cpu_to_le16(0x100), cpu_to_le16(0x0), data, cpu_to_le16(20),
0x01,
USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE,
0x0100,
xpad->intf->cur_altsetting->desc.bInterfaceNumber,
data, 20,
TIMEOUT);

#ifdef DEBUG
Expand All @@ -1690,10 +1694,14 @@ static int xpad_start_xbox_360(struct usb_xpad *xpad)
}

if ((xpad->quirks & QUIRK_360_START_PKT_2) || is_shanwan) {
/* Get_Report(0x01), non-documented request(0x0000) */
status = usb_control_msg(xpad->udev,
usb_rcvctrlpipe(xpad->udev, 0),
0x1, 0xc1,
cpu_to_le16(0x0), cpu_to_le16(0x0), data, cpu_to_le16(8),
0x01,
USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE,
0x0000,
xpad->intf->cur_altsetting->desc.bInterfaceNumber,
data, 8,
TIMEOUT);
#ifdef DEBUG
dev_dbg(&xpad->intf->dev,
Expand All @@ -1711,10 +1719,13 @@ static int xpad_start_xbox_360(struct usb_xpad *xpad)
}

if ((xpad->quirks & QUIRK_360_START_PKT_3) || is_shanwan) {
/* Get_Report(0x01), Get_Device_ID(0x0000,0x0000) */
status = usb_control_msg(xpad->udev,
usb_rcvctrlpipe(xpad->udev, 0),
0x1, 0xc0,
cpu_to_le16(0x0), cpu_to_le16(0x0), data, cpu_to_le16(4),
0x01,
USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_DEVICE,
0x0000, 0x0000,
data, 4,
TIMEOUT);
#ifdef DEBUG
dev_dbg(&xpad->intf->dev,
Expand Down Expand Up @@ -2046,15 +2057,15 @@ static int xpad_start_input(struct usb_xpad *xpad)
*/
u8 dummy[20];

/* Get_Report(0x01), Default Controller Input Report(0x0100) */
error = usb_control_msg_recv(xpad->udev, 0,
/* bRequest */ 0x01,
/* bmRequestType */
USB_TYPE_VENDOR | USB_DIR_IN |
USB_RECIP_INTERFACE,
/* wValue */ 0x100,
/* wIndex */ 0x00,
USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE,
/* wValue */ 0x0100,
/* wIndex */ xpad->intf->cur_altsetting->desc.bInterfaceNumber,
dummy, sizeof(dummy),
25, GFP_KERNEL);
50, GFP_KERNEL);
if (error)
dev_warn(&xpad->dev->dev,
"unable to receive magic message: %d\n",
Expand Down