summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-sony.c
diff options
context:
space:
mode:
authorFrank Praznik <frank.praznik@oh.rr.com>2015-07-24 01:01:16 +0200
committerJiri Kosina <jkosina@suse.com>2015-07-24 14:59:37 +0200
commit8f5f0bc2766af7785161a4440bca1d0746eb3671 (patch)
tree0670162ab0c338b8f5a6beb326379c50a8bb36e8 /drivers/hid/hid-sony.c
parentHID: sony: Navigator Axis for L1 button (diff)
downloadlinux-8f5f0bc2766af7785161a4440bca1d0746eb3671.tar.xz
linux-8f5f0bc2766af7785161a4440bca1d0746eb3671.zip
HID: sony: Drop invalid Sixaxis input reports
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. Link: http://www.spinics.net/lists/linux-bluetooth/msg63028.html Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers/hid/hid-sony.c')
-rw-r--r--drivers/hid/hid-sony.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 69586b316409..ed0496abf573 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1277,6 +1277,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]);