Skip to content

Commit

Permalink
core, quirks: Add GameSir T4 Nova Lite support
Browse files Browse the repository at this point in the history
This family of controllers doesn't support trigger rumble but still
needs all the motor-enable bits set unconditionally.

Fixes: #484
Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed Nov 28, 2024
1 parent 289d3bf commit 8ce85bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
15 changes: 15 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,21 @@ options hid_xpadneo quirks=A0:5A:5D:xx:xx:xx+2
This controller uses emulated profile switching support (see below).


### GameSir T4 Nova Lite Family

This driver supports the GameSir T4 Nova Lite controller family, tested by the community. These models have a quirk of
only allowing rumble when all motor-enable bits are set and does not have trigger rumble motors. It looks like these
models are available with different MAC OUIs, so your particular controller may not be automatically detected. In this
case, manually add the quirk flags for your controller:

```
# /etc/modprobe.conf
options hid_xpadneo quirks=3E:42:6C:xx:xx:xx+6
```

This controller uses emulated profile switching support (see below).


## Profile Switching

The driver supports switching between different profiles, either through emulation or by using the hardware
Expand Down
21 changes: 15 additions & 6 deletions hid-xpadneo/src/hid-xpadneo.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,17 @@ struct quirk {
};

static const struct quirk xpadneo_quirks[] = {
DEVICE_OUI_QUIRK("3E:42:6C",
XPADNEO_QUIRK_NO_PULSE | XPADNEO_QUIRK_NO_MOTOR_MASK |
XPADNEO_QUIRK_NO_TRIGGER_RUMBLE),
DEVICE_OUI_QUIRK("98:B6:EA",
XPADNEO_QUIRK_NO_PULSE | XPADNEO_QUIRK_NO_TRIGGER_RUMBLE |
XPADNEO_QUIRK_REVERSE_MASK),
DEVICE_OUI_QUIRK("A0:5A:5D", XPADNEO_QUIRK_NO_HAPTICS),
DEVICE_OUI_QUIRK("E4:17:D8", XPADNEO_QUIRK_NO_HAPTICS | XPADNEO_QUIRK_NO_TRIGGER_RUMBLE),
DEVICE_OUI_QUIRK("ED:BC:9A",
XPADNEO_QUIRK_NO_PULSE | XPADNEO_QUIRK_NO_MOTOR_MASK |
XPADNEO_QUIRK_NO_TRIGGER_RUMBLE),
};

struct usage_map {
Expand Down Expand Up @@ -270,9 +276,9 @@ static void xpadneo_ff_worker(struct work_struct *work)

spin_unlock_irqrestore(&xdata->ff_lock, flags);

/* do not send these bits if not supported */
/* set all bits if not supported (some clones require these set) */
if (unlikely(xdata->quirks & XPADNEO_QUIRK_NO_MOTOR_MASK))
r->ff.enable = 0;
r->ff.enable = FF_RUMBLE_ALL;

/* reverse the bits for trigger and main motors */
if (unlikely(xdata->quirks & XPADNEO_QUIRK_REVERSE_MASK))
Expand Down Expand Up @@ -401,9 +407,10 @@ static void xpadneo_welcome_rumble(struct hid_device *hdev)
*/

save = ff_pck.ff.magnitude_weak;
if (xdata->quirks & XPADNEO_QUIRK_NO_MOTOR_MASK)
if (xdata->quirks & XPADNEO_QUIRK_NO_MOTOR_MASK) {
ff_pck.ff.magnitude_weak = 40;
else if (xdata->quirks & XPADNEO_QUIRK_REVERSE_MASK)
ff_pck.ff.enable = FF_RUMBLE_ALL;
} else if (xdata->quirks & XPADNEO_QUIRK_REVERSE_MASK)
ff_pck.ff.enable = FF_RUMBLE_LEFT;
else
ff_pck.ff.enable = FF_RUMBLE_WEAK;
Expand All @@ -418,9 +425,10 @@ static void xpadneo_welcome_rumble(struct hid_device *hdev)
mdelay(30);

save = ff_pck.ff.magnitude_strong;
if (xdata->quirks & XPADNEO_QUIRK_NO_MOTOR_MASK)
if (xdata->quirks & XPADNEO_QUIRK_NO_MOTOR_MASK) {
ff_pck.ff.magnitude_strong = 20;
else if (xdata->quirks & XPADNEO_QUIRK_REVERSE_MASK)
ff_pck.ff.enable = FF_RUMBLE_ALL;
} else if (xdata->quirks & XPADNEO_QUIRK_REVERSE_MASK)
ff_pck.ff.enable = FF_RUMBLE_RIGHT;
else
ff_pck.ff.enable = FF_RUMBLE_STRONG;
Expand All @@ -440,6 +448,7 @@ static void xpadneo_welcome_rumble(struct hid_device *hdev)
if (xdata->quirks & XPADNEO_QUIRK_NO_MOTOR_MASK) {
ff_pck.ff.magnitude_left = 10;
ff_pck.ff.magnitude_right = 10;
ff_pck.ff.enable = FF_RUMBLE_ALL;
} else if (xdata->quirks & XPADNEO_QUIRK_REVERSE_MASK) {
ff_pck.ff.enable = FF_RUMBLE_MAIN;
} else {
Expand Down

0 comments on commit 8ce85bf

Please sign in to comment.