From patchwork Sun Nov 22 16:35:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Cl=C3=A9ment_Calmels?= X-Patchwork-Id: 7676531 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 38DAA9F1C2 for ; Sun, 22 Nov 2015 16:36:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 67EA220416 for ; Sun, 22 Nov 2015 16:36:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5ED7C2038F for ; Sun, 22 Nov 2015 16:36:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752248AbbKVQfm (ORCPT ); Sun, 22 Nov 2015 11:35:42 -0500 Received: from smtp6-g21.free.fr ([212.27.42.6]:62420 "EHLO smtp6-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752229AbbKVQfm (ORCPT ); Sun, 22 Nov 2015 11:35:42 -0500 X-Greylist: delayed 565 seconds by postgrey-1.27 at vger.kernel.org; Sun, 22 Nov 2015 11:35:42 EST Received: from localhost.localdomain (unknown [82.224.70.102]) by smtp6-g21.free.fr (Postfix) with ESMTP id DBB07822F3; Sun, 22 Nov 2015 17:35:23 +0100 (CET) From: clement.calmels@free.fr To: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Clement Calmels Subject: [PATCH v2] Input: xpad - remove spurious events of wireless xpad 360 controller Date: Sun, 22 Nov 2015 17:35:39 +0100 Message-Id: <1448210139-6144-1-git-send-email-clement.calmels@free.fr> X-Mailer: git-send-email 2.6.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Clement Calmels When powering up a wireless xbox 360 controller, some wrong joystick events are generated. It is annoying because, for example, it makes unwanted moves in Steam big picture mode's menu. When my controller is powering up, this packet is received by the driver: 00000000: 00 0f 00 f0 00 cc ff cf 8b e0 86 6a 68 f0 00 20 ...........jh.. 00000010: 13 e3 20 1d 30 03 40 01 50 01 ff ff .. .0.@.P... According to xboxdrv userspace driver source code, this packet is only dumping a serial id and should not be interpreted as joystick events. This issue can be easily seen with jstest: $ jstest --event /dev/input/js0 This patch only adds a way to filter out this "serial" packet and as a result it removes the spurous events. Signed-off-by: Clement Calmels --- 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 fd4100d..c44cbd4 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -527,7 +527,7 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha } /* Valid pad data */ - if (!(data[1] & 0x1)) + if (data[1] != 0x1) return; xpad360_process_packet(xpad, cmd, &data[4]);