linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Clément Calmels" <clement.calmels@free.fr>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: xpad - remove spurious events of wireless xpad 360 controller
Date: Sun, 22 Nov 2015 17:26:14 +0100	[thread overview]
Message-ID: <20151122172614.10d1fc46@gromit> (raw)
In-Reply-To: <1446409571-15146-1-git-send-email-clement.calmels@free.fr>

On Sun,  1 Nov 2015 21:26:11 +0100
clement.calmels@free.fr wrote:

> From: Clement Calmels <clement.calmels@free.fr>
> 
> 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 connects, 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:
> https://github.com/xboxdrv/xboxdrv/blob/stable/src/xbox360_wireless_controller.cpp#L118
> this packet is only dumping a serial id and should not be interpreted
> as joystick events.
> 
> This issue can be easily seen with: $ 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 <clement.calmels@free.fr>
> ---
>  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 f8850f9..68e5bd3 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -523,7 +523,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) || data[1] == 0xf)
>  		return;
>  
>  	xpad360_process_packet(xpad, cmd, &data[4]);

After more tests, the 'if' statement can be simplified.
I will send a second version of this patch.

c.

      reply	other threads:[~2015-11-22 16:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-01 20:26 [PATCH] Input: xpad - remove spurious events of wireless xpad 360 controller clement.calmels
2015-11-22 16:26 ` Clément Calmels [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151122172614.10d1fc46@gromit \
    --to=clement.calmels@free.fr \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).