xpadneo icon indicating copy to clipboard operation
xpadneo copied to clipboard

Vibration not work on Gamesir T4 Nova Lite

Open BakaJzon opened this issue 1 year ago • 21 comments

Version of xpadneo

xpadneo-dkms-git & xpadneo-dkms 0.9.6-1 from AUR -git means using the latest commit on master branch to build

Controller Model

  • [ ] Xbox One S controller
  • [ ] Xbox Elite 2 controller
  • [ ] Xbox Series X|S controller
  • [x] Other: Gamesir T4 Nova Lite or 盖世小鸡启明星

Connection mode

  • [x] Bluetooth connection
  • [ ] USB cable (not yet supported)
  • [ ] Xbox Dongle connection (not yet supported)

Installed Software

  • [ ] Anti-Micro (may affect button mappings)
  • [ ] OpenRGB (may mess up mappings and rumble stability)
  • [x] Steam Input (enabled by default via Steam Desktop client)
  • [ ] Steam Link (usually via Raspberry Pi or other micro computers)
  • [ ] devices with QMK firmware (may affect udev rules, similar to OpenRGB)
  • [ ] netstick (shares input devices via network similar to Steam Link)
  • [ ] xboxdrv (user-space gamepad driver)
  • [ ] xone (kernel-space gamepad driver using the Xbox dongle or USB)
  • [ ] xow (alternative driver using the Xbox dongle)

Protocol Information

Please help us identify at which layer the problem can be found if you want to report mapping errors or if the controller fails to be detected:

  • [x] Steam Proton games are having issues
  • [x] Steam Linux-native games are having issues
    • [ ] I don't use Steam or did not try
  • [x] games running through Lutris, wine and/or Bottles are having issues
    • [ ] I don't use Lutris, Bottles, wine or did not try
  • [x] Linux-native games are having issues
    • [ ] I don't use native games or did not try
  • [ ] Other software is having issues (describe software and issues below)
  • [ ] Running evtest is showing issues (describe the issues below)
    • Keep in mind that BTN_NORTH and BTN_WEST are intentionally swapped
  • [ ] Running jstest is showing issues (describe the issues below)
    • [x] I don't have this tool or don't know how to use it
  • [ ] Running gamepad-tool is showing issues (post console output below)
    • [x] I don't have this tool

Please describe how it is failing below in the next sections.

Severity / Impact

  • [x] I've read the docs and the bug reporting instructions
  • [x] I've applied the latest firmware update to the controller
  • [x] I've tried disabling or running without above mentioned software
  • [ ] It does not work at all
  • [ ] It used to work in a previous version
  • [ ] It mostly works but sometimes it doesn't
  • [ ] I found a work-around
  • [ ] I probably didn't figure it all out but it's too early to give up
  • [ ] I don't know how to ...
  • [ ] It's too complicated
  • [ ] Fantastic work but ...
  • [ ] I can code and I want to help

Describe the Bug

I am writing to report an issue with the GameSir Nova Lite (T4NL) gamepad that resembles the one described in #462. The gamepad has only a main vibration motor. Here are the details of the issue:

Connection Modes:

  • Wired Mode: Recognized as a generic gamepad (with vibration) in Linux under Steam Play.
  • Bluetooth Mode: Recognized as an Xbox Series X gamepad.
  • Bluetooth + Xpadneo: Recognized as an Xbox 360 gamepad.

Hidraw Test:

  • The gamepad responds to control data only when all the STR, WEA, LTR, and RTR parameters are set to 1.
  • The SUS, REL, and LOP parameters have no effect. After the last command is issued, the gamepad vibrates for a fixed duration of 20 seconds.
  • The STR and WEA parameters are effective.
  • There's no trigger motor in this gamepad.

Steps to Reproduce

  1. Connect gamepad into xbox controller mode
  2. Check vibration in any game

Expected Behavior

Gamepad must vibrate

Screenshots / GIFs / Videos

System Information

# uname -a
Linux bkjzme 6.10.1-zen1-1.1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 26 Jul 2024 03:22:07 +0000 x86_64 GNU/Linux
# xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor | tee >(cksum)
00000000: 05 01 09 05 a1 01 85 01 09 01 a1 00 09 30 09 31 15 00 27 ff  .............0.1..'.
00000014: ff 00 00 95 02 75 10 81 02 c0 09 01 a1 00 09 33 09 34 15 00  .....u.........3.4..
00000028: 27 ff ff 00 00 95 02 75 10 81 02 c0 05 01 09 32 15 00 26 ff  '......u.......2..&.
0000003c: 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 81 03 05 01 09  ...u.....%.u........
00000050: 35 15 00 26 ff 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01  5..&....u.....%.u...
00000064: 81 03 05 01 09 39 15 01 25 08 35 00 46 3b 01 66 14 00 75 04  .....9..%.5.F;.f..u.
00000078: 95 01 81 42 75 04 95 01 15 00 25 00 35 00 45 00 65 00 81 03  ...Bu.....%.5.E.e...
0000008c: 05 09 19 01 29 0c 15 00 25 01 75 01 95 0c 81 02 15 00 25 00  ....)...%.u.......%.
000000a0: 75 01 95 04 81 03 05 0c 0a b2 00 15 00 25 01 95 01 75 01 81  u............%...u..
000000b4: 02 15 00 25 00 75 07 95 01 81 03 05 0f 09 21 85 03 a1 02 09  ...%.u........!.....
000000c8: 97 15 00 25 01 75 04 95 01 91 02 15 00 25 00 75 04 95 01 91  ...%.u.......%.u....
000000dc: 03 09 70 15 00 25 64 75 08 95 04 91 02 09 50 66 01 10 55 0e  ..p..%du......Pf..U.
000000f0: 15 00 26 ff 00 75 08 95 01 91 02 09 a7 15 00 26 ff 00 75 08  ..&..u.........&..u.
00000104: 95 01 91 02 65 00 55 00 09 7c 15 00 26 ff 00 75 08 95 01 91  ....e.U..|..&..u....
00000118: 02 c0 c0                                                     ...
2986910699 1363

Controller and Bluetooth Information

Additional Context

"Portal 2" is the only game that can trigger the vibration, and it does so only when both the red and blue portal shooting buttons are pressed simultaneously (an action not allowed by the game).

BakaJzon avatar Jul 27 '24 11:07 BakaJzon

Hello, i am also facing the same issue on firmware v4200 (which is the last firmware to support Bluetooth Xinput mode) and have no vibrations. Did you find a workaround?

hithere-at avatar Sep 15 '24 06:09 hithere-at

Sorry for not including debug files. xpadneo-btmon.txt xpadneo-dmesg.txt

$ lsusb
Bus 001 Device 004: ID 8087:0026 Intel Corp. AX201 Bluetooth

xpadneo-lsusb.txt

BakaJzon avatar Sep 16 '24 07:09 BakaJzon

It looks like your controller may have swapped motor enable bits. There's a test program in misc/examples/c_hidraw which you can use to check whether the motor enable bits a properly assigned or work at all.

Just run make hidraw in that directory, you may need to install some dev libraries, e.g. ncurses-dev, to make it work. Then connect your controller, run dmesg to find the current hidraw device name, and run sudo ./hidraw /dev/<HIDRAWNAMEHERE>.

kakra avatar Sep 22 '24 13:09 kakra

I just did the hidraw test and found that the controller vibrates when all of the MotorEnable bits (STR, WEA, LTR, RTR) is turned to 1. The strength bits also affects the strength of the vibration, but only STR and WEA bit works.

I dont know if this information is relevant, but i am using TP-Link UB500 Bluetooth dongle. Also, should i try loading the xpadneo kernel module with some parameters?

hithere-at avatar Sep 22 '24 14:09 hithere-at

Thanks, this is valuable information. Do you really need ALL motor bits set? Or does any bit correspond to some motor?

We already have quirks flags to reverse the bit mask (128) and disable the motor mask complete (4), but the latter just leaves the bits 0. Maybe we should change them to 1 instead:

// hid-xpadneo.c, line 274
	/* do not send these bits if not supported */
	if (unlikely(xdata->quirks & XPADNEO_QUIRK_NO_MOTOR_MASK))
		r->ff.enable = 0;

If you find the remaining information needed, I can create a proper patch. Please leave this open then, I will close this issue via commit.

kakra avatar Sep 22 '24 14:09 kakra

Based on my testing, all of the motor bits has to be set in order for the vibration to work. It seems that any unset motor bit will NOT vibrate the controller. As for the quirks flag, i have tried loading the xpadneo kernel module with +4, +128, +132, -4, -128, and -132 but vibration is still not working. I am testing the vibration with Wine control panel in the Game Controllers menu. Also the controller has dual vibration motor and does NOT have trigger rumble.

