linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: simon@mungewell.org
Cc: linux-input@vger.kernel.org, jkosina@suse.cz,
	virtuousfox@gmail.com, Frank Praznik <frank.praznik@oh.rr.com>
Subject: Re: [PATCH] hid: sony: Drop invalid Sixaxis input reports
Date: Thu, 23 Jul 2015 19:12:54 -0400	[thread overview]
Message-ID: <6b978394fa9d4646cc3aff9f1f2a5ee0.squirrel@mungewell.org> (raw)
In-Reply-To: <1437692476-12557-1-git-send-email-frank.praznik@oh.rr.com>

> When connected via Bluetooth the sixaxis periodically sends reports with
> an ID of 1, the second byte 0xff and the rest zeroed.  These reports are
> not related to the controller state and must be dropped to avoid
> generating false input events.

These 'problem reports' were reported (*) over the on Bluetooth list, and
appear in both the HID and the HCI streams (suggesting that they are
really sent from device). They are not seen on the USB connection.

Dropping them in 'raw_event()' seems a sensible approach,
Simon.

* http://www.spinics.net/lists/linux-bluetooth/msg63028.html


>
> Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
> ---
>  drivers/hid/hid-sony.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index ed2f008..beb2b02 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -1270,6 +1270,17 @@ static int sony_raw_event(struct hid_device *hdev,
> struct hid_report *report,
>  	 * has to be BYTE_SWAPPED before passing up to joystick interface
>  	 */
>  	if ((sc->quirks & SIXAXIS_CONTROLLER) && rd[0] == 0x01 && size == 49) {
> +		/*
> +		 * When connected via Bluetooth the Sixaxis occasionally sends
> +		 * a report with the second byte 0xff and the rest zeroed.
> +		 *
> +		 * This report does not reflect the actual state of the
> +		 * controller must be ignored to avoid generating false input
> +		 * events.
> +		 */
> +		if (rd[1] == 0xff)
> +			return -EINVAL;
> +
>  		swap(rd[41], rd[42]);
>  		swap(rd[43], rd[44]);
>  		swap(rd[45], rd[46]);
> --
> 2.4.3
>
>


  reply	other threads:[~2015-07-23 23:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 23:01 [PATCH] hid: sony: Drop invalid Sixaxis input reports Frank Praznik
2015-07-23 23:12 ` simon [this message]
2015-07-24 13:00 ` Jiri Kosina

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=6b978394fa9d4646cc3aff9f1f2a5ee0.squirrel@mungewell.org \
    --to=simon@mungewell.org \
    --cc=frank.praznik@oh.rr.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=virtuousfox@gmail.com \
    /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).