linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Scott Shumate <scott.shumate@gmail.com>,
	Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH 4.19 04/28] HID: sony: Fix for broken buttons on DS3 USB dongles
Date: Fri,  5 Jun 2020 16:15:06 +0200	[thread overview]
Message-ID: <20200605140252.586688136@linuxfoundation.org> (raw)
In-Reply-To: <20200605140252.338635395@linuxfoundation.org>

From: Scott Shumate <scott.shumate@gmail.com>

commit e72455b898ac678667c5674668186b4670d87d11 upstream.

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 e19a267b9987 ("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: stable@vger.kernel.org
Fixes: e19a267b9987 ("HID: sony: DS3 comply to Linux gamepad spec")
Signed-off-by: Scott Shumate <scott.shumate@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hid/hid-sony.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -869,6 +869,23 @@ static u8 *sony_report_fixup(struct hid_
 	if (sc->quirks & PS3REMOTE)
 		return ps3remote_fixup(hdev, rdesc, rsize);
 
+	/*
+	 * Some knock-off USB dongles incorrectly report their button count
+	 * as 13 instead of 16 causing three non-functional buttons.
+	 */
+	if ((sc->quirks & SIXAXIS_CONTROLLER_USB) && *rsize >= 45 &&
+		/* Report Count (13) */
+		rdesc[23] == 0x95 && rdesc[24] == 0x0D &&
+		/* Usage Maximum (13) */
+		rdesc[37] == 0x29 && rdesc[38] == 0x0D &&
+		/* Report Count (3) */
+		rdesc[43] == 0x95 && rdesc[44] == 0x03) {
+		hid_info(hdev, "Fixing up USB dongle report descriptor\n");
+		rdesc[24] = 0x10;
+		rdesc[38] = 0x10;
+		rdesc[44] = 0x00;
+	}
+
 	return rdesc;
 }
 



  parent reply	other threads:[~2020-06-05 14:21 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 14:15 [PATCH 4.19 00/28] 4.19.127-rc1 review Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 01/28] Revert "cgroup: Add memory barriers to plug cgroup_rstat_updated() race window" Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 02/28] libnvdimm: Fix endian conversion issues Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 03/28] mm: Fix mremap not considering huge pmd devmap Greg Kroah-Hartman
2020-06-05 14:15 ` Greg Kroah-Hartman [this message]
2020-06-05 14:15 ` [PATCH 4.19 05/28] HID: i2c-hid: add Schneider SCL142ALM to descriptor override Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 06/28] p54usb: add AirVasT USB stick device-id Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 07/28] kernel/relay.c: handle alloc_percpu returning NULL in relay_open Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 08/28] mmc: fix compilation of user API Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 09/28] scsi: ufs: Release clock if DMA map fails Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 10/28] net: dsa: mt7530: set CPU port to fallback mode Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 11/28] airo: Fix read overflows sending packets Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 12/28] drm/i915: fix port checks for MST support on gen >= 11 Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 13/28] scsi: hisi_sas: Check sas_port before using it Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 14/28] powerpc/powernv: Avoid re-registration of imc debugfs directory Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 15/28] spi: dw: use "smp_mb()" to avoid sending spi data error Greg Kroah-Hartman
2020-06-07 20:09   ` Pavel Machek
2020-06-08 11:16     ` Mark Brown
2020-06-10 15:01       ` Pavel Machek
2020-06-05 14:15 ` [PATCH 4.19 16/28] s390/ftrace: save traced function caller Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 17/28] ARC: Fix ICCM & DCCM runtime size checks Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 18/28] ARC: [plat-eznps]: Restrict to CONFIG_ISA_ARCOMPACT Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 19/28] evm: Fix RCU list related warnings Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 20/28] i2c: altera: Fix race between xfer_msg and isr thread Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 21/28] x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 22/28] net: bmac: Fix read of MAC address from ROM Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 23/28] drm/edid: Add Oculus Rift S to non-desktop list Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 24/28] s390/mm: fix set_huge_pte_at() for empty ptes Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 25/28] null_blk: return error for invalid zone size Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 26/28] net/ethernet/freescale: rework quiesce/activate for ucc_geth Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 27/28] net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 4.19 28/28] net: smsc911x: Fix runtime PM imbalance on error Greg Kroah-Hartman
2020-06-05 22:19 ` [PATCH 4.19 00/28] 4.19.127-rc1 review Shuah Khan
2020-06-06  6:32 ` Jon Hunter
2020-06-07 11:19   ` Greg Kroah-Hartman
2020-06-06 13:33 ` Guenter Roeck
2020-06-07  5:44 ` Naresh Kamboju
2020-06-08  9:44 ` Chris Paterson

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=20200605140252.586688136@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scott.shumate@gmail.com \
    --cc=stable@vger.kernel.org \
    /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).