Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2173493ybg; Fri, 5 Jun 2020 07:24:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzjZ8g1VXaU0SUbcdUcikSq0UjGT1ekRjrw0Z021bffs+kgPVflK8k9sTg1ouCT7jPrPC4 X-Received: by 2002:a50:8465:: with SMTP id 92mr9088501edp.388.1591367067274; Fri, 05 Jun 2020 07:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591367067; cv=none; d=google.com; s=arc-20160816; b=ic9qr5S2+GyMRL8C6tenOw15+hxykZDjLiMSAJnI5AvemT7SMvjZWRA96pPPfH1cyS 0NkAba38BH+yzrBmNHRo/CuC2t47fYhBa4YAMpt7kO4zBaWDrRI0MZKhigIgmQcH1vYk fPtR1NkT7xwTGfXE4Zynt/2i61m7MPbRbAtsUsKTC2MhNEG7DT9fSQzc3Ar+jPa6hJLr sN0/5ZYZFMIWAV8OjAfzCheSvPdl25lniqpaKS/L2dAfyK4RnvezgT+ZYeCBra3VZmWb 8OZGfjxvPMP9beq2gfI5wB6iOA+0RfCafBsBwmqwbN89+8OUXO9ix5NHoM66FdEsEdWW l37Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nTbaDIuifSAJSVC4GmyBxKAU2yfiLqAjkFPRf2xFo4M=; b=NWf3Go43BYympZHGibIDQALtqIt+qz4UlmNewgwOrI/ilLCoo7bhyAvgz4GGUEPSQ3 2ytJCqGxb7V7hTcbIrHrWfKNeyoJAPAeR2KMZfg14ItxEaFl89RhVTi6/26v+31BHIsj CRhULiCiJQiOYy7SuIhNMCX9j3jgfM5Iai1HFrBaPqiDYO51BBoZj7fQhHMPRXbXQm7g LryB5dDrsgDiT8i5jArPCQ4OiASV7wNtS4vRLG7p6png/wwHh1I8x6qn0s+VCGvzRzok SmC6wRjADw7xXQCgFMyxc5Za6/vnfYL3S5h7Du2RTU4kF9cTHWU0ENctIs5Z3p1Ynk6D 6ivw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s5sFn0kh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si3505902edx.469.2020.06.05.07.24.04; Fri, 05 Jun 2020 07:24:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s5sFn0kh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728551AbgFEOVR (ORCPT + 99 others); Fri, 5 Jun 2020 10:21:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:51522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728941AbgFEOUS (ORCPT ); Fri, 5 Jun 2020 10:20:18 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 01309206DC; Fri, 5 Jun 2020 14:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591366817; bh=2Ovjp60VIwBljOoEVFT7uq/DsgfITO8n10lmxaues1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5sFn0khgzdFQ8FgjdVtxwvAydZu1QazSIU4Iqm9kBKdOJ8QGoQHVTlmMckCitwpk aN+THsDAQmDgeJqokR2aYql6SKspCJ4mAsohm2qFfF0D+i8NxuuNNk9p2EpdrSe9fg Osi28PGRa3KRrEbfCKjtCS/DHTJ+uFN5Z4dNn1+o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Shumate , Jiri Kosina 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 Message-Id: <20200605140252.586688136@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200605140252.338635395@linuxfoundation.org> References: <20200605140252.338635395@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Scott Shumate 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 Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- 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; }