* [PATCH] hid: sony: Drop invalid Sixaxis input reports
@ 2015-07-23 23:01 Frank Praznik
2015-07-23 23:12 ` simon
2015-07-24 13:00 ` Jiri Kosina
0 siblings, 2 replies; 3+ messages in thread
From: Frank Praznik @ 2015-07-23 23:01 UTC (permalink / raw)
To: linux-input; +Cc: simon, jkosina, virtuousfox, Frank Praznik
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.
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hid: sony: Drop invalid Sixaxis input reports
2015-07-23 23:01 [PATCH] hid: sony: Drop invalid Sixaxis input reports Frank Praznik
@ 2015-07-23 23:12 ` simon
2015-07-24 13:00 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: simon @ 2015-07-23 23:12 UTC (permalink / raw)
Cc: linux-input, jkosina, virtuousfox, Frank Praznik
> 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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hid: sony: Drop invalid Sixaxis input reports
2015-07-23 23:01 [PATCH] hid: sony: Drop invalid Sixaxis input reports Frank Praznik
2015-07-23 23:12 ` simon
@ 2015-07-24 13:00 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2015-07-24 13:00 UTC (permalink / raw)
To: Frank Praznik; +Cc: linux-input, simon, virtuousfox
On Thu, 23 Jul 2015, Frank Praznik wrote:
> 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.
>
> 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;
> +
Given that this is not a regression and given the current development
phase, I've applied it to for-4.3/sony.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-24 13:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 23:01 [PATCH] hid: sony: Drop invalid Sixaxis input reports Frank Praznik
2015-07-23 23:12 ` simon
2015-07-24 13:00 ` Jiri Kosina
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).