From: Sasha Levin Date: Thu, 29 Nov 2018 09:06:06 +0000 (-0500) Subject: xpad fixes and quirks for 4.4 X-Git-Tag: v4.19.6~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=156d8e2cf0da8e589d5be2bddc056fef172e4406;p=thirdparty%2Fkernel%2Fstable-queue.git xpad fixes and quirks for 4.4 Signed-off-by: Sasha Levin --- diff --git a/queue-4.4/input-xpad-add-gpd-win-2-controller-usb-ids.patch b/queue-4.4/input-xpad-add-gpd-win-2-controller-usb-ids.patch new file mode 100644 index 00000000000..c7bc497e253 --- /dev/null +++ b/queue-4.4/input-xpad-add-gpd-win-2-controller-usb-ids.patch @@ -0,0 +1,42 @@ +From d3ae00bd9ef74c5d492f33bd60252d0b48812bf2 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Fri, 1 Jun 2018 11:46:08 -0700 +Subject: Input: xpad - add GPD Win 2 Controller USB IDs + +[ Upstream commit c1ba08390a8bb13c927e699330896adc15b78205 ] + +GPD Win 2 Website: http://www.gpd.hk/gpdwin2.asp + +Tested on a unit from the first production run sent to Indiegogo backers + +Signed-off-by: Ethan Lee +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 5bf85c43e6d9..66cc37b41113 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -128,6 +128,7 @@ static const struct xpad_device { + u8 mapping; + u8 xtype; + } xpad_device[] = { ++ { 0x0079, 0x18d4, "GPD Win 2 Controller", 0, XTYPE_XBOX360 }, + { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, + { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX }, + { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, +@@ -414,6 +415,7 @@ static const signed short xpad_abs_triggers[] = { + + static const struct usb_device_id xpad_table[] = { + { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ ++ XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 Controller */ + XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ + XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-add-mad-catz-fightstick-te-2-vid-pid.patch b/queue-4.4/input-xpad-add-mad-catz-fightstick-te-2-vid-pid.patch new file mode 100644 index 00000000000..d3c09a9fbc9 --- /dev/null +++ b/queue-4.4/input-xpad-add-mad-catz-fightstick-te-2-vid-pid.patch @@ -0,0 +1,59 @@ +From 3eee5ec13e87cf593337444ede5c1c60530cf063 Mon Sep 17 00:00:00 2001 +From: Silvan Jegen +Date: Thu, 17 Mar 2016 17:15:01 -0700 +Subject: Input: xpad - add Mad Catz FightStick TE 2 VID/PID + +[ Upstream commit d63b0f0c0f19dc8687387ead5a28148dcad1a4b9 ] + +This adds the VID/PID combination for the Xbox One version of the Mad +Catz FightStick TE 2. + +The functionality that this provides is about on par with what the +Windows drivers for the stick manage to deliver. + +What works: +- Digital stick +- 6 main buttons +- Xbox button +- The two buttons on the back +- The locking buttons (preventing accidental Xbox button press) + +What doesn't work: +- Two of the main buttons (don't work on Windows either) +- The "Haptic" button setting does not have an effect (not sure if it + works on Windows) + +I added the MAP_TRIGGERS_TO_BUTTONS option but in my (limited) testing +there was no practical difference with or without. The FightStick does +not have triggers though so adding it makes sense. + +Signed-off-by: Silvan Jegen +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index cd1de2851f1d..5f47e062cada 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -153,6 +153,7 @@ static const struct xpad_device { + { 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 }, ++ { 0x0738, 0x4a01, "Mad Catz FightStick TE 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, + { 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 }, + { 0x0738, 0xbeef, "Mad Catz JOYTECH NEO SE Advanced GamePad", XTYPE_XBOX360 }, +@@ -305,6 +306,7 @@ static struct usb_device_id xpad_table[] = { + XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ + XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ + { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ ++ XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ + XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ + XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-add-more-third-party-controllers.patch b/queue-4.4/input-xpad-add-more-third-party-controllers.patch new file mode 100644 index 00000000000..5d26ed050ce --- /dev/null +++ b/queue-4.4/input-xpad-add-more-third-party-controllers.patch @@ -0,0 +1,78 @@ +From 3a60ba3167f3f9a89f9aa82ddaef4c3ad3b80e4e Mon Sep 17 00:00:00 2001 +From: Pavel Rojtberg +Date: Fri, 27 May 2016 16:24:20 -0700 +Subject: Input: xpad - add more third-party controllers + +[ Upstream commit 6538c3b2d2d220a974e47928b165ea09b9cfa6b4 ] + +Signed-off-by: Pierre-Loup A. Griffais +Signed-off-by: Thomas Debesse +Signed-off-by: aronschatz +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index a49be8bc5819..c8897fc3202c 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -173,9 +173,11 @@ static const struct xpad_device { + { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX }, + { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, +@@ -183,6 +185,7 @@ static const struct xpad_device { + { 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 }, + { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, + { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, + { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, + { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, +@@ -200,6 +203,7 @@ static const struct xpad_device { + { 0x162e, 0xbeef, "Joytech Neo-Se Take2", 0, XTYPE_XBOX360 }, + { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 }, + { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, +@@ -213,6 +217,8 @@ static const struct xpad_device { + { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE }, ++ { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, +@@ -308,13 +314,16 @@ static struct usb_device_id xpad_table[] = { + { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ + XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ + XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ ++ XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ + XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ + XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ + XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ + XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ ++ XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ + XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ + XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ ++ XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOX360_VENDOR(0x1532), /* Razer Sabertooth */ + XPAD_XBOXONE_VENDOR(0x1532), /* Razer Wildcat */ + XPAD_XBOX360_VENDOR(0x15e4), /* Numark X-Box 360 controllers */ +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-add-pdp-device-id-0x02a4.patch b/queue-4.4/input-xpad-add-pdp-device-id-0x02a4.patch new file mode 100644 index 00000000000..aa18d4ac5da --- /dev/null +++ b/queue-4.4/input-xpad-add-pdp-device-id-0x02a4.patch @@ -0,0 +1,62 @@ +From 08b2bb4a87697670abf67b71429d916cf281e753 Mon Sep 17 00:00:00 2001 +From: Francis Therien +Date: Mon, 26 Mar 2018 15:59:00 -0700 +Subject: Input: xpad - add PDP device id 0x02a4 + +[ Upstream commit c6c848572f4da0e34ffe0a35364b4db871e13e42 ] + +Adds support for a PDP Xbox One controller with device ID +(0x06ef:0x02a4). The Product string for this device is "PDP Wired +Controller for Xbox One - Stealth Series | Phantom Black". + +Signed-off-by: Francis Therien +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index d88d3e0f59fb..298581b0f6c1 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -230,6 +230,7 @@ static const struct xpad_device { + { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, +@@ -478,7 +479,8 @@ static const u8 xboxone_hori_init[] = { + + /* + * This packet is required for some of the PDP pads to start +- * sending input reports. One of those pads is (0x0e6f:0x02ab). ++ * sending input reports. These pads include: (0x0e6f:0x02ab), ++ * (0x0e6f:0x02a4). + */ + static const u8 xboxone_pdp_init1[] = { + 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14 +@@ -486,7 +488,8 @@ static const u8 xboxone_pdp_init1[] = { + + /* + * This packet is required for some of the PDP pads to start +- * sending input reports. One of those pads is (0x0e6f:0x02ab). ++ * sending input reports. These pads include: (0x0e6f:0x02ab), ++ * (0x0e6f:0x02a4). + */ + static const u8 xboxone_pdp_init2[] = { + 0x06, 0x20, 0x00, 0x02, 0x01, 0x00 +@@ -524,6 +527,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { + XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), + XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1), + XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-add-product-id-for-xbox-one-s-pad.patch b/queue-4.4/input-xpad-add-product-id-for-xbox-one-s-pad.patch new file mode 100644 index 00000000000..99173e8fcfb --- /dev/null +++ b/queue-4.4/input-xpad-add-product-id-for-xbox-one-s-pad.patch @@ -0,0 +1,32 @@ +From 28badb1a9d452bb418240f42c30cdb2d1d7ef65e Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Sun, 27 Nov 2016 20:37:31 -0800 +Subject: Input: xpad - add product ID for Xbox One S pad + +[ Upstream commit 599b8c09d974d6e4d85a8f7bc8ed7442977866a8 ] + +This is the new gamepad that ships with the Xbox One S which +includes Bluetooth functionality. + +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index f397a5b6910f..4dc8befc92e4 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -134,6 +134,7 @@ static const struct xpad_device { + { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, + { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, + { 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE }, ++ { 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0, XTYPE_XBOXONE }, + { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-add-support-for-pdp-xbox-one-controllers.patch b/queue-4.4/input-xpad-add-support-for-pdp-xbox-one-controllers.patch new file mode 100644 index 00000000000..5f587bfae55 --- /dev/null +++ b/queue-4.4/input-xpad-add-support-for-pdp-xbox-one-controllers.patch @@ -0,0 +1,68 @@ +From 64ff31aef8745c491871e2cbf1415d65f5d3e03b Mon Sep 17 00:00:00 2001 +From: Mark Furneaux +Date: Mon, 22 Jan 2018 11:24:17 -0800 +Subject: Input: xpad - add support for PDP Xbox One controllers + +[ Upstream commit e5c9c6a885fad00aa559b49d8fc23a60e290824e ] + +Adds support for the current lineup of Xbox One controllers from PDP +(Performance Designed Products). These controllers are very picky with +their initialization sequence and require an additional 2 packets before +they send any input reports. + +Signed-off-by: Mark Furneaux +Reviewed-by: Cameron Gutman +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index d86e59515b9c..d88d3e0f59fb 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -229,6 +229,7 @@ static const struct xpad_device { + { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, +@@ -475,6 +476,22 @@ static const u8 xboxone_hori_init[] = { + 0x00, 0x00, 0x00, 0x80, 0x00 + }; + ++/* ++ * This packet is required for some of the PDP pads to start ++ * sending input reports. One of those pads is (0x0e6f:0x02ab). ++ */ ++static const u8 xboxone_pdp_init1[] = { ++ 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14 ++}; ++ ++/* ++ * This packet is required for some of the PDP pads to start ++ * sending input reports. One of those pads is (0x0e6f:0x02ab). ++ */ ++static const u8 xboxone_pdp_init2[] = { ++ 0x06, 0x20, 0x00, 0x02, 0x01, 0x00 ++}; ++ + /* + * A specific rumble packet is required for some PowerA pads to start + * sending input reports. One of those pads is (0x24c6:0x543a). +@@ -505,6 +522,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { + XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init), + XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init), + XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch b/queue-4.4/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch new file mode 100644 index 00000000000..065ace39f1b --- /dev/null +++ b/queue-4.4/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch @@ -0,0 +1,48 @@ +From 56aa58b306d420a2f27b3f26e5cd24226760f005 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ramses=20Ram=C3=ADrez?= +Date: Fri, 28 Sep 2018 16:59:26 -0700 +Subject: Input: xpad - add support for Xbox1 PDP Camo series gamepad +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ Upstream commit 9735082a7cbae572c2eabdc45acecc8c9fa0759b ] + +The "Xbox One PDP Wired Controller - Camo series" has a different +product-id than the regular PDP controller and the PDP stealth series, +but it uses the same initialization sequence. This patch adds the +product-id of the camo series to the structures that handle the other +PDP Xbox One controllers. + +Signed-off-by: Ramses Ramírez +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 69b44aebaf01..2e52015634f9 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -234,6 +234,7 @@ static const struct xpad_device { + { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x02a6, "PDP Wired Controller for Xbox One - Camo Series", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, +@@ -533,6 +534,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { + XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), + XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1), ++ XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-add-usb-ids-for-mad-catz-brawlstick-and-r.patch b/queue-4.4/input-xpad-add-usb-ids-for-mad-catz-brawlstick-and-r.patch new file mode 100644 index 00000000000..3b69a293473 --- /dev/null +++ b/queue-4.4/input-xpad-add-usb-ids-for-mad-catz-brawlstick-and-r.patch @@ -0,0 +1,43 @@ +From e116955d8bfd9e76fd07bb7363ac5c6a16170cec Mon Sep 17 00:00:00 2001 +From: Benjamin Valentin +Date: Sun, 7 May 2017 14:49:09 -0700 +Subject: Input: xpad - add USB IDs for Mad Catz Brawlstick and Razer + Sabertooth + +[ Upstream commit 4706aa075662fe3cad29c3f49b50878de53f4f3b ] + +Add USB IDs for two more Xbox 360 controllers. + +I found them in the pull requests for the xboxdrv userspace driver, which +seems abandoned. + +Thanks to psychogony and mkaito for reporting the IDs there! + +Signed-off-by: Benjamin Valentin +Reviewed-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 16338f0b004f..def96cd2479b 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -212,10 +212,12 @@ static const struct xpad_device { + { 0x162e, 0xbeef, "Joytech Neo-Se Take2", 0, XTYPE_XBOX360 }, + { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 }, + { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 }, ++ { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf018, "Mad Catz Street Fighter IV SE Fighting Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf019, "Mad Catz Brawlstick for Xbox 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf021, "Mad Cats Ghost Recon FS GamePad", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 }, +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-avoid-using-__set_bit-for-capabilities.patch b/queue-4.4/input-xpad-avoid-using-__set_bit-for-capabilities.patch new file mode 100644 index 00000000000..2846cd6b2c9 --- /dev/null +++ b/queue-4.4/input-xpad-avoid-using-__set_bit-for-capabilities.patch @@ -0,0 +1,90 @@ +From 0db3305649c7e3037b48b9966974d64da6d53ccf Mon Sep 17 00:00:00 2001 +From: Marcus Folkesson +Date: Tue, 8 May 2018 15:17:07 -0700 +Subject: Input: xpad - avoid using __set_bit() for capabilities + +[ Upstream commit a01308031c2647ed5f1c845104b73a8820a958a9 ] + +input_set_capability() and input_set_abs_param() will do it for you. + +Signed-off-by: Marcus Folkesson +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index b6e172f22c16..5bf85c43e6d9 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -1579,8 +1579,6 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) + { + struct usb_xpad *xpad = input_get_drvdata(input_dev); + +- set_bit(abs, input_dev->absbit); +- + switch (abs) { + case ABS_X: + case ABS_Y: +@@ -1599,6 +1597,9 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) + case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */ + input_set_abs_params(input_dev, abs, -1, 1, 0, 0); + break; ++ default: ++ input_set_abs_params(input_dev, abs, 0, 0, 0, 0); ++ break; + } + } + +@@ -1639,10 +1640,7 @@ static int xpad_init_input(struct usb_xpad *xpad) + input_dev->close = xpad_close; + } + +- __set_bit(EV_KEY, input_dev->evbit); +- + if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { +- __set_bit(EV_ABS, input_dev->evbit); + /* set up axes */ + for (i = 0; xpad_abs[i] >= 0; i++) + xpad_set_up_abs(input_dev, xpad_abs[i]); +@@ -1650,21 +1648,22 @@ static int xpad_init_input(struct usb_xpad *xpad) + + /* set up standard buttons */ + for (i = 0; xpad_common_btn[i] >= 0; i++) +- __set_bit(xpad_common_btn[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, xpad_common_btn[i]); + + /* set up model-specific ones */ + if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W || + xpad->xtype == XTYPE_XBOXONE) { + for (i = 0; xpad360_btn[i] >= 0; i++) +- __set_bit(xpad360_btn[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, xpad360_btn[i]); + } else { + for (i = 0; xpad_btn[i] >= 0; i++) +- __set_bit(xpad_btn[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, xpad_btn[i]); + } + + if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { + for (i = 0; xpad_btn_pad[i] >= 0; i++) +- __set_bit(xpad_btn_pad[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, ++ xpad_btn_pad[i]); + } + + /* +@@ -1681,7 +1680,8 @@ static int xpad_init_input(struct usb_xpad *xpad) + + if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { + for (i = 0; xpad_btn_triggers[i] >= 0; i++) +- __set_bit(xpad_btn_triggers[i], input_dev->keybit); ++ input_set_capability(input_dev, EV_KEY, ++ xpad_btn_triggers[i]); + } else { + for (i = 0; xpad_abs_triggers[i] >= 0; i++) + xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-constify-usb_device_id.patch b/queue-4.4/input-xpad-constify-usb_device_id.patch new file mode 100644 index 00000000000..38452b3f023 --- /dev/null +++ b/queue-4.4/input-xpad-constify-usb_device_id.patch @@ -0,0 +1,34 @@ +From 538e82428875076a9dde946d7ca751c9112cbaaa Mon Sep 17 00:00:00 2001 +From: Arvind Yadav +Date: Mon, 7 Aug 2017 20:04:13 -0700 +Subject: Input: xpad - constify usb_device_id + +[ Upstream commit 94aef061c796d3d47f1a2eed41e651ffaaade402 ] + +usb_device_id are not supposed to change at runtime. All functions +working with usb_device_id provided by work with +const usb_device_id. So mark the non-const structs as const. + +Signed-off-by: Arvind Yadav +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 298a6ba51411..2578a7677040 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -408,7 +408,7 @@ static const signed short xpad_abs_triggers[] = { + #define XPAD_XBOXONE_VENDOR(vend) \ + { XPAD_XBOXONE_VENDOR_PROTOCOL(vend, 208) } + +-static struct usb_device_id xpad_table[] = { ++static const struct usb_device_id xpad_table[] = { + { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ + XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-correct-xbox-one-pad-device-name.patch b/queue-4.4/input-xpad-correct-xbox-one-pad-device-name.patch new file mode 100644 index 00000000000..e319e72fa65 --- /dev/null +++ b/queue-4.4/input-xpad-correct-xbox-one-pad-device-name.patch @@ -0,0 +1,36 @@ +From ae39bd45d6085f603f9e27a073e04a3b8fb366d2 Mon Sep 17 00:00:00 2001 +From: Pavel Rojtberg +Date: Tue, 12 Jan 2016 14:35:51 -0800 +Subject: Input: xpad - correct xbox one pad device name + +[ Upstream commit 95162dc8493ed92e5f7dcc8874e58c2ba3836b43 ] + +Apparently the Covert Forces ID is not Covert Forces pad exclusive, but +rather denotes a new firmware version that can be found on all new +controllers and can be also updated on old hardware using Windows 10. + +see: https://github.com/paroj/xpad/issues/19 + +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index c3a38804cdc0..2f481ce2c8b0 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -128,7 +128,7 @@ static const struct xpad_device { + { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, + { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, + { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, +- { 0x045e, 0x02dd, "Microsoft X-Box One pad (Covert Forces)", 0, XTYPE_XBOXONE }, ++ { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, + { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-correctly-sort-vendor-id-s.patch b/queue-4.4/input-xpad-correctly-sort-vendor-id-s.patch new file mode 100644 index 00000000000..0570f21b662 --- /dev/null +++ b/queue-4.4/input-xpad-correctly-sort-vendor-id-s.patch @@ -0,0 +1,48 @@ +From ab9ae39d9c6cd8213359fd2e223dba8dad8d8290 Mon Sep 17 00:00:00 2001 +From: Daniel Tobias +Date: Fri, 27 May 2016 16:25:10 -0700 +Subject: Input: xpad - correctly sort vendor id's + +[ Upstream commit c02fc1d9e5d9f093296e43e13ec7f35f140784bd ] + +Signed-off-by: Daniel Tobias +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index b9f48d4e155a..8b7fc47f7ffb 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -321,19 +321,19 @@ static struct usb_device_id xpad_table[] = { + XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ + XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ + XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ ++ XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ ++ XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ + XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ + XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ +- XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ +- XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ +- XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ +- XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ +- XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ +- XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOX360_VENDOR(0x1532), /* Razer Sabertooth */ + XPAD_XBOXONE_VENDOR(0x1532), /* Razer Wildcat */ + XPAD_XBOX360_VENDOR(0x15e4), /* Numark X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x162e), /* Joytech X-Box 360 controllers */ ++ XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ ++ XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ ++ XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ ++ XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + { } + }; + +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-don-t-depend-on-endpoint-order.patch b/queue-4.4/input-xpad-don-t-depend-on-endpoint-order.patch new file mode 100644 index 00000000000..0b42be09167 --- /dev/null +++ b/queue-4.4/input-xpad-don-t-depend-on-endpoint-order.patch @@ -0,0 +1,96 @@ +From fb92dfbc2fd4f5c5ec05f52261ab8e808ce7572d Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Tue, 3 Jan 2017 22:40:38 -0800 +Subject: Input: xpad - don't depend on endpoint order + +[ Upstream commit c01b5e7464f0cf20936d7467c7528163c4e2782d ] + +The order of endpoints is well defined on official Xbox pads, but +we have found at least one 3rd-party pad that doesn't follow the +standard ("Titanfall 2 Xbox One controller" 0e6f:0165). + +Fortunately, we get lucky with this specific pad because it uses +endpoint addresses that differ only by direction. We know that +there are other pads out where this is not true, so let's go +ahead and fix this. + +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 35 +++++++++++++++++++++-------------- + 1 file changed, 21 insertions(+), 14 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index d837900d609e..dd0503562b1c 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -838,10 +838,9 @@ static void xpad_irq_out(struct urb *urb) + spin_unlock_irqrestore(&xpad->odata_lock, flags); + } + +-static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) ++static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad, ++ struct usb_endpoint_descriptor *ep_irq_out) + { +- struct usb_endpoint_descriptor *ep_irq_out; +- int ep_irq_out_idx; + int error; + + if (xpad->xtype == XTYPE_UNKNOWN) +@@ -862,10 +861,6 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) + goto err_free_coherent; + } + +- /* Xbox One controller has in/out endpoints swapped. */ +- ep_irq_out_idx = xpad->xtype == XTYPE_XBOXONE ? 0 : 1; +- ep_irq_out = &intf->cur_altsetting->endpoint[ep_irq_out_idx].desc; +- + usb_fill_int_urb(xpad->irq_out, xpad->udev, + usb_sndintpipe(xpad->udev, ep_irq_out->bEndpointAddress), + xpad->odata, XPAD_PKT_LEN, +@@ -1455,8 +1450,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + { + struct usb_device *udev = interface_to_usbdev(intf); + struct usb_xpad *xpad; +- struct usb_endpoint_descriptor *ep_irq_in; +- int ep_irq_in_idx; ++ struct usb_endpoint_descriptor *ep_irq_in, *ep_irq_out; + int i, error; + + if (intf->cur_altsetting->desc.bNumEndpoints != 2) +@@ -1526,13 +1520,26 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + goto err_free_in_urb; + } + +- error = xpad_init_output(intf, xpad); +- if (error) ++ ep_irq_in = ep_irq_out = NULL; ++ ++ for (i = 0; i < 2; i++) { ++ struct usb_endpoint_descriptor *ep = ++ &intf->cur_altsetting->endpoint[i].desc; ++ ++ if (usb_endpoint_dir_in(ep)) ++ ep_irq_in = ep; ++ else ++ ep_irq_out = ep; ++ } ++ ++ if (!ep_irq_in || !ep_irq_out) { ++ error = -ENODEV; + goto err_free_in_urb; ++ } + +- /* Xbox One controller has in/out endpoints swapped. */ +- ep_irq_in_idx = xpad->xtype == XTYPE_XBOXONE ? 1 : 0; +- ep_irq_in = &intf->cur_altsetting->endpoint[ep_irq_in_idx].desc; ++ error = xpad_init_output(intf, xpad, ep_irq_out); ++ if (error) ++ goto err_free_in_urb; + + usb_fill_int_urb(xpad->irq_in, udev, + usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-fix-gpd-win-2-controller-name.patch b/queue-4.4/input-xpad-fix-gpd-win-2-controller-name.patch new file mode 100644 index 00000000000..cc5359265d0 --- /dev/null +++ b/queue-4.4/input-xpad-fix-gpd-win-2-controller-name.patch @@ -0,0 +1,42 @@ +From f421400ac832a6093df574c45b24387e744e3692 Mon Sep 17 00:00:00 2001 +From: Enno Boland +Date: Tue, 19 Jun 2018 11:55:33 -0700 +Subject: Input: xpad - fix GPD Win 2 controller name + +[ Upstream commit dd6bee81c942c0ea01030da9356026afb88f9d18 ] + +This fixes using the controller with SDL2. + +SDL2 has a naive algorithm to apply the correct settings to a controller. +For X-Box compatible controllers it expects that the controller name +contains a variation of a 'XBOX'-string. + +This patch changes the identifier to contain "X-Box" as substring. Tested +with Steam and C-Dogs-SDL which both detect the controller properly after +adding this patch. + +Fixes: c1ba08390a8b ("Input: xpad - add GPD Win 2 Controller USB IDs") +Cc: stable@vger.kernel.org +Signed-off-by: Enno Boland +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 66cc37b41113..69b44aebaf01 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -128,7 +128,7 @@ static const struct xpad_device { + u8 mapping; + u8 xtype; + } xpad_device[] = { +- { 0x0079, 0x18d4, "GPD Win 2 Controller", 0, XTYPE_XBOX360 }, ++ { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 }, + { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, + { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX }, + { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-fix-powera-init-quirk-for-some-gamepad-mo.patch b/queue-4.4/input-xpad-fix-powera-init-quirk-for-some-gamepad-mo.patch new file mode 100644 index 00000000000..a1121cc86d3 --- /dev/null +++ b/queue-4.4/input-xpad-fix-powera-init-quirk-for-some-gamepad-mo.patch @@ -0,0 +1,84 @@ +From 6424d20de8b8ca08adfacec43a0d2826ff8b9ed0 Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Thu, 31 Aug 2017 11:52:20 -0700 +Subject: Input: xpad - fix PowerA init quirk for some gamepad models + +[ Upstream commit f5308d1b83eba20e69df5e0926ba7257c8dd9074 ] + +The PowerA gamepad initialization quirk worked with the PowerA +wired gamepad I had around (0x24c6:0x543a), but a user reported [0] +that it didn't work for him, even though our gamepads shared the +same vendor and product IDs. + +When I initially implemented the PowerA quirk, I wanted to avoid +actually triggering the rumble action during init. My tests showed +that my gamepad would work correctly even if it received a rumble +of 0 intensity, so that's what I went with. + +Unfortunately, this apparently isn't true for all models (perhaps +a firmware difference?). This non-working gamepad seems to require +the real magic rumble packet that the Microsoft driver sends, which +actually vibrates the gamepad. To counteract this effect, I still +send the old zero-rumble PowerA quirk packet which cancels the +rumble effect before the motors can spin up enough to vibrate. + +[0]: https://github.com/paroj/xpad/issues/48#issuecomment-313904867 + +Reported-by: Kyle Beauchamp +Tested-by: Kyle Beauchamp +Fixes: 81093c9848a7 ("Input: xpad - support some quirky Xbox One pads") +Cc: stable@vger.kernel.org # v4.12 +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 2578a7677040..f8e34ef643c7 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -476,10 +476,21 @@ static const u8 xboxone_hori_init[] = { + }; + + /* +- * A rumble packet is required for some PowerA pads to start ++ * A specific rumble packet is required for some PowerA pads to start + * sending input reports. One of those pads is (0x24c6:0x543a). + */ +-static const u8 xboxone_zerorumble_init[] = { ++static const u8 xboxone_rumblebegin_init[] = { ++ 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, ++ 0x1D, 0x1D, 0xFF, 0x00, 0x00 ++}; ++ ++/* ++ * A rumble packet with zero FF intensity will immediately ++ * terminate the rumbling required to init PowerA pads. ++ * This should happen fast enough that the motors don't ++ * spin up to enough speed to actually vibrate the gamepad. ++ */ ++static const u8 xboxone_rumbleend_init[] = { + 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00 + }; +@@ -494,9 +505,12 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { + XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init), + XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init), + XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), +- XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_zerorumble_init), +- XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_zerorumble_init), +- XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_zerorumble_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumbleend_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumbleend_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumbleend_init), + }; + + struct xpad_output_packet { +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-fix-rumble-on-xbox-one-controllers-with-2.patch b/queue-4.4/input-xpad-fix-rumble-on-xbox-one-controllers-with-2.patch new file mode 100644 index 00000000000..849a8cea1e1 --- /dev/null +++ b/queue-4.4/input-xpad-fix-rumble-on-xbox-one-controllers-with-2.patch @@ -0,0 +1,55 @@ +From cfcb96a39d88e09788a155902f0da5d469ee1357 Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Wed, 1 Jun 2016 11:32:51 -0700 +Subject: Input: xpad - fix rumble on Xbox One controllers with 2015 firmware + +[ Upstream commit 540c26087bfbad6ea72758b76b16ae6282a73fea ] + +Xbox One controllers that shipped with or were upgraded to the 2015 +firmware discard the current rumble packets we send. This patch changes +the Xbox One rumble packet to a form that both the newer and older +firmware will accept. + +It is based on changes made to support newer Xbox One controllers in +the SteamOS brewmaster-4.1 kernel branch. + +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index dcf9053a801e..82c98e5b23ab 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -1033,17 +1033,17 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect + + case XTYPE_XBOXONE: + packet->data[0] = 0x09; /* activate rumble */ +- packet->data[1] = 0x08; ++ packet->data[1] = 0x00; + packet->data[2] = xpad->odata_serial++; +- packet->data[3] = 0x08; /* continuous effect */ +- packet->data[4] = 0x00; /* simple rumble mode */ +- packet->data[5] = 0x03; /* L and R actuator only */ +- packet->data[6] = 0x00; /* TODO: LT actuator */ +- packet->data[7] = 0x00; /* TODO: RT actuator */ ++ packet->data[3] = 0x09; ++ packet->data[4] = 0x00; ++ packet->data[5] = 0x0F; ++ packet->data[6] = 0x00; ++ packet->data[7] = 0x00; + packet->data[8] = strong / 512; /* left actuator */ + packet->data[9] = weak / 512; /* right actuator */ +- packet->data[10] = 0x80; /* length of pulse */ +- packet->data[11] = 0x00; /* stop period of pulse */ ++ packet->data[10] = 0xFF; ++ packet->data[11] = 0x00; + packet->data[12] = 0x00; + packet->len = 13; + packet->pending = true; +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-fix-some-coding-style-issues.patch b/queue-4.4/input-xpad-fix-some-coding-style-issues.patch new file mode 100644 index 00000000000..eee61feff26 --- /dev/null +++ b/queue-4.4/input-xpad-fix-some-coding-style-issues.patch @@ -0,0 +1,73 @@ +From ed646a0a6a1013a53db2e2c04f804c25f108da1e Mon Sep 17 00:00:00 2001 +From: Leo Sperling +Date: Wed, 3 Aug 2016 17:31:09 -0700 +Subject: Input: xpad - fix some coding style issues + +[ Upstream commit 68c78d0155e37992268664e134996d2b140ddf38 ] + +Fix some coding style issues reported by checkpatch.pl. Mostly brackets +in macros, spacing and comment style. + +Signed-off-by: Leo Sperling +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 298581b0f6c1..b6e172f22c16 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -89,8 +89,10 @@ + + #define XPAD_PKT_LEN 64 + +-/* xbox d-pads should map to buttons, as is required for DDR pads +- but we map them to axes when possible to simplify things */ ++/* ++ * xbox d-pads should map to buttons, as is required for DDR pads ++ * but we map them to axes when possible to simplify things ++ */ + #define MAP_DPAD_TO_BUTTONS (1 << 0) + #define MAP_TRIGGERS_TO_BUTTONS (1 << 1) + #define MAP_STICKS_TO_NULL (1 << 2) +@@ -390,15 +392,15 @@ static const signed short xpad_abs_triggers[] = { + * match against vendor id as well. Wired Xbox 360 devices have protocol 1, + * wireless controllers have protocol 129. + */ +-#define XPAD_XBOX360_VENDOR_PROTOCOL(vend,pr) \ ++#define XPAD_XBOX360_VENDOR_PROTOCOL(vend, pr) \ + .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, \ + .idVendor = (vend), \ + .bInterfaceClass = USB_CLASS_VENDOR_SPEC, \ + .bInterfaceSubClass = 93, \ + .bInterfaceProtocol = (pr) + #define XPAD_XBOX360_VENDOR(vend) \ +- { XPAD_XBOX360_VENDOR_PROTOCOL(vend,1) }, \ +- { XPAD_XBOX360_VENDOR_PROTOCOL(vend,129) } ++ { XPAD_XBOX360_VENDOR_PROTOCOL((vend), 1) }, \ ++ { XPAD_XBOX360_VENDOR_PROTOCOL((vend), 129) } + + /* The Xbox One controller uses subclass 71 and protocol 208. */ + #define XPAD_XBOXONE_VENDOR_PROTOCOL(vend, pr) \ +@@ -408,7 +410,7 @@ static const signed short xpad_abs_triggers[] = { + .bInterfaceSubClass = 71, \ + .bInterfaceProtocol = (pr) + #define XPAD_XBOXONE_VENDOR(vend) \ +- { XPAD_XBOXONE_VENDOR_PROTOCOL(vend, 208) } ++ { XPAD_XBOXONE_VENDOR_PROTOCOL((vend), 208) } + + static const struct usb_device_id xpad_table[] = { + { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ +@@ -1576,6 +1578,7 @@ static void xpad_close(struct input_dev *dev) + static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) + { + struct usb_xpad *xpad = input_get_drvdata(input_dev); ++ + set_bit(abs, input_dev->absbit); + + switch (abs) { +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-fix-stuck-mode-button-on-xbox-one-s-pad.patch b/queue-4.4/input-xpad-fix-stuck-mode-button-on-xbox-one-s-pad.patch new file mode 100644 index 00000000000..fdee2da1005 --- /dev/null +++ b/queue-4.4/input-xpad-fix-stuck-mode-button-on-xbox-one-s-pad.patch @@ -0,0 +1,79 @@ +From 3d575ab974a0d3f4af65f0e10a97d03c98c133d1 Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Mon, 6 Feb 2017 13:56:10 -0800 +Subject: Input: xpad - fix stuck mode button on Xbox One S pad + +[ Upstream commit 57b8443d3e5bd046a519ff714ca31c64c7f04309 ] + +The Xbox One S requires an ack to its mode button report, otherwise it +continuously retransmits the report. This makes the mode button appear to +be stuck down after it is pressed for the first time. + +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index dd0503562b1c..14da79ead653 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -391,6 +391,7 @@ struct usb_xpad { + + static int xpad_init_input(struct usb_xpad *xpad); + static void xpad_deinit_input(struct usb_xpad *xpad); ++static void xpadone_ack_mode_report(struct usb_xpad *xpad, u8 seq_num); + + /* + * xpad_process_packet +@@ -624,6 +625,14 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char + + /* the xbox button has its own special report */ + if (data[0] == 0X07) { ++ /* ++ * The Xbox One S controller requires these reports to be ++ * acked otherwise it continues sending them forever and ++ * won't report further mode button events. ++ */ ++ if (data[1] == 0x30) ++ xpadone_ack_mode_report(xpad, data[2]); ++ + input_report_key(dev, BTN_MODE, data[4] & 0x01); + input_sync(dev); + return; +@@ -956,6 +965,30 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad) + return retval; + } + ++static void xpadone_ack_mode_report(struct usb_xpad *xpad, u8 seq_num) ++{ ++ unsigned long flags; ++ struct xpad_output_packet *packet = ++ &xpad->out_packets[XPAD_OUT_CMD_IDX]; ++ static const u8 mode_report_ack[] = { ++ 0x01, 0x20, 0x00, 0x09, 0x00, 0x07, 0x20, 0x02, ++ 0x00, 0x00, 0x00, 0x00, 0x00 ++ }; ++ ++ spin_lock_irqsave(&xpad->odata_lock, flags); ++ ++ packet->len = sizeof(mode_report_ack); ++ memcpy(packet->data, mode_report_ack, packet->len); ++ packet->data[2] = seq_num; ++ packet->pending = true; ++ ++ /* Reset the sequence so we send out the ack now */ ++ xpad->last_out_packet = -1; ++ xpad_try_sending_next_out_packet(xpad); ++ ++ spin_unlock_irqrestore(&xpad->odata_lock, flags); ++} ++ + #ifdef CONFIG_JOYSTICK_XPAD_FF + static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect) + { +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-fix-xbox-one-rumble-stopping-after-2.5-se.patch b/queue-4.4/input-xpad-fix-xbox-one-rumble-stopping-after-2.5-se.patch new file mode 100644 index 00000000000..1e7f420724a --- /dev/null +++ b/queue-4.4/input-xpad-fix-xbox-one-rumble-stopping-after-2.5-se.patch @@ -0,0 +1,51 @@ +From 84ad88fcae74887634d8ccb359f86964e0e5895c Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Sun, 27 Nov 2016 20:37:56 -0800 +Subject: Input: xpad - fix Xbox One rumble stopping after 2.5 secs + +[ Upstream commit ae3b4469dbcd3b842a9fd20940946e4d092d8731 ] + +Unlike previous Xbox pads, the Xbox One pad doesn't have "sticky" rumble +packets. The duration is encoded into the command and expiration is handled +by the pad firmware. + +ff-memless needs pseudo-sticky behavior for rumble effects to behave +properly for long duration effects. We already specify the maximum rumble +on duration in the command packets, but it's still only good for about 2.5 +seconds of rumble. This is easily reproducible running fftest's sine +vibration test. + +It turns out there's a repeat count encoded in the rumble command. We can +abuse that to get the pseudo-sticky behavior needed for rumble to behave as +expected for effects with long duration. + +By my math, this change should allow a single ff_effect to rumble for 10 +minutes straight, which should be more than enough for most needs. + +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 4dc8befc92e4..b9f48d4e155a 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -1047,9 +1047,9 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect + packet->data[7] = 0x00; + packet->data[8] = strong / 512; /* left actuator */ + packet->data[9] = weak / 512; /* right actuator */ +- packet->data[10] = 0xFF; +- packet->data[11] = 0x00; +- packet->data[12] = 0x00; ++ packet->data[10] = 0xFF; /* on period */ ++ packet->data[11] = 0x00; /* off period */ ++ packet->data[12] = 0xFF; /* repeat count */ + packet->len = 13; + packet->pending = true; + break; +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-handle-present-and-gone-correctly.patch b/queue-4.4/input-xpad-handle-present-and-gone-correctly.patch new file mode 100644 index 00000000000..5033e7bf080 --- /dev/null +++ b/queue-4.4/input-xpad-handle-present-and-gone-correctly.patch @@ -0,0 +1,269 @@ +From 0f42c57afcb17eb28d45ee6d3eb91e4407716020 Mon Sep 17 00:00:00 2001 +From: "Pierre-Loup A. Griffais" +Date: Wed, 9 Dec 2015 11:46:25 -0800 +Subject: Input: xpad - handle "present" and "gone" correctly + +[ Upstream commit 09c8b00ae3e16c8d0fd4beb2ca064502a76c0f17 ] + +Handle the "a new device is present" message properly by dynamically +creating the input device at this point in time. This means we now do not +"preallocate" all 4 devices when a single wireless base station is seen. +This requires a workqueue as we are in interrupt context when we learn +about this. + +Also properly disconnect any devices that we are told are removed. + +Signed-off-by: "Pierre-Loup A. Griffais" +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 107 ++++++++++++++++++++++------------ + 1 file changed, 69 insertions(+), 38 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 2f16d07db8ef..88de7b17bf7d 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -76,6 +76,8 @@ + */ + + #include ++#include ++#include + #include + #include + #include +@@ -334,10 +336,12 @@ struct xpad_output_packet { + + struct usb_xpad { + struct input_dev *dev; /* input device interface */ ++ struct input_dev __rcu *x360w_dev; + struct usb_device *udev; /* usb device */ + struct usb_interface *intf; /* usb interface */ + +- int pad_present; ++ bool pad_present; ++ bool input_created; + + struct urb *irq_in; /* urb for interrupt in report */ + unsigned char *idata; /* input data */ +@@ -362,8 +366,12 @@ struct usb_xpad { + int xtype; /* type of xbox device */ + int pad_nr; /* the order x360 pads were attached */ + const char *name; /* name of the device */ ++ struct work_struct work; /* init/remove device from callback */ + }; + ++static int xpad_init_input(struct usb_xpad *xpad); ++static void xpad_deinit_input(struct usb_xpad *xpad); ++ + /* + * xpad_process_packet + * +@@ -443,11 +451,9 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d + * http://www.free60.org/wiki/Gamepad + */ + +-static void xpad360_process_packet(struct usb_xpad *xpad, ++static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev, + u16 cmd, unsigned char *data) + { +- struct input_dev *dev = xpad->dev; +- + /* digital pad */ + if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { + /* dpad as buttons (left, right, up, down) */ +@@ -514,7 +520,30 @@ static void xpad360_process_packet(struct usb_xpad *xpad, + input_sync(dev); + } + +-static void xpad_identify_controller(struct usb_xpad *xpad); ++static void xpad_presence_work(struct work_struct *work) ++{ ++ struct usb_xpad *xpad = container_of(work, struct usb_xpad, work); ++ int error; ++ ++ if (xpad->pad_present) { ++ error = xpad_init_input(xpad); ++ if (error) { ++ /* complain only, not much else we can do here */ ++ dev_err(&xpad->dev->dev, ++ "unable to init device: %d\n", error); ++ } else { ++ rcu_assign_pointer(xpad->x360w_dev, xpad->dev); ++ } ++ } else { ++ RCU_INIT_POINTER(xpad->x360w_dev, NULL); ++ synchronize_rcu(); ++ /* ++ * Now that we are sure xpad360w_process_packet is not ++ * using input device we can get rid of it. ++ */ ++ xpad_deinit_input(xpad); ++ } ++} + + /* + * xpad360w_process_packet +@@ -532,24 +561,28 @@ static void xpad_identify_controller(struct usb_xpad *xpad); + */ + static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) + { ++ struct input_dev *dev; ++ bool present; ++ + /* Presence change */ + if (data[0] & 0x08) { +- if (data[1] & 0x80) { +- xpad->pad_present = 1; +- /* +- * Light up the segment corresponding to +- * controller number. +- */ +- xpad_identify_controller(xpad); +- } else +- xpad->pad_present = 0; ++ present = (data[1] & 0x80) != 0; ++ ++ if (xpad->pad_present != present) { ++ xpad->pad_present = present; ++ schedule_work(&xpad->work); ++ } + } + + /* Valid pad data */ + if (data[1] != 0x1) + return; + +- xpad360_process_packet(xpad, cmd, &data[4]); ++ rcu_read_lock(); ++ dev = rcu_dereference(xpad->x360w_dev); ++ if (dev) ++ xpad360_process_packet(xpad, dev, cmd, &data[4]); ++ rcu_read_unlock(); + } + + /* +@@ -678,7 +711,7 @@ static void xpad_irq_in(struct urb *urb) + + switch (xpad->xtype) { + case XTYPE_XBOX360: +- xpad360_process_packet(xpad, 0, xpad->idata); ++ xpad360_process_packet(xpad, xpad->dev, 0, xpad->idata); + break; + case XTYPE_XBOX360W: + xpad360w_process_packet(xpad, 0, xpad->idata); +@@ -1132,14 +1165,7 @@ static int xpad_led_probe(struct usb_xpad *xpad) + if (error) + goto err_free_id; + +- if (xpad->xtype == XTYPE_XBOX360) { +- /* +- * Light up the segment corresponding to controller +- * number on wired devices. On wireless we'll do that +- * when they respond to "presence" packet. +- */ +- xpad_identify_controller(xpad); +- } ++ xpad_identify_controller(xpad); + + return 0; + +@@ -1223,8 +1249,11 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) + + static void xpad_deinit_input(struct usb_xpad *xpad) + { +- xpad_led_disconnect(xpad); +- input_unregister_device(xpad->dev); ++ if (xpad->input_created) { ++ xpad->input_created = false; ++ xpad_led_disconnect(xpad); ++ input_unregister_device(xpad->dev); ++ } + } + + static int xpad_init_input(struct usb_xpad *xpad) +@@ -1313,6 +1342,7 @@ static int xpad_init_input(struct usb_xpad *xpad) + if (error) + goto err_disconnect_led; + ++ xpad->input_created = true; + return 0; + + err_disconnect_led: +@@ -1366,6 +1396,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + xpad->mapping = xpad_device[i].mapping; + xpad->xtype = xpad_device[i].xtype; + xpad->name = xpad_device[i].name; ++ INIT_WORK(&xpad->work, xpad_presence_work); + + if (xpad->xtype == XTYPE_UNKNOWN) { + if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { +@@ -1415,10 +1446,6 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + + usb_set_intfdata(intf, xpad); + +- error = xpad_init_input(xpad); +- if (error) +- goto err_deinit_output; +- + if (xpad->xtype == XTYPE_XBOX360W) { + /* + * Submit the int URB immediately rather than waiting for open +@@ -1430,7 +1457,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + xpad->irq_in->dev = xpad->udev; + error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); + if (error) +- goto err_deinit_input; ++ goto err_deinit_output; + + /* + * Send presence packet. +@@ -1442,13 +1469,15 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + error = xpad_inquiry_pad_presence(xpad); + if (error) + goto err_kill_in_urb; ++ } else { ++ error = xpad_init_input(xpad); ++ if (error) ++ goto err_deinit_output; + } + return 0; + + err_kill_in_urb: + usb_kill_urb(xpad->irq_in); +-err_deinit_input: +- xpad_deinit_input(xpad); + err_deinit_output: + xpad_deinit_output(xpad); + err_free_in_urb: +@@ -1465,17 +1494,19 @@ static void xpad_disconnect(struct usb_interface *intf) + { + struct usb_xpad *xpad = usb_get_intfdata (intf); + +- xpad_deinit_input(xpad); +- xpad_deinit_output(xpad); +- +- if (xpad->xtype == XTYPE_XBOX360W) { ++ if (xpad->xtype == XTYPE_XBOX360W) + usb_kill_urb(xpad->irq_in); +- } ++ ++ cancel_work_sync(&xpad->work); ++ ++ xpad_deinit_input(xpad); + + usb_free_urb(xpad->irq_in); + usb_free_coherent(xpad->udev, XPAD_PKT_LEN, + xpad->idata, xpad->idata_dma); + ++ xpad_deinit_output(xpad); ++ + kfree(xpad); + + usb_set_intfdata(intf, NULL); +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-move-reporting-xbox-one-home-button-to-co.patch b/queue-4.4/input-xpad-move-reporting-xbox-one-home-button-to-co.patch new file mode 100644 index 00000000000..a64ff503158 --- /dev/null +++ b/queue-4.4/input-xpad-move-reporting-xbox-one-home-button-to-co.patch @@ -0,0 +1,92 @@ +From 747f1e85d579b86ea4aabe937f7368ab21ae1d6e Mon Sep 17 00:00:00 2001 +From: Daniel Tobias +Date: Fri, 27 May 2016 16:25:32 -0700 +Subject: Input: xpad - move reporting xbox one home button to common function + +[ Upstream commit 4f88476c75429ba9ab71c428b4cd2f67575bc9c1 ] + +xbox one was the only device that has a *_process_buttons routine. + +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 52 +++++++++++++---------------------- + 1 file changed, 19 insertions(+), 33 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 8b7fc47f7ffb..b06f4b0785f7 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -610,14 +610,28 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha + } + + /* +- * xpadone_process_buttons ++ * xpadone_process_packet + * +- * Process a button update packet from an Xbox one controller. ++ * Completes a request by converting the data into events for the ++ * input subsystem. This version is for the Xbox One controller. ++ * ++ * The report format was gleaned from ++ * https://github.com/kylelemons/xbox/blob/master/xbox.go + */ +-static void xpadone_process_buttons(struct usb_xpad *xpad, +- struct input_dev *dev, +- unsigned char *data) ++static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) + { ++ struct input_dev *dev = xpad->dev; ++ ++ /* the xbox button has its own special report */ ++ if (data[0] == 0X07) { ++ input_report_key(dev, BTN_MODE, data[4] & 0x01); ++ input_sync(dev); ++ return; ++ } ++ /* check invalid packet */ ++ else if (data[0] != 0X20) ++ return; ++ + /* menu/view buttons */ + input_report_key(dev, BTN_START, data[4] & 0x04); + input_report_key(dev, BTN_SELECT, data[4] & 0x08); +@@ -680,34 +694,6 @@ static void xpadone_process_buttons(struct usb_xpad *xpad, + input_sync(dev); + } + +-/* +- * xpadone_process_packet +- * +- * Completes a request by converting the data into events for the +- * input subsystem. This version is for the Xbox One controller. +- * +- * The report format was gleaned from +- * https://github.com/kylelemons/xbox/blob/master/xbox.go +- */ +- +-static void xpadone_process_packet(struct usb_xpad *xpad, +- u16 cmd, unsigned char *data) +-{ +- struct input_dev *dev = xpad->dev; +- +- switch (data[0]) { +- case 0x20: +- xpadone_process_buttons(xpad, dev, data); +- break; +- +- case 0x07: +- /* the xbox button has its own special report */ +- input_report_key(dev, BTN_MODE, data[4] & 0x01); +- input_sync(dev); +- break; +- } +-} +- + static void xpad_irq_in(struct urb *urb) + { + struct usb_xpad *xpad = urb->context; +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-power-off-wireless-360-controllers-on-sus.patch b/queue-4.4/input-xpad-power-off-wireless-360-controllers-on-sus.patch new file mode 100644 index 00000000000..3e347f99329 --- /dev/null +++ b/queue-4.4/input-xpad-power-off-wireless-360-controllers-on-sus.patch @@ -0,0 +1,95 @@ +From 98331ce36922d3ce85d1979be531db0c6b7e578c Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Wed, 27 Jul 2016 14:24:55 -0700 +Subject: Input: xpad - power off wireless 360 controllers on suspend + +[ Upstream commit f712a5a05228058f6b74635546549d4a46e117fc ] + +When the USB wireless adapter is suspended, the controllers +lose their connection. This causes them to start flashing +their LED rings and searching for the wireless adapter +again, wasting the controller's battery power. + +Instead, we will tell the controllers to power down when +we suspend. This mirrors the behavior of the controllers +when connected to the console itself and how the official +Xbox One wireless adapter behaves on Windows. + +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 43 +++++++++++++++++++++++++++++++++++ + 1 file changed, 43 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 82c98e5b23ab..f397a5b6910f 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -115,6 +115,10 @@ static bool sticks_to_null; + module_param(sticks_to_null, bool, S_IRUGO); + MODULE_PARM_DESC(sticks_to_null, "Do not map sticks at all for unknown pads"); + ++static bool auto_poweroff = true; ++module_param(auto_poweroff, bool, S_IWUSR | S_IRUGO); ++MODULE_PARM_DESC(auto_poweroff, "Power off wireless controllers on suspend"); ++ + static const struct xpad_device { + u16 idVendor; + u16 idProduct; +@@ -1250,6 +1254,36 @@ static void xpad_stop_input(struct usb_xpad *xpad) + usb_kill_urb(xpad->irq_in); + } + ++static void xpad360w_poweroff_controller(struct usb_xpad *xpad) ++{ ++ unsigned long flags; ++ struct xpad_output_packet *packet = ++ &xpad->out_packets[XPAD_OUT_CMD_IDX]; ++ ++ spin_lock_irqsave(&xpad->odata_lock, flags); ++ ++ packet->data[0] = 0x00; ++ packet->data[1] = 0x00; ++ packet->data[2] = 0x08; ++ packet->data[3] = 0xC0; ++ packet->data[4] = 0x00; ++ packet->data[5] = 0x00; ++ packet->data[6] = 0x00; ++ packet->data[7] = 0x00; ++ packet->data[8] = 0x00; ++ packet->data[9] = 0x00; ++ packet->data[10] = 0x00; ++ packet->data[11] = 0x00; ++ packet->len = 12; ++ packet->pending = true; ++ ++ /* Reset the sequence so we send out poweroff now */ ++ xpad->last_out_packet = -1; ++ xpad_try_sending_next_out_packet(xpad); ++ ++ spin_unlock_irqrestore(&xpad->odata_lock, flags); ++} ++ + static int xpad360w_start_input(struct usb_xpad *xpad) + { + int error; +@@ -1598,6 +1632,15 @@ static int xpad_suspend(struct usb_interface *intf, pm_message_t message) + * or goes away. + */ + xpad360w_stop_input(xpad); ++ ++ /* ++ * The wireless adapter is going off now, so the ++ * gamepads are going to become disconnected. ++ * Unless explicitly disabled, power them down ++ * so they don't just sit there flashing. ++ */ ++ if (auto_poweroff && xpad->pad_present) ++ xpad360w_poweroff_controller(xpad); + } else { + mutex_lock(&input->mutex); + if (input->users) +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-prevent-spurious-input-from-wired-xbox-36.patch b/queue-4.4/input-xpad-prevent-spurious-input-from-wired-xbox-36.patch new file mode 100644 index 00000000000..6030d6648b7 --- /dev/null +++ b/queue-4.4/input-xpad-prevent-spurious-input-from-wired-xbox-36.patch @@ -0,0 +1,56 @@ +From f49bb423dda48d7191f682a7fc795f2d434a0ddd Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Fri, 27 May 2016 16:23:50 -0700 +Subject: Input: xpad - prevent spurious input from wired Xbox 360 controllers + +[ Upstream commit 1ff5fa3c6732f08e01ae12f12286d4728c9e4d86 ] + +After initially connecting a wired Xbox 360 controller or sending it +a command to change LEDs, a status/response packet is interpreted as +controller input. This causes the state of buttons represented in +byte 2 of the controller data packet to be incorrect until the next +valid input packet. Wireless Xbox 360 controllers are not affected. + +Writing a new value to the LED device while holding the Start button +and running jstest is sufficient to reproduce this bug. An event will +come through with the Start button released. + +Xboxdrv also won't attempt to read controller input from a packet +where byte 0 is non-zero. It also checks that byte 1 is 0x14, but +that value differs between wired and wireless controllers and this +code is shared by both. I think just checking byte 0 is enough to +eliminate unwanted packets. + +The following are some examples of 3-byte status packets I saw: +01 03 02 +02 03 00 +03 03 03 +08 03 00 + +Signed-off-by: Cameron Gutman +Signed-off-by: Pavel Rojtberg +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 5f47e062cada..a49be8bc5819 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -459,6 +459,10 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d + static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev, + u16 cmd, unsigned char *data) + { ++ /* valid pad data */ ++ if (data[0] != 0x00) ++ return; ++ + /* digital pad */ + if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { + /* dpad as buttons (left, right, up, down) */ +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-remove-spurious-events-of-wireless-xpad-3.patch b/queue-4.4/input-xpad-remove-spurious-events-of-wireless-xpad-3.patch new file mode 100644 index 00000000000..dd145f83170 --- /dev/null +++ b/queue-4.4/input-xpad-remove-spurious-events-of-wireless-xpad-3.patch @@ -0,0 +1,47 @@ +From 808fc852d5f2b34700da78e0fecbbb44a573e164 Mon Sep 17 00:00:00 2001 +From: Clement Calmels +Date: Sat, 12 Dec 2015 21:20:11 -0800 +Subject: Input: xpad - remove spurious events of wireless xpad 360 controller + +[ Upstream commit 93a017aa2f77291752e637bfd83f2459dba714cb ] + +When powering up a wireless xbox 360 controller, some wrong joystick +events are generated. It is annoying because, for example, it makes +unwanted moves in Steam big picture mode's menu. + +When my controller is powering up, this packet is received by the +driver: +00000000: 00 0f 00 f0 00 cc ff cf 8b e0 86 6a 68 f0 00 20 ...........jh.. +00000010: 13 e3 20 1d 30 03 40 01 50 01 ff ff .. .0.@.P... + +According to xboxdrv userspace driver source code, this packet is only +dumping a serial id and should not be interpreted as joystick events. +This issue can be easily seen with jstest: +$ jstest --event /dev/input/js0 + +This patch only adds a way to filter out this "serial" packet and as a +result it removes the spurous events. + +Signed-off-by: Clement Calmels +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 3258baf3282e..2f16d07db8ef 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -546,7 +546,7 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha + } + + /* Valid pad data */ +- if (!(data[1] & 0x1)) ++ if (data[1] != 0x1) + return; + + xpad360_process_packet(xpad, cmd, &data[4]); +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-remove-unused-function.patch b/queue-4.4/input-xpad-remove-unused-function.patch new file mode 100644 index 00000000000..4205dc94f10 --- /dev/null +++ b/queue-4.4/input-xpad-remove-unused-function.patch @@ -0,0 +1,38 @@ +From 09fd545879f62861c97df9c2599075ca3b68d589 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Wed, 27 Jan 2016 15:42:25 -0800 +Subject: Input: xpad - remove unused function + +[ Upstream commit a6ed4a18ba6a6f5a01e024b9d221d6439bf6ca4c ] + +There are two definitions of xpad_identify_controller(), one is used +when CONFIG_JOYSTICK_XPAD_LEDS is set, but the other one is empty +and never used, and we get a gcc warning about it: + +drivers/input/joystick/xpad.c:1210:13: warning: 'xpad_identify_controller' defined but not used [-Wunused-function] + +This removes the second definition. + +Signed-off-by: Arnd Bergmann +Fixes: cae705baa40b ("Input: xpad - re-send LED command on present event") +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 2f481ce2c8b0..cd1de2851f1d 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -1209,7 +1209,6 @@ static void xpad_led_disconnect(struct usb_xpad *xpad) + #else + static int xpad_led_probe(struct usb_xpad *xpad) { return 0; } + static void xpad_led_disconnect(struct usb_xpad *xpad) { } +-static void xpad_identify_controller(struct usb_xpad *xpad) { } + #endif + + static int xpad_start_input(struct usb_xpad *xpad) +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-restore-led-state-after-device-resume.patch b/queue-4.4/input-xpad-restore-led-state-after-device-resume.patch new file mode 100644 index 00000000000..df6e0d813b5 --- /dev/null +++ b/queue-4.4/input-xpad-restore-led-state-after-device-resume.patch @@ -0,0 +1,53 @@ +From af15540bd72987268066a9c6b2984ece326548e4 Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Mon, 6 Feb 2017 17:03:03 -0800 +Subject: Input: xpad - restore LED state after device resume + +[ Upstream commit a1fbf5bbef025b4844162b3b8868888003a7ee9c ] + +Set the LED_CORE_SUSPENDRESUME flag on our LED device so the +LED state will be automatically restored by LED core on resume. + +Since Xbox One pads stop flashing only when reinitialized, we'll +send them the initialization packet so they calm down too. + +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 14da79ead653..153b1ee13e03 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -1213,6 +1213,7 @@ static int xpad_led_probe(struct usb_xpad *xpad) + led_cdev = &led->led_cdev; + led_cdev->name = led->name; + led_cdev->brightness_set = xpad_led_set; ++ led_cdev->flags = LED_CORE_SUSPENDRESUME; + + error = led_classdev_register(&xpad->udev->dev, led_cdev); + if (error) +@@ -1689,8 +1690,16 @@ static int xpad_resume(struct usb_interface *intf) + retval = xpad360w_start_input(xpad); + } else { + mutex_lock(&input->mutex); +- if (input->users) ++ if (input->users) { + retval = xpad_start_input(xpad); ++ } else if (xpad->xtype == XTYPE_XBOXONE) { ++ /* ++ * Even if there are no users, we'll send Xbox One pads ++ * the startup sequence so they don't sit there and ++ * blink until somebody opens the input device again. ++ */ ++ retval = xpad_start_xbox_one(xpad); ++ } + mutex_unlock(&input->mutex); + } + +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-simplify-error-condition-in-init_output.patch b/queue-4.4/input-xpad-simplify-error-condition-in-init_output.patch new file mode 100644 index 00000000000..cfdc277d282 --- /dev/null +++ b/queue-4.4/input-xpad-simplify-error-condition-in-init_output.patch @@ -0,0 +1,57 @@ +From 9e466c687dee7f061dafb2c348b068657236ceff Mon Sep 17 00:00:00 2001 +From: Pavel Rojtberg +Date: Fri, 27 May 2016 16:26:33 -0700 +Subject: Input: xpad - simplify error condition in init_output + +[ Upstream commit a8c34e27fb1ece928ec728bfe596aa6ca0b1928a ] + +Replace first goto with simple returns as we really are just returning +one error code. + +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index b06f4b0785f7..d837900d609e 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -851,17 +851,15 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) + + xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, + GFP_KERNEL, &xpad->odata_dma); +- if (!xpad->odata) { +- error = -ENOMEM; +- goto fail1; +- } ++ if (!xpad->odata) ++ return -ENOMEM; + + spin_lock_init(&xpad->odata_lock); + + xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); + if (!xpad->irq_out) { + error = -ENOMEM; +- goto fail2; ++ goto err_free_coherent; + } + + /* Xbox One controller has in/out endpoints swapped. */ +@@ -877,8 +875,9 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) + + return 0; + +- fail2: usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); +- fail1: return error; ++err_free_coherent: ++ usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); ++ return error; + } + + static void xpad_stop_output(struct usb_xpad *xpad) +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-sort-supported-devices-by-usb-id.patch b/queue-4.4/input-xpad-sort-supported-devices-by-usb-id.patch new file mode 100644 index 00000000000..ee875215ae0 --- /dev/null +++ b/queue-4.4/input-xpad-sort-supported-devices-by-usb-id.patch @@ -0,0 +1,84 @@ +From 6328a8a91ba4d0754cc25fad0610478ee1c0ac34 Mon Sep 17 00:00:00 2001 +From: Benjamin Valentin +Date: Sun, 7 May 2017 14:45:08 -0700 +Subject: Input: xpad - sort supported devices by USB ID + +[ Upstream commit 873cb582738fde338ecaeaca594560cde2ba42c3 ] + +Some entries in the table of supported devices are out of order. +To not create a mess when adding new ones using a script, sort them first. + +Signed-off-by: Benjamin Valentin +Reviewed-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index df83fdc6c0e7..f600f6662063 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -126,19 +126,19 @@ static const struct xpad_device { + u8 mapping; + u8 xtype; + } xpad_device[] = { ++ { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, ++ { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 }, + { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, + { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX }, + { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX }, + { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, + { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, ++ { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, + { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, + { 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE }, + { 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0, XTYPE_XBOXONE }, +- { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, +- { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, +- { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 }, + { 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 }, + { 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360 }, + { 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 }, +@@ -180,10 +180,10 @@ static const struct xpad_device { + { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, +- { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, +@@ -209,8 +209,6 @@ static const struct xpad_device { + { 0x162e, 0xbeef, "Joytech Neo-Se Take2", 0, XTYPE_XBOX360 }, + { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 }, + { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 }, +- { 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE }, +- { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, +@@ -224,12 +222,14 @@ static const struct xpad_device { + { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE }, ++ { 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, + { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } + }; +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-support-some-quirky-xbox-one-pads.patch b/queue-4.4/input-xpad-support-some-quirky-xbox-one-pads.patch new file mode 100644 index 00000000000..8427f0d4b22 --- /dev/null +++ b/queue-4.4/input-xpad-support-some-quirky-xbox-one-pads.patch @@ -0,0 +1,193 @@ +From 6c2465f82c4551566b0da58be52f4c6968414d10 Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Mon, 10 Apr 2017 20:43:04 -0700 +Subject: Input: xpad - support some quirky Xbox One pads + +[ Upstream commit 81093c9848a781b85163d06de92ef8f84528cf6a ] + +There are several quirky Xbox One pads that depend on initialization +packets that the Microsoft pads don't require. To deal with these, +I've added a mechanism for issuing device-specific initialization +packets using a VID/PID-based quirks list. + +For the initial set of init quirks, I have added quirk handling from +Valve's Steam Link xpad driver[0] and the 360Controller project[1] for +macOS to enable some new pads to work properly. + +This should enable full functionality on the following quirky pads: +0x0e6f:0x0165 - Titanfall 2 gamepad (previously fully non-functional) +0x0f0d:0x0067 - Hori Horipad (analog sticks previously non-functional) +0x24c6:0x541a - PowerA Xbox One pad (previously fully non-functional) +0x24c6:0x542a - PowerA Xbox One pad (previously fully non-functional) +0x24c6:0x543a - PowerA Xbox One pad (previously fully non-functional) + +[0]: https://github.com/ValveSoftware/steamlink-sdk/blob/master/kernel/drivers/input/joystick/xpad.c +[1]: https://github.com/360Controller/360Controller + +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 114 ++++++++++++++++++++++++++++++---- + 1 file changed, 101 insertions(+), 13 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 153b1ee13e03..df83fdc6c0e7 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -339,6 +339,64 @@ static struct usb_device_id xpad_table[] = { + + MODULE_DEVICE_TABLE(usb, xpad_table); + ++struct xboxone_init_packet { ++ u16 idVendor; ++ u16 idProduct; ++ const u8 *data; ++ u8 len; ++}; ++ ++#define XBOXONE_INIT_PKT(_vid, _pid, _data) \ ++ { \ ++ .idVendor = (_vid), \ ++ .idProduct = (_pid), \ ++ .data = (_data), \ ++ .len = ARRAY_SIZE(_data), \ ++ } ++ ++ ++/* ++ * This packet is required for all Xbox One pads with 2015 ++ * or later firmware installed (or present from the factory). ++ */ ++static const u8 xboxone_fw2015_init[] = { ++ 0x05, 0x20, 0x00, 0x01, 0x00 ++}; ++ ++/* ++ * This packet is required for the Titanfall 2 Xbox One pads ++ * (0x0e6f:0x0165) to finish initialization and for Hori pads ++ * (0x0f0d:0x0067) to make the analog sticks work. ++ */ ++static const u8 xboxone_hori_init[] = { ++ 0x01, 0x20, 0x00, 0x09, 0x00, 0x04, 0x20, 0x3a, ++ 0x00, 0x00, 0x00, 0x80, 0x00 ++}; ++ ++/* ++ * A rumble packet is required for some PowerA pads to start ++ * sending input reports. One of those pads is (0x24c6:0x543a). ++ */ ++static const u8 xboxone_zerorumble_init[] = { ++ 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00 ++}; ++ ++/* ++ * This specifies the selection of init packets that a gamepad ++ * will be sent on init *and* the order in which they will be ++ * sent. The correct sequence number will be added when the ++ * packet is going to be sent. ++ */ ++static const struct xboxone_init_packet xboxone_init_packets[] = { ++ XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init), ++ XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init), ++ XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_zerorumble_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_zerorumble_init), ++ XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_zerorumble_init), ++}; ++ + struct xpad_output_packet { + u8 data[XPAD_PKT_LEN]; + u8 len; +@@ -375,6 +433,7 @@ struct usb_xpad { + + struct xpad_output_packet out_packets[XPAD_NUM_OUT_PACKETS]; + int last_out_packet; ++ int init_seq; + + #if defined(CONFIG_JOYSTICK_XPAD_LEDS) + struct xpad_led *led; +@@ -749,12 +808,48 @@ exit: + __func__, retval); + } + ++/* Callers must hold xpad->odata_lock spinlock */ ++static bool xpad_prepare_next_init_packet(struct usb_xpad *xpad) ++{ ++ const struct xboxone_init_packet *init_packet; ++ ++ if (xpad->xtype != XTYPE_XBOXONE) ++ return false; ++ ++ /* Perform initialization sequence for Xbox One pads that require it */ ++ while (xpad->init_seq < ARRAY_SIZE(xboxone_init_packets)) { ++ init_packet = &xboxone_init_packets[xpad->init_seq++]; ++ ++ if (init_packet->idVendor != 0 && ++ init_packet->idVendor != xpad->dev->id.vendor) ++ continue; ++ ++ if (init_packet->idProduct != 0 && ++ init_packet->idProduct != xpad->dev->id.product) ++ continue; ++ ++ /* This packet applies to our device, so prepare to send it */ ++ memcpy(xpad->odata, init_packet->data, init_packet->len); ++ xpad->irq_out->transfer_buffer_length = init_packet->len; ++ ++ /* Update packet with current sequence number */ ++ xpad->odata[2] = xpad->odata_serial++; ++ return true; ++ } ++ ++ return false; ++} ++ + /* Callers must hold xpad->odata_lock spinlock */ + static bool xpad_prepare_next_out_packet(struct usb_xpad *xpad) + { + struct xpad_output_packet *pkt, *packet = NULL; + int i; + ++ /* We may have init packets to send before we can send user commands */ ++ if (xpad_prepare_next_init_packet(xpad)) ++ return true; ++ + for (i = 0; i < XPAD_NUM_OUT_PACKETS; i++) { + if (++xpad->last_out_packet >= XPAD_NUM_OUT_PACKETS) + xpad->last_out_packet = 0; +@@ -940,24 +1035,17 @@ static int xpad_inquiry_pad_presence(struct usb_xpad *xpad) + + static int xpad_start_xbox_one(struct usb_xpad *xpad) + { +- struct xpad_output_packet *packet = +- &xpad->out_packets[XPAD_OUT_CMD_IDX]; + unsigned long flags; + int retval; + + spin_lock_irqsave(&xpad->odata_lock, flags); + +- /* Xbox one controller needs to be initialized. */ +- packet->data[0] = 0x05; +- packet->data[1] = 0x20; +- packet->data[2] = xpad->odata_serial++; /* packet serial */ +- packet->data[3] = 0x01; /* rumble bit enable? */ +- packet->data[4] = 0x00; +- packet->len = 5; +- packet->pending = true; +- +- /* Reset the sequence so we send out start packet first */ +- xpad->last_out_packet = -1; ++ /* ++ * Begin the init sequence by attempting to send a packet. ++ * We will cycle through the init packet sequence before ++ * sending any packets from the output ring. ++ */ ++ xpad->init_seq = 0; + retval = xpad_try_sending_next_out_packet(xpad); + + spin_unlock_irqrestore(&xpad->odata_lock, flags); +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-sync-supported-devices-with-360controller.patch b/queue-4.4/input-xpad-sync-supported-devices-with-360controller.patch new file mode 100644 index 00000000000..802a9175ff3 --- /dev/null +++ b/queue-4.4/input-xpad-sync-supported-devices-with-360controller.patch @@ -0,0 +1,204 @@ +From e2970980e9b5a1ac9e12afcf4af9370f05a83aaf Mon Sep 17 00:00:00 2001 +From: Benjamin Valentin +Date: Sun, 18 Jun 2017 15:40:37 -0700 +Subject: Input: xpad - sync supported devices with 360Controller + +[ Upstream commit c225370e01b87d3c4ef40d98295ac0bb1e5a3116 ] + +360Controller [0] is an OpenSource driver for Xbox/Xbox360/XboxOne +controllers on macOS. + +It contains a couple device IDs unknown to the Linux driver, so I wrote a +small Python script [1] to extract them and feed them into my previous +script [2] to compare them with the IDs known to Linux. + +For most devices, this information is not really needed as xpad is able to +automatically detect the type of an unknown Xbox Controller at run-time. +I've therefore stripped all the generic/vague entries. + +I've excluded the Logitech G920, it's handled by a HID driver already. +I've also excluded the Scene It! Big Button IR, it's handled by an +out-of-tree driver. [3] + +[0] https://github.com/360Controller/360Controller +[1] http://codepad.org/v9GyLKMq +[2] http://codepad.org/qh7jclpD +[3] https://github.com/micolous/xbox360bb + +Reviewed-by: Cameron Gutman +Signed-off-by: Benjamin Valentin +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 57 +++++++++++++++++++++++++++++++++++ + 1 file changed, 57 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index def96cd2479b..b8d08f2296ff 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -131,8 +131,10 @@ static const struct xpad_device { + { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, + { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX }, + { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX }, ++ { 0x045e, 0x0288, "Microsoft Xbox Controller S v2", 0, XTYPE_XBOX }, + { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, + { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, ++ { 0x045e, 0x028f, "Microsoft X-Box 360 pad v2", 0, XTYPE_XBOX360 }, + { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, + { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, +@@ -145,6 +147,7 @@ static const struct xpad_device { + { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 }, + { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX }, + { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX }, ++ { 0x046d, 0xcaa3, "Logitech DriveFx Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x056e, 0x2004, "Elecom JC-U3613M", 0, XTYPE_XBOX360 }, + { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX }, + { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX }, +@@ -158,14 +161,19 @@ static const struct xpad_device { + { 0x0738, 0x4718, "Mad Catz Street Fighter IV FightStick SE", 0, XTYPE_XBOX360 }, + { 0x0738, 0x4726, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x0738, 0x4736, "Mad Catz MicroCon Gamepad", 0, XTYPE_XBOX360 }, + { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 }, ++ { 0x0738, 0x4758, "Mad Catz Arcade Game Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0738, 0x4a01, "Mad Catz FightStick TE 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, ++ { 0x0738, 0x9871, "Mad Catz Portable Drum", 0, XTYPE_XBOX360 }, + { 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 }, ++ { 0x0738, 0xb738, "Mad Catz MVC2TE Stick 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0738, 0xbeef, "Mad Catz JOYTECH NEO SE Advanced GamePad", XTYPE_XBOX360 }, + { 0x0738, 0xcb02, "Saitek Cyborg Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0738, 0xcb03, "Saitek P3200 Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x0738, 0xcb29, "Saitek Aviator Stick AV8R02", 0, XTYPE_XBOX360 }, + { 0x0738, 0xf738, "Super SFIV FightStick TE S", 0, XTYPE_XBOX360 }, + { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, + { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", DANCEPAD_MAP_CONFIG, XTYPE_XBOX }, +@@ -181,30 +189,52 @@ static const struct xpad_device { + { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x011f, "Rock Candy Gamepad Wired Controller", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x0131, "PDP EA Sports Controller", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x0133, "Xbox 360 Wired Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x013a, "PDP Xbox One Controller", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x0147, "PDP Marvel Xbox One Controller", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x015c, "PDP Xbox One Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x0161, "PDP Xbox One Controller", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x0162, "PDP Xbox One Controller", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x0163, "PDP Xbox One Controller", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x0164, "PDP Battlefield One", 0, XTYPE_XBOXONE }, ++ { 0x0e6f, 0x0165, "PDP Titanfall 2", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0413, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x0501, "PDP Xbox 360 Controller", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0xf900, "PDP Afterglow AX.1", 0, XTYPE_XBOX360 }, + { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, + { 0x0e8f, 0x3008, "Generic xbox control (dealextreme)", 0, XTYPE_XBOX }, + { 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 }, ++ { 0x0f0d, 0x000c, "Hori PadEX Turbo", 0, XTYPE_XBOX360 }, + { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x0f0d, 0x001b, "Hori Real Arcade Pro VX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, ++ { 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, + { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, + { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, ++ { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, + { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, ++ { 0x12ab, 0x0303, "Mortal Kombat Klassic FightStick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, + { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 }, + { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, ++ { 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 }, + { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, + { 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 }, ++ { 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE }, + { 0x15e4, 0x3f00, "Power A Mini Pro Elite", 0, XTYPE_XBOX360 }, + { 0x15e4, 0x3f0a, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, +@@ -215,22 +245,42 @@ static const struct xpad_device { + { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0x0130, "Ion Drum Rocker", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf018, "Mad Catz Street Fighter IV SE Fighting Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf019, "Mad Catz Brawlstick for Xbox 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf021, "Mad Cats Ghost Recon FS GamePad", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf025, "Mad Catz Call Of Duty", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf027, "Mad Catz FPS Pro", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf02e, "Mad Catz Fightpad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf039, "Mad Catz MvC2 TE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf03a, "Mad Catz SFxT Fightstick Pro", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf03d, "Street Fighter IV Arcade Stick TE - Chun Li", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf03e, "Mad Catz MLG FightStick TE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf03f, "Mad Catz FightStick SoulCaliber", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf042, "Mad Catz FightStick TES+", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf080, "Mad Catz FightStick TE2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf501, "HoriPad EX2 Turbo", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf502, "Hori Real Arcade Pro.VX SA", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf503, "Hori Fighting Stick VX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf504, "Hori Real Arcade Pro. EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf505, "Hori Fighting Stick EX2B", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf506, "Hori Real Arcade Pro.EX Premium VLX", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf900, "Harmonix Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf904, "PDP Versus Fighting Pad", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf906, "MortalKombat FightStick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xfa01, "MadCatz GamePad", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xfd00, "Razer Onza TE", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xfd01, "Razer Onza", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x530a, "Xbox 360 Pro EX Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x531a, "PowerA Pro Ex", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5397, "FUS1ON Tournament Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE }, +@@ -238,12 +288,18 @@ static const struct xpad_device { + { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x5502, "Hori Fighting Stick VX Alt", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x550e, "Hori Real Arcade Pro V Kai 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x24c6, 0x551a, "PowerA FUSION Pro Controller", 0, XTYPE_XBOXONE }, ++ { 0x24c6, 0x561a, "PowerA FUSION Controller", 0, XTYPE_XBOXONE }, ++ { 0x24c6, 0x5b00, "ThrustMaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, + { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } + }; +@@ -338,6 +394,7 @@ static struct usb_device_id xpad_table[] = { + XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ + XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ + XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ ++ XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ + XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ + XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-sync-supported-devices-with-xbcd.patch b/queue-4.4/input-xpad-sync-supported-devices-with-xbcd.patch new file mode 100644 index 00000000000..dbd4eb23745 --- /dev/null +++ b/queue-4.4/input-xpad-sync-supported-devices-with-xbcd.patch @@ -0,0 +1,147 @@ +From 421e6e24710efaa870871f7e88be449b6eab3d5b Mon Sep 17 00:00:00 2001 +From: Benjamin Valentin +Date: Sun, 18 Jun 2017 15:41:20 -0700 +Subject: Input: xpad - sync supported devices with XBCD + +[ Upstream commit be19788c73d382f66dd3fba3c5ccef59cf12a126 ] + +XBCD [0][1] is an OpenSource driver for Xbox controllers on Windows. +Later it also started supporting Xbox360 controllers (presumably before +the official Windows driver was released). + +It contains a couple device IDs unknown to the Linux driver, so I extracted +those from xbcd.inf and added them to our list. + +It has a special type for Wheels and I have the feeling they might need +some extra handling. They all have 'Wheel' in their name, so that +information is available for future improvements. + +[0] https://www.s-config.com/xbcd-original-xbox-controllers-win10/ +[1] http://www.redcl0ud.com/xbcd.html + +Reviewed-by: Cameron Gutman +Signed-off-by: Benjamin Valentin +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index b8d08f2296ff..298a6ba51411 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -126,7 +126,10 @@ static const struct xpad_device { + u8 mapping; + u8 xtype; + } xpad_device[] = { ++ { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, ++ { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX }, + { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, ++ { 0x044f, 0x0f10, "Thrustmaster Modena GT Wheel", 0, XTYPE_XBOX }, + { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 }, + { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, + { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX }, +@@ -147,16 +150,30 @@ static const struct xpad_device { + { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 }, + { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX }, + { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX }, ++ { 0x046d, 0xca8a, "Logitech Precision Vibration Feedback Wheel", 0, XTYPE_XBOX }, + { 0x046d, 0xcaa3, "Logitech DriveFx Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x056e, 0x2004, "Elecom JC-U3613M", 0, XTYPE_XBOX360 }, + { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX }, + { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX }, ++ { 0x05fe, 0x3030, "Chic Controller", 0, XTYPE_XBOX }, ++ { 0x05fe, 0x3031, "Chic Controller", 0, XTYPE_XBOX }, ++ { 0x062a, 0x0020, "Logic3 Xbox GamePad", 0, XTYPE_XBOX }, ++ { 0x062a, 0x0033, "Competition Pro Steering Wheel", 0, XTYPE_XBOX }, ++ { 0x06a3, 0x0200, "Saitek Racing Wheel", 0, XTYPE_XBOX }, ++ { 0x06a3, 0x0201, "Saitek Adrenalin", 0, XTYPE_XBOX }, ++ { 0x06a3, 0xf51a, "Saitek P3600", 0, XTYPE_XBOX360 }, ++ { 0x0738, 0x4506, "Mad Catz 4506 Wireless Controller", 0, XTYPE_XBOX }, + { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX }, ++ { 0x0738, 0x4520, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX }, + { 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX }, + { 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX }, ++ { 0x0738, 0x4530, "Mad Catz Universal MC2 Racing Wheel and Pedals", 0, XTYPE_XBOX }, + { 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX }, + { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, + { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX }, ++ { 0x0738, 0x4586, "Mad Catz MicroCon Wireless Controller", 0, XTYPE_XBOX }, ++ { 0x0738, 0x4588, "Mad Catz Blaster", 0, XTYPE_XBOX }, ++ { 0x0738, 0x45ff, "Mad Catz Beat Pad (w/ Handle)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, + { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x0738, 0x4718, "Mad Catz Street Fighter IV FightStick SE", 0, XTYPE_XBOX360 }, + { 0x0738, 0x4726, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, +@@ -164,6 +181,7 @@ static const struct xpad_device { + { 0x0738, 0x4736, "Mad Catz MicroCon Gamepad", 0, XTYPE_XBOX360 }, + { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 }, ++ { 0x0738, 0x4743, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, + { 0x0738, 0x4758, "Mad Catz Arcade Game Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0738, 0x4a01, "Mad Catz FightStick TE 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, +@@ -175,6 +193,9 @@ static const struct xpad_device { + { 0x0738, 0xcb03, "Saitek P3200 Rumble Pad - PC/Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0738, 0xcb29, "Saitek Aviator Stick AV8R02", 0, XTYPE_XBOX360 }, + { 0x0738, 0xf738, "Super SFIV FightStick TE S", 0, XTYPE_XBOX360 }, ++ { 0x07ff, 0xffff, "Mad Catz GamePad", 0, XTYPE_XBOX360 }, ++ { 0x0c12, 0x0005, "Intec wireless", 0, XTYPE_XBOX }, ++ { 0x0c12, 0x8801, "Nyko Xbox Controller", 0, XTYPE_XBOX }, + { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, + { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", DANCEPAD_MAP_CONFIG, XTYPE_XBOX }, + { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX }, +@@ -182,10 +203,13 @@ static const struct xpad_device { + { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, + { 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, + { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, ++ { 0x0e4c, 0x1103, "Radica Gamester Reflex", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX }, + { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX }, ++ { 0x0e4c, 0x3510, "Radica Gamester", 0, XTYPE_XBOX }, + { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX }, + { 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX }, + { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX }, ++ { 0x0e6f, 0x0008, "After Glow Pro Controller", 0, XTYPE_XBOX }, + { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x011f, "Rock Candy Gamepad Wired Controller", 0, XTYPE_XBOX360 }, +@@ -221,6 +245,7 @@ static const struct xpad_device { + { 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, + { 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, ++ { 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX }, + { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, + { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, + { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, +@@ -255,6 +280,8 @@ static const struct xpad_device { + { 0x1bad, 0xf027, "Mad Catz FPS Pro", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf02e, "Mad Catz Fightpad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf030, "Mad Catz Xbox 360 MC2 MicroCon Racing Wheel", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf036, "Mad Catz MicroCon GamePad Pro", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf039, "Mad Catz MvC2 TE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf03a, "Mad Catz SFxT Fightstick Pro", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, +@@ -300,6 +327,7 @@ static const struct xpad_device { + { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, + { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, + { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } + }; +@@ -387,9 +415,11 @@ static struct usb_device_id xpad_table[] = { + XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ + XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ + XPAD_XBOX360_VENDOR(0x056e), /* Elecom JC-U3613M */ ++ XPAD_XBOX360_VENDOR(0x06a3), /* Saitek P3600 */ + XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ + { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ + XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ ++ XPAD_XBOX360_VENDOR(0x07ff), /* Mad Catz GamePad */ + XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ + XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ + XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-sync-supported-devices-with-xboxdrv.patch b/queue-4.4/input-xpad-sync-supported-devices-with-xboxdrv.patch new file mode 100644 index 00000000000..997f99061c8 --- /dev/null +++ b/queue-4.4/input-xpad-sync-supported-devices-with-xboxdrv.patch @@ -0,0 +1,100 @@ +From b3dff9b0a24c6af43bc6ffa6485909c41aa8854e Mon Sep 17 00:00:00 2001 +From: Benjamin Valentin +Date: Sun, 7 May 2017 14:48:14 -0700 +Subject: Input: xpad - sync supported devices with xboxdrv + +[ Upstream commit 44bc722593201da43862b7200ee0b98155410b07 ] + +The userspace xboxdrv driver [0] contains some USB IDs unknown to the +kernel driver. I have created a simple script [1] to extract the missing +devices and add them to xpad. + +A quick google search confirmed that all the new devices called +Fightstick/pad are Arcade-type devices [2] where the +MAP_TRIGGERS_TO_BUTTONS option should apply. + +There are some similar devices in the existing device table where this +flag is not set, but I did refrain from changing those. + +[0] https://github.com/xboxdrv/xboxdrv/blob/stable/src/xpad_device.cpp +[1] http://codepad.org/CHV98BNH +[2] https://www.google.com/search?q=SFxT+Fightstick+Pro&tbm=isch + +Signed-off-by: Benjamin Valentin +Reviewed-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index f600f6662063..16338f0b004f 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -145,6 +145,7 @@ static const struct xpad_device { + { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 }, + { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX }, + { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX }, ++ { 0x056e, 0x2004, "Elecom JC-U3613M", 0, XTYPE_XBOX360 }, + { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX }, + { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX }, + { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX }, +@@ -179,6 +180,7 @@ static const struct xpad_device { + { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX }, + { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x011f, "Rock Candy Gamepad Wired Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, + { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, +@@ -186,6 +188,7 @@ static const struct xpad_device { + { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, + { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, ++ { 0x0e6f, 0x0413, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, + { 0x0e8f, 0x3008, "Generic xbox control (dealextreme)", 0, XTYPE_XBOX }, + { 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 }, +@@ -212,21 +215,30 @@ static const struct xpad_device { + { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, + { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf018, "Mad Catz Street Fighter IV SE Fighting Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf021, "Mad Cats Ghost Recon FS GamePad", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf023, "MLG Pro Circuit Controller (Xbox)", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf028, "Street Fighter IV FightPad", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf02e, "Mad Catz Fightpad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf038, "Street Fighter IV FightStick TE", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xf03a, "Mad Catz SFxT Fightstick Pro", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1bad, 0xf900, "Harmonix Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 }, ++ { 0x1bad, 0xfa01, "MadCatz GamePad", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x531a, "PowerA Pro Ex", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x5397, "FUS1ON Tournament Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5b02, "Thrustmaster, Inc. GPX Controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, +@@ -316,6 +328,7 @@ static struct usb_device_id xpad_table[] = { + XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ + XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ + XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ ++ XPAD_XBOX360_VENDOR(0x056e), /* Elecom JC-U3613M */ + XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ + { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ + XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-update-xbox-one-force-feedback-support.patch b/queue-4.4/input-xpad-update-xbox-one-force-feedback-support.patch new file mode 100644 index 00000000000..c97091c1830 --- /dev/null +++ b/queue-4.4/input-xpad-update-xbox-one-force-feedback-support.patch @@ -0,0 +1,75 @@ +From c824b89b8436db1a0f7f76a4c74e342819042d54 Mon Sep 17 00:00:00 2001 +From: "Pierre-Loup A. Griffais" +Date: Wed, 9 Dec 2015 13:40:37 -0800 +Subject: Input: xpad - update Xbox One Force Feedback Support + +[ Upstream commit 2a6d7527b35cf987260800807e328d167aef22ac ] + +There's apparently a serial number woven into both input and output +packets; neglecting to specify a valid serial number causes the controller +to ignore the rumble packets. + +The scale of the rumble was also apparently halved in the packets. + +The initialization packet had to be changed to allow force feedback to +work. + +see https://github.com/paroj/xpad/issues/7 for details. + +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 88de7b17bf7d..bfe94216621f 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -350,6 +350,7 @@ struct usb_xpad { + struct urb *irq_out; /* urb for interrupt out report */ + bool irq_out_active; /* we must not use an active URB */ + unsigned char *odata; /* output data */ ++ u8 odata_serial; /* serial number for xbox one protocol */ + dma_addr_t odata_dma; + spinlock_t odata_lock; + +@@ -925,7 +926,10 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad) + /* Xbox one controller needs to be initialized. */ + packet->data[0] = 0x05; + packet->data[1] = 0x20; +- packet->len = 2; ++ packet->data[2] = xpad->odata_serial++; /* packet serial */ ++ packet->data[3] = 0x01; /* rumble bit enable? */ ++ packet->data[4] = 0x00; ++ packet->len = 5; + packet->pending = true; + + /* Reset the sequence so we send out start packet first */ +@@ -1000,17 +1004,18 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect + case XTYPE_XBOXONE: + packet->data[0] = 0x09; /* activate rumble */ + packet->data[1] = 0x08; +- packet->data[2] = 0x00; ++ packet->data[2] = xpad->odata_serial++; + packet->data[3] = 0x08; /* continuous effect */ + packet->data[4] = 0x00; /* simple rumble mode */ + packet->data[5] = 0x03; /* L and R actuator only */ + packet->data[6] = 0x00; /* TODO: LT actuator */ + packet->data[7] = 0x00; /* TODO: RT actuator */ +- packet->data[8] = strong / 256; /* left actuator */ +- packet->data[9] = weak / 256; /* right actuator */ ++ packet->data[8] = strong / 512; /* left actuator */ ++ packet->data[9] = weak / 512; /* right actuator */ + packet->data[10] = 0x80; /* length of pulse */ + packet->data[11] = 0x00; /* stop period of pulse */ +- packet->len = 12; ++ packet->data[12] = 0x00; ++ packet->len = 13; + packet->pending = true; + break; + +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-use-led-api-when-identifying-wireless-con.patch b/queue-4.4/input-xpad-use-led-api-when-identifying-wireless-con.patch new file mode 100644 index 00000000000..66f88947736 --- /dev/null +++ b/queue-4.4/input-xpad-use-led-api-when-identifying-wireless-con.patch @@ -0,0 +1,34 @@ +From 990a40a8436ddd4b989869b6454682f13671ea8c Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Wed, 16 Dec 2015 14:24:58 -0800 +Subject: Input: xpad - use LED API when identifying wireless controllers + +[ Upstream commit d9be398afb2c3333716324352d062c50112e4e86 ] + +When lighting up the segment identifying wireless controller, Instead of +sending command directly to the controller, let's do it via LED API (usinf +led_set_brightness) so that LED object state is in sync with controller +state and we'll light up the correct segment on resume as well. + +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 0caced4a68cc..c3a38804cdc0 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -1142,7 +1142,7 @@ static void xpad_send_led_command(struct usb_xpad *xpad, int command) + */ + static void xpad_identify_controller(struct usb_xpad *xpad) + { +- xpad_send_led_command(xpad, (xpad->pad_nr % 4) + 2); ++ led_set_brightness(&xpad->led->led_cdev, (xpad->pad_nr % 4) + 2); + } + + static void xpad_led_set(struct led_classdev *led_cdev, +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-validate-usb-endpoint-type-during-probe.patch b/queue-4.4/input-xpad-validate-usb-endpoint-type-during-probe.patch new file mode 100644 index 00000000000..40815e590b0 --- /dev/null +++ b/queue-4.4/input-xpad-validate-usb-endpoint-type-during-probe.patch @@ -0,0 +1,45 @@ +From b00595f3e2403fa47f9fb36b0228c11f5eaf752b Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Tue, 12 Sep 2017 11:27:44 -0700 +Subject: Input: xpad - validate USB endpoint type during probe + +[ Upstream commit 122d6a347329818419b032c5a1776e6b3866d9b9 ] + +We should only see devices with interrupt endpoints. Ignore any other +endpoints that we find, so we don't send try to send them interrupt URBs +and trigger a WARN down in the USB stack. + +Reported-by: Andrey Konovalov +Tested-by: Andrey Konovalov +Cc: # c01b5e7464f0 Input: xpad - don't depend on endpoint order +Signed-off-by: Cameron Gutman +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index f8e34ef643c7..d86e59515b9c 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -1764,10 +1764,12 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + struct usb_endpoint_descriptor *ep = + &intf->cur_altsetting->endpoint[i].desc; + +- if (usb_endpoint_dir_in(ep)) +- ep_irq_in = ep; +- else +- ep_irq_out = ep; ++ if (usb_endpoint_xfer_int(ep)) { ++ if (usb_endpoint_dir_in(ep)) ++ ep_irq_in = ep; ++ else ++ ep_irq_out = ep; ++ } + } + + if (!ep_irq_in || !ep_irq_out) { +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-workaround-dead-irq_out-after-suspend-res.patch b/queue-4.4/input-xpad-workaround-dead-irq_out-after-suspend-res.patch new file mode 100644 index 00000000000..ccdc1964a53 --- /dev/null +++ b/queue-4.4/input-xpad-workaround-dead-irq_out-after-suspend-res.patch @@ -0,0 +1,331 @@ +From 39da46167401c6329709628510f5c85e79a088c9 Mon Sep 17 00:00:00 2001 +From: Pavel Rojtberg +Date: Wed, 9 Dec 2015 13:30:34 -0800 +Subject: Input: xpad - workaround dead irq_out after suspend/ resume + +[ Upstream commit 4220f7db1e424f2a086ad41217b5770cc9f003a9 ] + +The irq_out urb is dead after suspend/ resume on my x360 wr pad. (also +reproduced by Zachary Lund [0]) Work around this by implementing +suspend, resume, and reset_resume callbacks and properly shutting down +URBs on suspend and restarting them on resume. + +[0]: https://github.com/paroj/xpad/issues/6 + +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 175 ++++++++++++++++++++++++++-------- + 1 file changed, 137 insertions(+), 38 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index bfe94216621f..0caced4a68cc 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -82,6 +82,7 @@ + #include + #include + #include ++#include + + #define DRIVER_AUTHOR "Marko Friedemann " + #define DRIVER_DESC "X-Box pad driver" +@@ -348,9 +349,10 @@ struct usb_xpad { + dma_addr_t idata_dma; + + struct urb *irq_out; /* urb for interrupt out report */ ++ struct usb_anchor irq_out_anchor; + bool irq_out_active; /* we must not use an active URB */ +- unsigned char *odata; /* output data */ + u8 odata_serial; /* serial number for xbox one protocol */ ++ unsigned char *odata; /* output data */ + dma_addr_t odata_dma; + spinlock_t odata_lock; + +@@ -767,11 +769,13 @@ static int xpad_try_sending_next_out_packet(struct usb_xpad *xpad) + int error; + + if (!xpad->irq_out_active && xpad_prepare_next_out_packet(xpad)) { ++ usb_anchor_urb(xpad->irq_out, &xpad->irq_out_anchor); + error = usb_submit_urb(xpad->irq_out, GFP_ATOMIC); + if (error) { + dev_err(&xpad->intf->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, error); ++ usb_unanchor_urb(xpad->irq_out); + return -EIO; + } + +@@ -813,11 +817,13 @@ static void xpad_irq_out(struct urb *urb) + } + + if (xpad->irq_out_active) { ++ usb_anchor_urb(urb, &xpad->irq_out_anchor); + error = usb_submit_urb(urb, GFP_ATOMIC); + if (error) { + dev_err(dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, error); ++ usb_unanchor_urb(urb); + xpad->irq_out_active = false; + } + } +@@ -834,6 +840,8 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) + if (xpad->xtype == XTYPE_UNKNOWN) + return 0; + ++ init_usb_anchor(&xpad->irq_out_anchor); ++ + xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, + GFP_KERNEL, &xpad->odata_dma); + if (!xpad->odata) { +@@ -868,8 +876,14 @@ 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_UNKNOWN) +- usb_kill_urb(xpad->irq_out); ++ if (xpad->xtype != XTYPE_UNKNOWN) { ++ if (!usb_wait_anchor_empty_timeout(&xpad->irq_out_anchor, ++ 5000)) { ++ dev_warn(&xpad->intf->dev, ++ "timed out waiting for output URB to complete, killing\n"); ++ usb_kill_anchored_urbs(&xpad->irq_out_anchor); ++ } ++ } + } + + static void xpad_deinit_output(struct usb_xpad *xpad) +@@ -1198,32 +1212,73 @@ static void xpad_led_disconnect(struct usb_xpad *xpad) { } + static void xpad_identify_controller(struct usb_xpad *xpad) { } + #endif + +-static int xpad_open(struct input_dev *dev) ++static int xpad_start_input(struct usb_xpad *xpad) + { +- struct usb_xpad *xpad = input_get_drvdata(dev); +- +- /* URB was submitted in probe */ +- if (xpad->xtype == XTYPE_XBOX360W) +- return 0; ++ int error; + +- xpad->irq_in->dev = xpad->udev; + if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) + return -EIO; + +- if (xpad->xtype == XTYPE_XBOXONE) +- return xpad_start_xbox_one(xpad); ++ if (xpad->xtype == XTYPE_XBOXONE) { ++ error = xpad_start_xbox_one(xpad); ++ if (error) { ++ usb_kill_urb(xpad->irq_in); ++ return error; ++ } ++ } + + return 0; + } + +-static void xpad_close(struct input_dev *dev) ++static void xpad_stop_input(struct usb_xpad *xpad) + { +- struct usb_xpad *xpad = input_get_drvdata(dev); ++ usb_kill_urb(xpad->irq_in); ++} ++ ++static int xpad360w_start_input(struct usb_xpad *xpad) ++{ ++ int error; ++ ++ error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); ++ if (error) ++ return -EIO; + +- if (xpad->xtype != XTYPE_XBOX360W) ++ /* ++ * Send presence packet. ++ * This will force the controller to resend connection packets. ++ * This is useful in the case we activate the module after the ++ * adapter has been plugged in, as it won't automatically ++ * send us info about the controllers. ++ */ ++ error = xpad_inquiry_pad_presence(xpad); ++ if (error) { + usb_kill_urb(xpad->irq_in); ++ return error; ++ } + +- xpad_stop_output(xpad); ++ return 0; ++} ++ ++static void xpad360w_stop_input(struct usb_xpad *xpad) ++{ ++ usb_kill_urb(xpad->irq_in); ++ ++ /* Make sure we are done with presence work if it was scheduled */ ++ flush_work(&xpad->work); ++} ++ ++static int xpad_open(struct input_dev *dev) ++{ ++ struct usb_xpad *xpad = input_get_drvdata(dev); ++ ++ return xpad_start_input(xpad); ++} ++ ++static void xpad_close(struct input_dev *dev) ++{ ++ struct usb_xpad *xpad = input_get_drvdata(dev); ++ ++ xpad_stop_input(xpad); + } + + static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) +@@ -1284,8 +1339,10 @@ static int xpad_init_input(struct usb_xpad *xpad) + + input_set_drvdata(input_dev, xpad); + +- input_dev->open = xpad_open; +- input_dev->close = xpad_close; ++ if (xpad->xtype != XTYPE_XBOX360W) { ++ input_dev->open = xpad_open; ++ input_dev->close = xpad_close; ++ } + + __set_bit(EV_KEY, input_dev->evbit); + +@@ -1459,21 +1516,17 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + * exactly the message that a controller has arrived that + * we're waiting for. + */ +- xpad->irq_in->dev = xpad->udev; +- error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); ++ error = xpad360w_start_input(xpad); + if (error) + goto err_deinit_output; +- + /* +- * Send presence packet. +- * This will force the controller to resend connection packets. +- * This is useful in the case we activate the module after the +- * adapter has been plugged in, as it won't automatically +- * send us info about the controllers. ++ * Wireless controllers require RESET_RESUME to work properly ++ * after suspend. Ideally this quirk should be in usb core ++ * quirk list, but we have too many vendors producing these ++ * controllers and we'd need to maintain 2 identical lists ++ * here in this driver and in usb core. + */ +- error = xpad_inquiry_pad_presence(xpad); +- if (error) +- goto err_kill_in_urb; ++ udev->quirks |= USB_QUIRK_RESET_RESUME; + } else { + error = xpad_init_input(xpad); + if (error) +@@ -1481,8 +1534,6 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + } + return 0; + +-err_kill_in_urb: +- usb_kill_urb(xpad->irq_in); + err_deinit_output: + xpad_deinit_output(xpad); + err_free_in_urb: +@@ -1492,35 +1543,83 @@ err_free_idata: + err_free_mem: + kfree(xpad); + return error; +- + } + + static void xpad_disconnect(struct usb_interface *intf) + { +- struct usb_xpad *xpad = usb_get_intfdata (intf); ++ struct usb_xpad *xpad = usb_get_intfdata(intf); + + if (xpad->xtype == XTYPE_XBOX360W) +- usb_kill_urb(xpad->irq_in); +- +- cancel_work_sync(&xpad->work); ++ xpad360w_stop_input(xpad); + + xpad_deinit_input(xpad); + ++ /* ++ * Now that both input device and LED device are gone we can ++ * stop output URB. ++ */ ++ xpad_stop_output(xpad); ++ ++ xpad_deinit_output(xpad); ++ + usb_free_urb(xpad->irq_in); + usb_free_coherent(xpad->udev, XPAD_PKT_LEN, + xpad->idata, xpad->idata_dma); + +- xpad_deinit_output(xpad); +- + kfree(xpad); + + usb_set_intfdata(intf, NULL); + } + ++static int xpad_suspend(struct usb_interface *intf, pm_message_t message) ++{ ++ struct usb_xpad *xpad = usb_get_intfdata(intf); ++ struct input_dev *input = xpad->dev; ++ ++ if (xpad->xtype == XTYPE_XBOX360W) { ++ /* ++ * Wireless controllers always listen to input so ++ * they are notified when controller shows up ++ * or goes away. ++ */ ++ xpad360w_stop_input(xpad); ++ } else { ++ mutex_lock(&input->mutex); ++ if (input->users) ++ xpad_stop_input(xpad); ++ mutex_unlock(&input->mutex); ++ } ++ ++ xpad_stop_output(xpad); ++ ++ return 0; ++} ++ ++static int xpad_resume(struct usb_interface *intf) ++{ ++ struct usb_xpad *xpad = usb_get_intfdata(intf); ++ struct input_dev *input = xpad->dev; ++ int retval = 0; ++ ++ if (xpad->xtype == XTYPE_XBOX360W) { ++ retval = xpad360w_start_input(xpad); ++ } else { ++ mutex_lock(&input->mutex); ++ if (input->users) ++ retval = xpad_start_input(xpad); ++ mutex_unlock(&input->mutex); ++ } ++ ++ return retval; ++} ++ + static struct usb_driver xpad_driver = { + .name = "xpad", + .probe = xpad_probe, + .disconnect = xpad_disconnect, ++ .suspend = xpad_suspend, ++ .resume = xpad_resume, ++ .reset_resume = xpad_resume, + .id_table = xpad_table, + }; + +-- +2.17.1 + diff --git a/queue-4.4/input-xpad-xbox-one-elite-controller-support.patch b/queue-4.4/input-xpad-xbox-one-elite-controller-support.patch new file mode 100644 index 00000000000..ca98bd1e205 --- /dev/null +++ b/queue-4.4/input-xpad-xbox-one-elite-controller-support.patch @@ -0,0 +1,46 @@ +From 8896022802532cb696d244706b0f23bc5a54feb8 Mon Sep 17 00:00:00 2001 +From: Pavel Rojtberg +Date: Fri, 27 May 2016 16:24:40 -0700 +Subject: Input: xpad - xbox one elite controller support + +[ Upstream commit 6f49a398b266d4895bd7e041db77a2b2ee1482a6 ] + +added the according id and incresed XPAD_PKT_LEN to 64 as the elite +controller sends at least 33 byte messages [1]. +Verified to be working by [2]. + +[1]: https://franticrain.github.io/sniffs/XboxOneSniff.html +[2]: https://github.com/paroj/xpad/issues/23 + +Signed-off-by: Pierre-Loup A. Griffais +Signed-off-by: Pavel Rojtberg +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/joystick/xpad.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index c8897fc3202c..dcf9053a801e 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -87,7 +87,7 @@ + #define DRIVER_AUTHOR "Marko Friedemann " + #define DRIVER_DESC "X-Box pad driver" + +-#define XPAD_PKT_LEN 32 ++#define XPAD_PKT_LEN 64 + + /* xbox d-pads should map to buttons, as is required for DDR pads + but we map them to axes when possible to simplify things */ +@@ -129,6 +129,7 @@ static const struct xpad_device { + { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, + { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, + { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, ++ { 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE }, + { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, + { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, +-- +2.17.1 + diff --git a/queue-4.4/series b/queue-4.4/series index 17346812415..b463d500f34 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -29,3 +29,40 @@ x86-entry-spell-ebx-register-correctly-in-documentat.patch x86-entry-64-remove-ebx-handling-from-error_entry-ex.patch arm64-remove-no-op-p-linker-flag.patch ath10k-fix-kernel-panic-due-to-race-in-accessing-arvif-list.patch +input-xpad-remove-spurious-events-of-wireless-xpad-3.patch +input-xpad-handle-present-and-gone-correctly.patch +input-xpad-update-xbox-one-force-feedback-support.patch +input-xpad-workaround-dead-irq_out-after-suspend-res.patch +input-xpad-use-led-api-when-identifying-wireless-con.patch +input-xpad-correct-xbox-one-pad-device-name.patch +input-xpad-remove-unused-function.patch +input-xpad-add-mad-catz-fightstick-te-2-vid-pid.patch +input-xpad-prevent-spurious-input-from-wired-xbox-36.patch +input-xpad-add-more-third-party-controllers.patch +input-xpad-xbox-one-elite-controller-support.patch +input-xpad-fix-rumble-on-xbox-one-controllers-with-2.patch +input-xpad-power-off-wireless-360-controllers-on-sus.patch +input-xpad-add-product-id-for-xbox-one-s-pad.patch +input-xpad-fix-xbox-one-rumble-stopping-after-2.5-se.patch +input-xpad-correctly-sort-vendor-id-s.patch +input-xpad-move-reporting-xbox-one-home-button-to-co.patch +input-xpad-simplify-error-condition-in-init_output.patch +input-xpad-don-t-depend-on-endpoint-order.patch +input-xpad-fix-stuck-mode-button-on-xbox-one-s-pad.patch +input-xpad-restore-led-state-after-device-resume.patch +input-xpad-support-some-quirky-xbox-one-pads.patch +input-xpad-sort-supported-devices-by-usb-id.patch +input-xpad-sync-supported-devices-with-xboxdrv.patch +input-xpad-add-usb-ids-for-mad-catz-brawlstick-and-r.patch +input-xpad-sync-supported-devices-with-360controller.patch +input-xpad-sync-supported-devices-with-xbcd.patch +input-xpad-constify-usb_device_id.patch +input-xpad-fix-powera-init-quirk-for-some-gamepad-mo.patch +input-xpad-validate-usb-endpoint-type-during-probe.patch +input-xpad-add-support-for-pdp-xbox-one-controllers.patch +input-xpad-add-pdp-device-id-0x02a4.patch +input-xpad-fix-some-coding-style-issues.patch +input-xpad-avoid-using-__set_bit-for-capabilities.patch +input-xpad-add-gpd-win-2-controller-usb-ids.patch +input-xpad-fix-gpd-win-2-controller-name.patch +input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch