Skip to content

Commit 8f5f0bc

Browse files
Frank PraznikJiri Kosina
authored andcommitted
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 2259b5b commit 8f5f0bc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/hid/hid-sony.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,17 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
12771277
* has to be BYTE_SWAPPED before passing up to joystick interface
12781278
*/
12791279
if ((sc->quirks & SIXAXIS_CONTROLLER) && rd[0] == 0x01 && size == 49) {
1280+
/*
1281+
* When connected via Bluetooth the Sixaxis occasionally sends
1282+
* a report with the second byte 0xff and the rest zeroed.
1283+
*
1284+
* This report does not reflect the actual state of the
1285+
* controller must be ignored to avoid generating false input
1286+
* events.
1287+
*/
1288+
if (rd[1] == 0xff)
1289+
return -EINVAL;
1290+
12801291
swap(rd[41], rd[42]);
12811292
swap(rd[43], rd[44]);
12821293
swap(rd[45], rd[46]);

0 commit comments

Comments
 (0)