From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:33221 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751089AbcFDTQL (ORCPT ); Sat, 4 Jun 2016 15:16:11 -0400 Subject: Patch "Input: xpad - prevent spurious input from wired Xbox 360 controllers" has been added to the 4.5-stable tree To: aicommander@gmail.com, dmitry.torokhov@gmail.com, gregkh@linuxfoundation.org, rojtberg@gmail.com Cc: , From: Date: Sat, 04 Jun 2016 12:16:10 -0700 Message-ID: <1465067770151229@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled Input: xpad - prevent spurious input from wired Xbox 360 controllers to the 4.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: input-xpad-prevent-spurious-input-from-wired-xbox-360-controllers.patch and it can be found in the queue-4.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 1ff5fa3c6732f08e01ae12f12286d4728c9e4d86 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 From: Cameron Gutman commit 1ff5fa3c6732f08e01ae12f12286d4728c9e4d86 upstream. 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 Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -455,6 +455,10 @@ static void xpad_process_packet(struct u 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) */ Patches currently in stable-queue which might be from aicommander@gmail.com are queue-4.5/input-xpad-prevent-spurious-input-from-wired-xbox-360-controllers.patch