Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2576007imu; Thu, 29 Nov 2018 07:07:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/We3u1ZajEyxzezfhxEZZkfRkUW85kT7vKUzV3pJeRHnbcoIcqzEYaXp/gy5FIgTTD6ENti X-Received: by 2002:a62:53c5:: with SMTP id h188mr1703998pfb.190.1543504066812; Thu, 29 Nov 2018 07:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543504066; cv=none; d=google.com; s=arc-20160816; b=S+4UWBWc1ZA3EpMuX66xgyXIiOmltiIBW/XneuFqzjs1O0vwnqLWWXtXSbVLihYDAl ju8a3vNZgEeQOLX8DfAIyV8qcYuY4emt54CWe86zivfAnXFjjl/TVQlFpWha9r/fA2/e 0TaZQ8ViBpFcn/3lXEjH+xRa2iFzE7z65pU1IvaARYqrzFiwbyfhCY+EzLI0Jgs5uP7H 7ONDaBWVoEhbmDRbtmevcygxy7LSvv2RklOSLZQoNrzOd7KjKQLB2u25hKMVqTfG8FNW 7DLXHb+Ti7KWkkvNpoU0cbvSWw1cjxP/BrY4EUOxsSEOzx/0i47MDYADmhAtfMv1ZroJ 8BXg== 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=UAeB5wHD6twuwDXnsnAkKhCvMB36//SAmE90fNFrYtM=; b=Ngm5MRx3xLxmDIoAZtFRmJkCqjFwcjZmNJ3+btNuBO8I4qOKpvkwgoJvE7C6Sv7ixb hEGYJhmZEMe0pUvPP8hReVge/+5vRRYFUghqc5vqnnXINnN+diPgDi+hj0MYmSL9N844 ADDsJb6pcuheCf12WbDnecgaapM/Nbhxet0wN0z9AbhfJaV7wmjwE7vfPhoangg99CNh 8ovP6k2Z2oMXtiSPTl4+4mp4cuYzYDV3eztK6pfAAa44PJ1j7DvwGrCWBiA5rzV6b5fk diUdSzEVBkWxeuTVGaPlQ3cD950UeqjRpBG5M0qqYJ5m0YqJdEzRs7vV4NkGLFC633bH 0gAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TKXsuyBU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 126si2195924pff.77.2018.11.29.07.07.30; Thu, 29 Nov 2018 07:07:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TKXsuyBU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729818AbeK3BV2 (ORCPT + 99 others); Thu, 29 Nov 2018 20:21:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:42780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728554AbeK3BV1 (ORCPT ); Thu, 29 Nov 2018 20:21:27 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 B6CCD208E7; Thu, 29 Nov 2018 14:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543500957; bh=gnc7Y9H64Vgi65FPvNvqt/vmVlaJ9EpOicIu/Didst4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TKXsuyBUPVXe+X8XftpbSsQrmaNGJSs2GwQD5n+cO94TvkgIdfhpubI1jcIfOn8sS TD/03A8da5pTSo5dLuJNQlLuEudAIuABbxBgYM298/hSYouISHvz4eroSIgHHRCTM+ gcK/lM8McXasmZqPEG9yQXid4poyLSgXnZhO4NLk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kyle Beauchamp , Cameron Gutman , Dmitry Torokhov , Sasha Levin Subject: [PATCH 3.18 66/83] Input: xpad - fix PowerA init quirk for some gamepad models Date: Thu, 29 Nov 2018 15:12:24 +0100 Message-Id: <20181129140141.527784447@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140138.002176596@linuxfoundation.org> References: <20181129140138.002176596@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit f5308d1b83eba20e69df5e0926ba7257c8dd9074 ] The PowerA gamepad initialization quirk worked with the PowerA wired gamepad I had around (0x24c6:0x543a), but a user reported [0] that it didn't work for him, even though our gamepads shared the same vendor and product IDs. When I initially implemented the PowerA quirk, I wanted to avoid actually triggering the rumble action during init. My tests showed that my gamepad would work correctly even if it received a rumble of 0 intensity, so that's what I went with. Unfortunately, this apparently isn't true for all models (perhaps a firmware difference?). This non-working gamepad seems to require the real magic rumble packet that the Microsoft driver sends, which actually vibrates the gamepad. To counteract this effect, I still send the old zero-rumble PowerA quirk packet which cancels the rumble effect before the motors can spin up enough to vibrate. [0]: https://github.com/paroj/xpad/issues/48#issuecomment-313904867 Reported-by: Kyle Beauchamp Tested-by: Kyle Beauchamp Fixes: 81093c9848a7 ("Input: xpad - support some quirky Xbox One pads") Cc: stable@vger.kernel.org # v4.12 Signed-off-by: Cameron Gutman Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/joystick/xpad.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2578a7677040..f8e34ef643c7 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -476,10 +476,21 @@ static const u8 xboxone_hori_init[] = { }; /* - * A rumble packet is required for some PowerA pads to start + * A specific rumble packet is required for some PowerA pads to start * sending input reports. One of those pads is (0x24c6:0x543a). */ -static const u8 xboxone_zerorumble_init[] = { +static const u8 xboxone_rumblebegin_init[] = { + 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, + 0x1D, 0x1D, 0xFF, 0x00, 0x00 +}; + +/* + * A rumble packet with zero FF intensity will immediately + * terminate the rumbling required to init PowerA pads. + * This should happen fast enough that the motors don't + * spin up to enough speed to actually vibrate the gamepad. + */ +static const u8 xboxone_rumbleend_init[] = { 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -494,9 +505,12 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init), XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init), XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), - XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_zerorumble_init), - XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_zerorumble_init), - XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_zerorumble_init), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumbleend_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumbleend_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumbleend_init), }; struct xpad_output_packet { -- 2.17.1