This is the commands i used to unload and load the kernel module: sudo modprobe -r hid-xpadneo # unload sudo modprobe hid-xpadneo quirks=ed:bc:9a:85:33:6c{+|-}{quirks} # load

hithere-at avatar Sep 22 '24 15:09 hithere-at

I'll create a PR for you to test.

kakra avatar Sep 22 '24 18:09 kakra

sudo modprobe hid-xpadneo quirks=ed:bc:9a:85:33:6c{+|-}{quirks} # load

Your MAC OUI seems to differ from the original reporter's. Can you send the dmesg output of the controller connecting? Is it the same manufacturer?

kakra avatar Sep 22 '24 18:09 kakra

I am pretty sure i have the same controller as the original reporter. I will compare the reporter's dmesg output and mine. This is the dmesg output. xpadneo-dmesg-log.txt

hithere-at avatar Sep 22 '24 22:09 hithere-at

Oh yes, it is different. If you need more system information, i have attached the output of my controller's device descriptor and my uname -a output.

00000000: 05 01 09 05 a1 01 85 01 09 01 a1 00 09 30 09 31 15 00 27 ff  .............0.1..'.
00000014: ff 00 00 95 02 75 10 81 02 c0 09 01 a1 00 09 33 09 34 15 00  .....u.........3.4..
00000028: 27 ff ff 00 00 95 02 75 10 81 02 c0 05 01 09 32 15 00 26 ff  '......u.......2..&.
0000003c: 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 81 03 05 01 09  ...u.....%.u........
00000050: 35 15 00 26 ff 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01  5..&....u.....%.u...
00000064: 81 03 05 01 09 39 15 01 25 08 35 00 46 3b 01 66 14 00 75 04  .....9..%.5.F;.f..u.
00000078: 95 01 81 42 75 04 95 01 15 00 25 00 35 00 45 00 65 00 81 03  ...Bu.....%.5.E.e...
0000008c: 05 09 19 01 29 0c 15 00 25 01 75 01 95 0c 81 02 15 00 25 00  ....)...%.u.......%.
000000a0: 75 01 95 04 81 03 05 0c 0a b2 00 15 00 25 01 95 01 75 01 81  u............%...u..
000000b4: 02 15 00 25 00 75 07 95 01 81 03 05 0f 09 21 85 03 a1 02 09  ...%.u........!.....
000000c8: 97 15 00 25 01 75 04 95 01 91 02 15 00 25 00 75 04 95 01 91  ...%.u.......%.u....
000000dc: 03 09 70 15 00 25 64 75 08 95 04 91 02 09 50 66 01 10 55 0e  ..p..%du......Pf..U.
000000f0: 15 00 26 ff 00 75 08 95 01 91 02 09 a7 15 00 26 ff 00 75 08  ..&..u.........&..u.
00000104: 95 01 91 02 65 00 55 00 09 7c 15 00 26 ff 00 75 08 95 01 91  ....e.U..|..&..u....
00000118: 02 c0 c0                                                     ...
2986910699 1363
Linux zhezhi 6.9.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 28 Jun 2024 04:32:50 +0000 x86_64 GNU/Linux

hithere-at avatar Sep 22 '24 23:09 hithere-at

Please try the pull request.

kakra avatar Sep 22 '24 23:09 kakra

Thank you, but im sorry i cannot test the pull request right now because im at school. I will get back to you when i get back home.

hithere-at avatar Sep 22 '24 23:09 hithere-at

Hello, it is with great news that the controller now vibrates instead of pure silence. Great work guys. Thank you very much :DDD

The only thing i noticed is that the welcome rumble takes some good amount of time (around 10 seconds i think) but that can be disabled using a kernel parameter. Again, thank you very much.

hithere-at avatar Sep 23 '24 10:09 hithere-at

Thanks. This patch works on my devices too!

Looking forward to it being merged into the master branch! XD

BakaJzon avatar Sep 23 '24 11:09 BakaJzon

I am pretty sure i have the same controller as the original reporter. I will compare the reporter's dmesg output and mine. This is the dmesg output. xpadneo-dmesg-log.txt

It's strange. Did you update the firmware? And the controller LED should be blue.

BakaJzon avatar Sep 23 '24 11:09 BakaJzon

The only thing i noticed is that the welcome rumble takes some good amount of time (around 10 seconds i think)

