From: Sasha Levin Date: Thu, 29 Nov 2018 09:06:05 +0000 (-0500) Subject: xpad fixes and quirks for 4.9 X-Git-Tag: v4.19.6~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ad67a25743a5d02ee3c9b0c15c4db3e9cb18935;p=thirdparty%2Fkernel%2Fstable-queue.git xpad fixes and quirks for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/input-xpad-add-gpd-win-2-controller-usb-ids.patch b/queue-4.9/input-xpad-add-gpd-win-2-controller-usb-ids.patch new file mode 100644 index 00000000000..69605d72aed --- /dev/null +++ b/queue-4.9/input-xpad-add-gpd-win-2-controller-usb-ids.patch @@ -0,0 +1,42 @@ +From d0a87d166b08840e4c52bc57034ca585e4d32125 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.9/input-xpad-add-pdp-device-id-0x02a4.patch b/queue-4.9/input-xpad-add-pdp-device-id-0x02a4.patch new file mode 100644 index 00000000000..530e5908113 --- /dev/null +++ b/queue-4.9/input-xpad-add-pdp-device-id-0x02a4.patch @@ -0,0 +1,62 @@ +From e41002590af0b596f4ce11ac48cc4531ae4b3173 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.9/input-xpad-add-product-id-for-xbox-one-s-pad.patch b/queue-4.9/input-xpad-add-product-id-for-xbox-one-s-pad.patch new file mode 100644 index 00000000000..4655858f00e --- /dev/null +++ b/queue-4.9/input-xpad-add-product-id-for-xbox-one-s-pad.patch @@ -0,0 +1,32 @@ +From 810eb657f4016ef2f3c99aafd2527c6bb524b432 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.9/input-xpad-add-support-for-pdp-xbox-one-controllers.patch b/queue-4.9/input-xpad-add-support-for-pdp-xbox-one-controllers.patch new file mode 100644 index 00000000000..56c42e964ed --- /dev/null +++ b/queue-4.9/input-xpad-add-support-for-pdp-xbox-one-controllers.patch @@ -0,0 +1,68 @@ +From c52396fe49dfc7d45daf089eeb0a0ff211f5722f 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.9/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch b/queue-4.9/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch new file mode 100644 index 00000000000..3408988f05d --- /dev/null +++ b/queue-4.9/input-xpad-add-support-for-xbox1-pdp-camo-series-gam.patch @@ -0,0 +1,48 @@ +From 6ea672637c0faa61e88ce32db21d8bbe4e634a5b 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.9/input-xpad-add-usb-ids-for-mad-catz-brawlstick-and-r.patch b/queue-4.9/input-xpad-add-usb-ids-for-mad-catz-brawlstick-and-r.patch new file mode 100644 index 00000000000..f73d34fa43b --- /dev/null +++ b/queue-4.9/input-xpad-add-usb-ids-for-mad-catz-brawlstick-and-r.patch @@ -0,0 +1,43 @@ +From 33117d31169a739327d6aeb33bdea765ee380247 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.9/input-xpad-avoid-using-__set_bit-for-capabilities.patch b/queue-4.9/input-xpad-avoid-using-__set_bit-for-capabilities.patch new file mode 100644 index 00000000000..c04bbea6d65 --- /dev/null +++ b/queue-4.9/input-xpad-avoid-using-__set_bit-for-capabilities.patch @@ -0,0 +1,90 @@ +From 0949c1185c41e5e9a61ed575998ad0d16929027b 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.9/input-xpad-constify-usb_device_id.patch b/queue-4.9/input-xpad-constify-usb_device_id.patch new file mode 100644 index 00000000000..319cd49d0ca --- /dev/null +++ b/queue-4.9/input-xpad-constify-usb_device_id.patch @@ -0,0 +1,34 @@ +From 86d0d57968f926cb38bce2474025357da43e791e 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.9/input-xpad-correctly-sort-vendor-id-s.patch b/queue-4.9/input-xpad-correctly-sort-vendor-id-s.patch new file mode 100644 index 00000000000..72c9acb7b37 --- /dev/null +++ b/queue-4.9/input-xpad-correctly-sort-vendor-id-s.patch @@ -0,0 +1,48 @@ +From aa3d2ce47ffd1f7323e0ffa093126358798b03d2 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.9/input-xpad-don-t-depend-on-endpoint-order.patch b/queue-4.9/input-xpad-don-t-depend-on-endpoint-order.patch new file mode 100644 index 00000000000..b148de8d136 --- /dev/null +++ b/queue-4.9/input-xpad-don-t-depend-on-endpoint-order.patch @@ -0,0 +1,96 @@ +From 19d4ab00a98d086aabef644f4b0a190dd430a259 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.9/input-xpad-fix-gpd-win-2-controller-name.patch b/queue-4.9/input-xpad-fix-gpd-win-2-controller-name.patch new file mode 100644 index 00000000000..efcae2a8253 --- /dev/null +++ b/queue-4.9/input-xpad-fix-gpd-win-2-controller-name.patch @@ -0,0 +1,42 @@ +From 6769ad00cb8b8c0a0a96cb1376d70ac790c0a0ff 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.9/input-xpad-fix-powera-init-quirk-for-some-gamepad-mo.patch b/queue-4.9/input-xpad-fix-powera-init-quirk-for-some-gamepad-mo.patch new file mode 100644 index 00000000000..2d188110923 --- /dev/null +++ b/queue-4.9/input-xpad-fix-powera-init-quirk-for-some-gamepad-mo.patch @@ -0,0 +1,84 @@ +From 3c97e8094594feb51bd3ba45f88eadfcd582a6ce 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.9/input-xpad-fix-some-coding-style-issues.patch b/queue-4.9/input-xpad-fix-some-coding-style-issues.patch new file mode 100644 index 00000000000..10a98457566 --- /dev/null +++ b/queue-4.9/input-xpad-fix-some-coding-style-issues.patch @@ -0,0 +1,73 @@ +From d24c8407ac2cdb194147dbe7c3e17d943443c76c 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.9/input-xpad-fix-stuck-mode-button-on-xbox-one-s-pad.patch b/queue-4.9/input-xpad-fix-stuck-mode-button-on-xbox-one-s-pad.patch new file mode 100644 index 00000000000..37ec5baccd6 --- /dev/null +++ b/queue-4.9/input-xpad-fix-stuck-mode-button-on-xbox-one-s-pad.patch @@ -0,0 +1,79 @@ +From 0641ce7ddfba06ad46d56b41620e1d9528b328c6 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.9/input-xpad-fix-xbox-one-rumble-stopping-after-2.5-se.patch b/queue-4.9/input-xpad-fix-xbox-one-rumble-stopping-after-2.5-se.patch new file mode 100644 index 00000000000..eb0981c33e9 --- /dev/null +++ b/queue-4.9/input-xpad-fix-xbox-one-rumble-stopping-after-2.5-se.patch @@ -0,0 +1,51 @@ +From 4dbb044beb70d88aee328a62fd9428fd897cc49a 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.9/input-xpad-move-reporting-xbox-one-home-button-to-co.patch b/queue-4.9/input-xpad-move-reporting-xbox-one-home-button-to-co.patch new file mode 100644 index 00000000000..6a88ceacb21 --- /dev/null +++ b/queue-4.9/input-xpad-move-reporting-xbox-one-home-button-to-co.patch @@ -0,0 +1,92 @@ +From 811eadddf7aec0f1f1537497d1097d33ab7287d2 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.9/input-xpad-restore-led-state-after-device-resume.patch b/queue-4.9/input-xpad-restore-led-state-after-device-resume.patch new file mode 100644 index 00000000000..56054168c36 --- /dev/null +++ b/queue-4.9/input-xpad-restore-led-state-after-device-resume.patch @@ -0,0 +1,53 @@ +From 88969cbb443d6133bbc322911510926e11f3d006 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.9/input-xpad-simplify-error-condition-in-init_output.patch b/queue-4.9/input-xpad-simplify-error-condition-in-init_output.patch new file mode 100644 index 00000000000..9a536c708a0 --- /dev/null +++ b/queue-4.9/input-xpad-simplify-error-condition-in-init_output.patch @@ -0,0 +1,57 @@ +From 531e9943b034c687dbea415b971a3698119388ef 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.9/input-xpad-sort-supported-devices-by-usb-id.patch b/queue-4.9/input-xpad-sort-supported-devices-by-usb-id.patch new file mode 100644 index 00000000000..63ba3e8afd6 --- /dev/null +++ b/queue-4.9/input-xpad-sort-supported-devices-by-usb-id.patch @@ -0,0 +1,84 @@ +From 919d311bcdc11db5c2941d9cd6d55f1dad43bdda 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.9/input-xpad-support-some-quirky-xbox-one-pads.patch b/queue-4.9/input-xpad-support-some-quirky-xbox-one-pads.patch new file mode 100644 index 00000000000..a0798b89dcc --- /dev/null +++ b/queue-4.9/input-xpad-support-some-quirky-xbox-one-pads.patch @@ -0,0 +1,193 @@ +From 6887f49bf426bcff64f38e395c7161ca5be583ed 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.9/input-xpad-sync-supported-devices-with-360controller.patch b/queue-4.9/input-xpad-sync-supported-devices-with-360controller.patch new file mode 100644 index 00000000000..1fa5ae88df7 --- /dev/null +++ b/queue-4.9/input-xpad-sync-supported-devices-with-360controller.patch @@ -0,0 +1,204 @@ +From 5b49ffbf999fdc69893948ff10ff5d5a2167c2ff 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.9/input-xpad-sync-supported-devices-with-xbcd.patch b/queue-4.9/input-xpad-sync-supported-devices-with-xbcd.patch new file mode 100644 index 00000000000..e69c0a3d5a6 --- /dev/null +++ b/queue-4.9/input-xpad-sync-supported-devices-with-xbcd.patch @@ -0,0 +1,147 @@ +From 12d5d6d6e9e08eb0b6a86d57cb7f4330d4ab93e5 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.9/input-xpad-sync-supported-devices-with-xboxdrv.patch b/queue-4.9/input-xpad-sync-supported-devices-with-xboxdrv.patch new file mode 100644 index 00000000000..d1b80077dee --- /dev/null +++ b/queue-4.9/input-xpad-sync-supported-devices-with-xboxdrv.patch @@ -0,0 +1,100 @@ +From 014574b6336066cab5b8b5388f812962292a3f11 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.9/input-xpad-validate-usb-endpoint-type-during-probe.patch b/queue-4.9/input-xpad-validate-usb-endpoint-type-during-probe.patch new file mode 100644 index 00000000000..c11d55f538d --- /dev/null +++ b/queue-4.9/input-xpad-validate-usb-endpoint-type-during-probe.patch @@ -0,0 +1,45 @@ +From a75da4c4357b8c18849068e33c801414a111e648 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.9/series b/queue-4.9/series index 1494b5f5360..c115e4d06f3 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -43,3 +43,27 @@ nfc-nfcmrvl_uart-fix-of-child-node-lookup.patch net-bcmgenet-fix-of-child-node-lookup.patch arm64-remove-no-op-p-linker-flag.patch ath10k-fix-kernel-panic-due-to-race-in-accessing-arvif-list.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