Skip to content

Commit e72455b

Browse files
Scott ShumateJiri Kosina
authored andcommitted
HID: sony: Fix for broken buttons on DS3 USB dongles
Fix for non-working buttons on knock-off USB dongles for Sony controllers. These USB dongles are used to connect older Sony DA/DS1/DS2 controllers via USB and are common on Amazon, AliExpress, etc. Without the patch, the square, X, and circle buttons do not function. These dongles used to work prior to kernel 4.10 but removing the global DS3 report fixup in commit e19a267 ("HID: sony: DS3 comply to Linux gamepad spec") exposed the problem. Many people reported the problem on the Ubuntu forums and are working around the problem by falling back to the 4.9 hid-sony driver. The problem stems from these dongles incorrectly reporting their button count as 13 instead of 16. This patch fixes up the report descriptor by changing the button report count to 16 and removing 3 padding bits. Cc: [email protected] Fixes: e19a267 ("HID: sony: DS3 comply to Linux gamepad spec") Signed-off-by: Scott Shumate <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent fb68ada commit e72455b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/hid/hid-sony.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,23 @@ static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc,
867867
if (sc->quirks & PS3REMOTE)
868868
return ps3remote_fixup(hdev, rdesc, rsize);
869869

870+
/*
871+
* Some knock-off USB dongles incorrectly report their button count
872+
* as 13 instead of 16 causing three non-functional buttons.
873+
*/
874+
if ((sc->quirks & SIXAXIS_CONTROLLER_USB) && *rsize >= 45 &&
875+
/* Report Count (13) */
876+
rdesc[23] == 0x95 && rdesc[24] == 0x0D &&
877+
/* Usage Maximum (13) */
878+
rdesc[37] == 0x29 && rdesc[38] == 0x0D &&
879+
/* Report Count (3) */
880+
rdesc[43] == 0x95 && rdesc[44] == 0x03) {
881+
hid_info(hdev, "Fixing up USB dongle report descriptor\n");
882+
rdesc[24] = 0x10;
883+
rdesc[38] = 0x10;
884+
rdesc[44] = 0x00;
885+
}
886+
870887
return rdesc;
871888
}
872889

0 commit comments

Comments
 (0)