Okay, then this is another important fix we need to do. It means that the controller doesn't currently correctly handle our rumble stop command in the initial rumble test (the welcome rumble is actually a test to easily see if the controller behaves as expected).

kakra avatar Sep 23 '24 11:09 kakra

It's strange. Did you update the firmware? And the controller LED should be blue.

Looks like this is a cheap Chinese manufacturer who actually uses unofficial unassigned MAC OUIs. I couldn't find your OUIs in any database. I'm not sure if this is officially allowed in most countries because the MAC is sent on radio. Using the device in some countries may thus not be covered by laws if unofficial OUIs are in use. But we don't need to care about that in xpadneo, it only means these controllers will probably have a lot of different random OUIs and we cannot cover all in the driver. I've already updated the docs to reflect that. Maybe we can detect this device in a more general manner if it has a specific size of HID report descriptor, or specific bytes at specific positions.

kakra avatar Sep 23 '24 11:09 kakra

It's strange. Did you update the firmware? And the controller LED should be blue.

Yes, the controller LED is blue and the firmware is updated to v4200. Its the last firmware to support XInput on Bluetooth. Firmware v5700 and v6900 now changed the Bluetooth XInput mode to DInput (PS4) as far as i know.

Maybe you're on a different firmware than mine?

hithere-at avatar Sep 23 '24 11:09 hithere-at

It's strange. Did you update the firmware? And the controller LED should be blue.

Yes, the controller LED is blue and the firmware is updated to v4200. Its the last firmware to support XInput on Bluetooth. Firmware v5700 and v6900 now changed the Bluetooth XInput mode to DInput (PS4) as far as i know.

Maybe you're on a different firmware than mine?

~~v4200 as well.~~ T4N_lite_V63_2024-07-17.ufw Wait, the version number is quite confusing, the date of the latest one(im using) is 20240721 MD5 for this firmware: 6a3bf88a4f2ffbcdd8a57f2e8e65137b from this page, this link

So the manufacturer is probably using random MACs. ~~But it is so cheap!~~

BakaJzon avatar Sep 23 '24 11:09 BakaJzon

Wait, v6300 exists? I need to check them

hithere-at avatar Sep 23 '24 11:09 hithere-at

Well looks like firmware 6300 is not available on the Gamesir Android app, but its available on the website that you attached. Anyways, controller now vibrates and we can wait for the PR to be merged. Thank you everyone for all of the informations.

hithere-at avatar Sep 23 '24 12:09 hithere-at

Can you guys check if https://github.com/atar-axis/xpadneo/pull/496 actually fixes your problem?

kakra avatar Oct 31 '24 15:10 kakra

Do you mean the vibration? Then yes, it now vibrates the controller, but welcome rumble still takes around ~20 seconds before it stops vibrating.

hithere-at avatar Nov 02 '24 00:11 hithere-at

but welcome rumble still takes around ~20 seconds before it stops vibrating.

Okay then we still need some tweaking. I guess we need to send an explicit "strength 0" then to stop it because it doesn't obey the haptic timer parameters.

(actually the welcome rumble is mostly there to test exactly that so I learn how to implement haptic feedback in the future)

kakra avatar Nov 02 '24 04:11 kakra

I just found out that adding the XPADNEO_QUIRK_NO_PULSE quirk makes the welcome rumble behave correctly.

hithere-at avatar Nov 03 '24 00:11 hithere-at

And yes, it does need the strength set to 0 (both STR and WEA on hidraw test) to stop the vibration.

hithere-at avatar Nov 03 '24 01:11 hithere-at

I'll add that then. Thanks.

kakra avatar Nov 03 '24 18:11 kakra

You're welcome. Thank you for the Nova Lite support by the way, really amazing work.

hithere-at avatar Nov 04 '24 10:11 hithere-at

I bought a new controller, and its MAC address is 6A:07:14:8F:07:7B. Clearly, this manufacturer is using randomly generated MAC addresses. That's bad.

Anyway, thanks for your awesome work.

BakaJzon avatar Nov 05 '24 10:11 BakaJzon

Maybe we can find a common trait of those types of controllers, a specific byte in the HID descriptor, a specific length of the descriptor. It could be useful if we could collect some descriptor dumps to see if they differ between firmware versions.

I'm not sure if I can integrate such a detection easily into the source code, but we can give it a try.

kakra avatar Nov 05 '24 20:11 kakra