Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2566204imu; Thu, 29 Nov 2018 07:00:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHZSZ+NApEv7NRmZG80Al/1Qa0bPJAAZqx/1FElpXkkfgfiAevFQXKtBU+HMwyK+w84Lt5 X-Received: by 2002:a62:520b:: with SMTP id g11mr1724116pfb.53.1543503656233; Thu, 29 Nov 2018 07:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543503656; cv=none; d=google.com; s=arc-20160816; b=YPoZuALuP8ZE7JB4+uo6kFEr4UTWSlsqIF8N17vOCf//39jti45/8VzkF2yD2hZcWM hn3mSgIOmu5/tzunnwgR6VVteaUqS6HNY+cXK/8yqo7cTUBv5wmWFjTuwZCNeQBLN14d hmgq30lknBuBVdMztjnSQGs3VH9ERDEYQxLxsNeSWlixO+10VnOPMdG8Yn7JRUU7DqFK 61rWjsgpCfaf2QYAqE7RgQVHvPdT20FcogCq55fIKtqwu2edZZ24NxB/0/viv8xBwqoj C6L1EIz2opJSQKrUpz/iVKpM5jyDOOUFqgK7s49MTdO1YoYxWJwO0rvleaOmf8NmCDkR PUmg== 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=qGoSXOmTq/juGPBM5iwVWziT4tTAyyvegAEaexQd+cM=; b=v/LQeFp6yvowOAC/TPvUSTnSRGy8SfHe1FSE4kmFgqmemSoDOstYKu8M/rbpNlt+OT kUQdfo1xJxsGt78vXvCJy9Do+A9mB+2OhqEqafL/zeQlGDpmqIzqK1li4hKhcF4HAOHR fcXcXAhrXla14ABPewzr5S8Qczf4CwgoDH5VkrXCmbvphrgCUpRUzaqGKlea1vKnISVo f6+UAqWwrdgKrufZB9Ojyx3GOVXq3vZQuJaFUWzwJKGyFp8uaKAmhIbR4k0uZGKHaRSm 0w74fk4NXiWGnysSprqabEWlyQ/j3U62url9EsHQKIkJgSe8PHHFDHORZwz8nzvPsEzF c5fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rOVtW1Ds; 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 y8si2347041pfn.26.2018.11.29.07.00.31; Thu, 29 Nov 2018 07:00:56 -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=rOVtW1Ds; 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 S1730948AbeK3BYe (ORCPT + 99 others); Thu, 29 Nov 2018 20:24:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:47414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729693AbeK3BYe (ORCPT ); Thu, 29 Nov 2018 20:24:34 -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 F09E021104; Thu, 29 Nov 2018 14:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501143; bh=X23rH/FfYSj7Lt1N0wC1MwBqNT3nYm6JDJQCdefqkR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rOVtW1Ds6/+fEskmT2p75LKSrr0wuMRsmTQiJQJmGoctb37Nsu1JBvRoHhadBKwYH 1EvmdMPh+AGSzubMQQmZbuxkeegh/NGkMWwCFKaG41mApfNWhRww1ss3DowHEiekcY w0bIg+KyLFvQUK9ZH5Pw6aUZScVLcT4I9w1AZWI4= 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 4.4 60/86] Input: xpad - fix PowerA init quirk for some gamepad models Date: Thu, 29 Nov 2018 15:12:25 +0100 Message-Id: <20181129140115.056953213@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140109.832117862@linuxfoundation.org> References: <20181129140109.832117862@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 4.4-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