Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1034234ybe; Wed, 4 Sep 2019 11:28:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyejArxKzB4L8R8PkFH2uczoHzveLZ2cLbZWwnhgBPVMMX5QXB3Lp0FSEDU6j8CixZYauhq X-Received: by 2002:a17:902:8d8d:: with SMTP id v13mr41902027plo.137.1567621737260; Wed, 04 Sep 2019 11:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621737; cv=none; d=google.com; s=arc-20160816; b=PqO5g2Ht15WYlNnOWuQTr3pIEbKzKM6rfUasVhKHpjq1YA1hss6PC3hEEoubUCiHrQ v21NDiD9VL5HcLcBwxMXx7iOZ2ZeWuoWDcLXsHT9JtHkSdGs4zHSFnhMr/pFkp92S5Vy 3LMK46ODpuYu5/CflRsYHahFmvPvsLAYICzhyOSXkaQ9RpWqK4uU2ObKuSZytjm03Jb6 5qjOMAPBolc0j0xqnVj/1SIF9b42n76ZQDFqTouihNBJG7ojiRGW1v7Zw8gZcFq8LM3I MHKZLn+D1yiHrkyZ4RpLxzEbLGg3+spwsiRURarfx4Fo7xD/APOFFntqLjVjt0xAd/lL DRbg== 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=rfHRJDZQ780eE+VuHnpyjXl5mA2jUGPgOY5Uow+Dl/U=; b=rb6MkQiHHxE5U2u7BAecNvXh9Uu+CD0VFHfi8xco3GEwTlygjWjQiWXmD8fT/SWRls 27VmXJJ7TJuKybL0yDJO9FPSXSnQjo/J78cGf5eyDDTnC3JtTx+qvFHXinY2r/i4P5QV yAkRhlNiy/lI6IQwN4iUZ5uAQIiAuD50VRPDpgaW6VO89YQ1Fmp4W57hR2q2CDDY3S+0 d13umbNY37JQC9FzyWK221ZAs6cCFj1BaNb2wx4JfAb1/Z9dWVgfdbwEzZ2yEphqyxRS WNHhI/kQQdAOCx2TuQMP6yV8RpOq2hgN7q5CJUQ/V5g1896qZDk1MeNHyZ4Z7mdRllpa LgyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="2rGV/YHk"; 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 23si664038pgw.59.2019.09.04.11.28.40; Wed, 04 Sep 2019 11:28:57 -0700 (PDT) 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="2rGV/YHk"; 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 S2388130AbfIDR6u (ORCPT + 99 others); Wed, 4 Sep 2019 13:58:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:37346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388114AbfIDR6s (ORCPT ); Wed, 4 Sep 2019 13:58:48 -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 C70C322DBF; Wed, 4 Sep 2019 17:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567619927; bh=uSIP8u8DY++aF/wMqdAfQwS0BjIVacNJen3OVr0tJrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2rGV/YHko2WB07+CdBQXafcXoR7u7T3AHv56VsOQkAdLdHbIOMYcfyqyOGt5s9m3k GWQ27XhpF5/JG7SBKJjsdgx5UH2XGV5Nc9l/fjGosBvL40oWt6QPhujR1ugxk02e+i zO8mXVI4nC6V6q4wr4UH8wQiQ8eLJSphOVu4INBU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilya Trukhanov , Jiri Kosina , Sasha Levin Subject: [PATCH 4.9 01/83] HID: Add 044f:b320 ThrustMaster, Inc. 2 in 1 DT Date: Wed, 4 Sep 2019 19:52:53 +0200 Message-Id: <20190904175303.712854731@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175303.488266791@linuxfoundation.org> References: <20190904175303.488266791@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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 [ Upstream commit 65f11c72780fa9d598df88def045ccb6a885cf80 ] Enable force feedback for the Thrustmaster Dual Trigger 2 in 1 Rumble Force gamepad. Compared to other Thrustmaster devices, left and right rumble motors here are swapped. Signed-off-by: Ilya Trukhanov Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-tmff.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/hid/hid-tmff.c b/drivers/hid/hid-tmff.c index b83376077d722..cfa0cb22c9b3c 100644 --- a/drivers/hid/hid-tmff.c +++ b/drivers/hid/hid-tmff.c @@ -34,6 +34,8 @@ #include "hid-ids.h" +#define THRUSTMASTER_DEVICE_ID_2_IN_1_DT 0xb320 + static const signed short ff_rumble[] = { FF_RUMBLE, -1 @@ -88,6 +90,7 @@ static int tmff_play(struct input_dev *dev, void *data, struct hid_field *ff_field = tmff->ff_field; int x, y; int left, right; /* Rumbling */ + int motor_swap; switch (effect->type) { case FF_CONSTANT: @@ -112,6 +115,13 @@ static int tmff_play(struct input_dev *dev, void *data, ff_field->logical_minimum, ff_field->logical_maximum); + /* 2-in-1 strong motor is left */ + if (hid->product == THRUSTMASTER_DEVICE_ID_2_IN_1_DT) { + motor_swap = left; + left = right; + right = motor_swap; + } + dbg_hid("(left,right)=(%08x, %08x)\n", left, right); ff_field->value[0] = left; ff_field->value[1] = right; @@ -238,6 +248,8 @@ static const struct hid_device_id tm_devices[] = { .driver_data = (unsigned long)ff_rumble }, { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304), /* FireStorm Dual Power 2 (and 3) */ .driver_data = (unsigned long)ff_rumble }, + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, THRUSTMASTER_DEVICE_ID_2_IN_1_DT), /* Dual Trigger 2-in-1 */ + .driver_data = (unsigned long)ff_rumble }, { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323), /* Dual Trigger 3-in-1 (PC Mode) */ .driver_data = (unsigned long)ff_rumble }, { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324), /* Dual Trigger 3-in-1 (PS3 Mode) */ -- 2.20.1