Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2525996imu; Thu, 29 Nov 2018 06:25:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/W8RR1dKPvmPkRIQ8AIjpBQGjhQzz6rqIkC7bR87dc25/e8i3pPDGo42O7soRRc0SbirJ3B X-Received: by 2002:a63:1e17:: with SMTP id e23mr1415490pge.130.1543501508185; Thu, 29 Nov 2018 06:25:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501508; cv=none; d=google.com; s=arc-20160816; b=CScwFbBNicfiMbwYfHu0Vzx5wgLgdcsi8zd8/boSXtVM2WBg5jq13TtQhqTTq7PXKq ff/J3AAWmRYUQsC/7AQ8A1M77mxv/x/iZTVfEDSg58S50sqausRMV4UTJYHXazp6WdIO 1GFAlbE7F+tziK3lHv85ZI8MtRSisrfoWe4QlMrmVc7KFYvjnanslJWd+g5mn9bCMBB2 yve0ibvOfnjbT5Dhoc3J0H3XufiiSejpnQwK8RMahSnOJy2IPmY0DG0HRHCtgswIT9rX U3SUb5aQ0JzYKt8W4ZgbJ44Q/ZVrWPYKFlfew4k5mYJaxlnk9xEHgv9pLkeYIrJiw+36 3wcQ== 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=NsCpCwUjN6Yb9NZefG6MXGNxuivBdqDmbzkdhu2vR8Q=; b=k9yJ1AUDs/uqkdd4OiFDNLdlLuCVr4g2GMODmcZCwZOMnMs8dRvIxPyPjJt9qNWEYD pPN4XAzUO7Uxv0p2LgAkdCz7bIpgsHhBST2ZGmWREY4LX6V9Bw4rtMoDdOJXlDpznPDA ZRL02f6uPiUoqMklK2Yesj25t4ZqeOnalDiy/eaftvFnbZAX4+EWVi1YSDlSpTgOqVEp 9NxLpuQ0py8wZutcSq7oL0KlL43kYjY2AujTDflZMCjRNILwO+BNVlT8nrT9xww9ys/u Y7Ms6n14EMR7qOwZ6v24qDm/BFZ36Y3fTdHOMzyKpjFsGGpqFMqM7tLTkxXUFNYWuvYI DoWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dAuS0WVD; 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 v10si2228213pgg.510.2018.11.29.06.24.50; Thu, 29 Nov 2018 06:25:08 -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=dAuS0WVD; 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 S1732457AbeK3B3Z (ORCPT + 99 others); Thu, 29 Nov 2018 20:29:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:55788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731245AbeK3B3Z (ORCPT ); Thu, 29 Nov 2018 20:29:25 -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 A3E252145D; Thu, 29 Nov 2018 14:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501433; bh=+rsiHtKRjFf2rDm4ZY8fS/RV4Y8Dlmf1ZLGRh9HwXA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dAuS0WVDBPhk21dd7pcnZlMq0p4p5stlozszer/bE+boMp1KWpm/dVzbbRpnuetlm wKCgIoBRKfNyuHM6ms/1b8Wvwg7n1iXe76eQmF5UcYD3dO79XvTiJO9Rfm3/EjhwhM KXWXASA0PQ3B1WwPWSZ0F1pyhPDNLCowKf5ov6wE= 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.9 61/92] Input: xpad - fix PowerA init quirk for some gamepad models Date: Thu, 29 Nov 2018 15:12:30 +0100 Message-Id: <20181129140111.269483325@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140106.520639693@linuxfoundation.org> References: <20181129140106.520639693@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.9-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