Commit 96a56365 authored by Ilya Trukhanov's avatar Ilya Trukhanov Committed by Khalid Elmously

HID: Add 044f:b320 ThrustMaster, Inc. 2 in 1 DT

BugLink: https://bugs.launchpad.net/bugs/1845036

[ Upstream commit 65f11c72 ]

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: default avatarIlya Trukhanov <lahvuun@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent c03853db
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include "hid-ids.h" #include "hid-ids.h"
#define THRUSTMASTER_DEVICE_ID_2_IN_1_DT 0xb320
static const signed short ff_rumble[] = { static const signed short ff_rumble[] = {
FF_RUMBLE, FF_RUMBLE,
-1 -1
...@@ -88,6 +90,7 @@ static int tmff_play(struct input_dev *dev, void *data, ...@@ -88,6 +90,7 @@ static int tmff_play(struct input_dev *dev, void *data,
struct hid_field *ff_field = tmff->ff_field; struct hid_field *ff_field = tmff->ff_field;
int x, y; int x, y;
int left, right; /* Rumbling */ int left, right; /* Rumbling */
int motor_swap;
switch (effect->type) { switch (effect->type) {
case FF_CONSTANT: case FF_CONSTANT:
...@@ -112,6 +115,13 @@ static int tmff_play(struct input_dev *dev, void *data, ...@@ -112,6 +115,13 @@ static int tmff_play(struct input_dev *dev, void *data,
ff_field->logical_minimum, ff_field->logical_minimum,
ff_field->logical_maximum); 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); dbg_hid("(left,right)=(%08x, %08x)\n", left, right);
ff_field->value[0] = left; ff_field->value[0] = left;
ff_field->value[1] = right; ff_field->value[1] = right;
...@@ -238,6 +248,8 @@ static const struct hid_device_id tm_devices[] = { ...@@ -238,6 +248,8 @@ static const struct hid_device_id tm_devices[] = {
.driver_data = (unsigned long)ff_rumble }, .driver_data = (unsigned long)ff_rumble },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304), /* FireStorm Dual Power 2 (and 3) */ { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304), /* FireStorm Dual Power 2 (and 3) */
.driver_data = (unsigned long)ff_rumble }, .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) */ { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323), /* Dual Trigger 3-in-1 (PC Mode) */
.driver_data = (unsigned long)ff_rumble }, .driver_data = (unsigned long)ff_rumble },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324), /* Dual Trigger 3-in-1 (PS3 Mode) */ { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324), /* Dual Trigger 3-in-1 (PS3 Mode) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment