Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rumble lags behind or does not stop (BLE firmware) #337

Closed
kakra opened this issue Mar 6, 2022 · 18 comments
Closed

Rumble lags behind or does not stop (BLE firmware) #337

kakra opened this issue Mar 6, 2022 · 18 comments
Labels
0 | type: hardware support Support third-party hardware and clones 1 | state: dirty fix The issue is fixed, but in a dirty way
Milestone

Comments

@kakra
Copy link
Collaborator

kakra commented Mar 6, 2022

Here's a rumble packet in btmon using the c_hidraw test

< ACL Data TX: Handle 16 flags 0x00 dlen 15                  #1 [hci0] 9.440042
      ATT: Write Request (0x12) len 10
        Handle: 0x0022
          Data: 0f1414281e050503
> HCI Event: Number of Completed Packets (0x13) plen 5       #2 [hci0] 9.562554
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 5                   #3 [hci0] 9.577123
      ATT: Write Response (0x13) len 0

And I've attached the rumble test btmon log from Rise of The Tomb Raider (outside of Steam using Wine Staging) where I saw the extended rumble effect
btmon-rumble-test-2.txt

Originally posted by @EwokExile in #315 (comment)

@kakra
Copy link
Collaborator Author

kakra commented Mar 15, 2022

@julian-barske Thanks for confirming the rumble issue, it looks like 0x0B22 is behaving differently then... I'm still not sure what is causing it.

Could try if changing the rumble throttle delay helps?

Try setting it to 100ms instead of 10ms. This will certainly modify how rumble feels as it will be reprogrammed only once per 100ms. If it helps, try going to 50ms, then 25ms... You get the idea.

@julian-barske
Copy link

50 feels good to me.
At 40, the issue was noticable, 45 felt a bit weird and 50 was OK (maybe a little bit of lag but I might just be focusing on it too much).

@kakra
Copy link
Collaborator Author

kakra commented Mar 16, 2022

Thanks, that's a useful hint. I'll investigate that once I got the firmware update. Until then you can test that for a while and report back.

The throttler works this way:

When a rumble command is sent, the next rumble command will be buffered (overriding what ever was in the buffer before, it's not a queue) until 10ms have passed (or 50ms in your case). That means, the first rumble after at least 10ms will play at once but updates to the rumble will be in 10ms intervals - which can explain the lag you are feeling with 50ms. 50ms is only 20 Hz. The controller firmware works with around 100 Hz internally, so we used 10ms. It's also what the Windows driver seems to use.

Linux force feedback emulation via rumble works with 20 Hz, so if a game uses that API, it will match the 50 ms you set exactly. 45 ms may be weird because it is an awkward offset from 50 ms.

IOW, anything that doesn't evenly divide by 10 or 50 will probably feel weird.

@EwokExile
Copy link

50 feels like a pretty good spot here as well. Not getting the continuous rumble.

Is there a different interaction happening for the initial connection? That still does the pattern twice (not that it matters if games are good, just curious)

@kakra kakra added 1 | state: dirty fix The issue is fixed, but in a dirty way 0 | type: hardware support Support third-party hardware and clones labels Mar 17, 2022
@kakra kakra added this to To do in Compatibility and Compliance via automation Mar 17, 2022
@kakra kakra added this to the v0.10 milestone Mar 17, 2022
@EwokExile
Copy link

Upon further testing it appears that the rumble pattern repeating itself on initial connection is a separate issue. I can get it to happen reliably on the first connection I make with the controller (1708 on 5.13 firmware). What happens is the controller will do the rumble pattern twice, and will stay connected, but testing with evtest there is nothing from the select button.

If I disconnect and re-connect the controller the pattern only happens once and the select button works as expected

@hadicharara
Copy link

hadicharara commented Mar 20, 2022

If I disconnect and re-connect the controller the pattern only happens once and the select button works as expected

For me, whenever I first connect the controller and the select button doesn't work, the share button acts as the select button instead.

@kakra
Copy link
Collaborator Author

kakra commented Mar 21, 2022

For me, whenever I first connect the controller and the select button doesn't work, the share button acts as the select button instead.

This probably means, your model requires the Share button quirk. The fix should be in master, and will also be queued for the v0.9 branch.

@hadicharara
Copy link

I just checked, and unfortunately, I have compiled the latest xpadneo from master, so I don't think the fix did it. Any logs I might send to help?

@kakra
Copy link
Collaborator Author

kakra commented Mar 21, 2022

@hadicharara Please open a new bug report for this and provide evtest results...

@kakra
Copy link
Collaborator Author

kakra commented Apr 16, 2022

50 feels good to me. At 40, the issue was noticable, 45 felt a bit weird and 50 was OK (maybe a little bit of lag but I might just be focusing on it too much).

I've updated all my controllers to the 5.x firmware versions, and rumble works just fine. I think you observation may be related to Bluetooth device latency settings in bluez. Could you check https://github.com/atar-axis/xpadneo/blob/master/docs/TROUBLESHOOTING.md#high-latency-or-lost-button-events-with-bluetooth-le and report back?

@julian-barske
Copy link

I've updated all my controllers to the 5.x firmware versions, and rumble works just fine. I think you observation may be related to Bluetooth device latency settings in bluez. Could you check https://github.com/atar-axis/xpadneo/blob/master/docs/TROUBLESHOOTING.md#high-latency-or-lost-button-events-with-bluetooth-le and report back?

I set these Bluetooth LE settings, rebooted and changed the XPADNEO_RUMBLE_THROTTLE_DELAY back to 10. Didn't help, same problem, still have to set it to 50.

@k9bbzJavftZaqAqSW3dY
Copy link

I can confirm, bluetooth LE settings had no effect, but the jiffies 50msec setting fixed it. It's easy to reproduce this with DiRT rally 2.0, because the rumble events are stacking up ridiculously quickly (drive 10 seconds, get 30 seconds rumble). I fixed it conveniently by modifying the AUR PKGBUILD file, adding: sed -i 's/msecs_to_jiffies(10)/msecs_to_jiffies(50)/g' hid-xpadneo/src/xpadneo.h

@kakra
Copy link
Collaborator Author

kakra commented Apr 23, 2022

We should identify which models are affected because I cannot reproduce it here. It looks like multiple effects from ff-memless may be running concurrent but technically that should not be possible because we serialize all effects in the driver.

@kakra
Copy link
Collaborator Author

kakra commented Apr 23, 2022

I set these Bluetooth LE settings, rebooted

I wonder if the controller needs to be removed and re-paired if those settings were changed. The settings may be persisted in the device cache... Maybe give it a try.

@kakra
Copy link
Collaborator Author

kakra commented Apr 24, 2022

I think I can reproduce it with one model, I'll need to check the others.

@k9bbzJavftZaqAqSW3dY
Copy link

i'm on model 1708.

@kakra
Copy link
Collaborator Author

kakra commented Apr 24, 2022

Looks like all models updated to firmware 5.13 show the problem.

@EwokExile
Copy link

I've encountered the problem with both 1708 and 1914 models

@kakra kakra closed this as completed in 74ea7c1 Apr 30, 2022
Compatibility and Compliance automation moved this from To do to Done Apr 30, 2022
kakra added a commit to kakra/xpadneo that referenced this issue Apr 30, 2022
Firmware 5.13 and later (all BLE models) queue rumble effects if we
send rumble commands faster than 20 Hz. This commit fixes it and
actually matches the rate the ff-memless emulation is supposed to send
us for single effects. ff-memless may still combine several effects
and send them at higher update rates thus we need to limit it here.

Fixes: atar-axis#337
Fixes: atar-axis#311
Maybe-affects: atar-axis#347
Maybe-fixes: atar-axis#319
Maybe-fixes: atar-axis#180
Signed-off-by: Kai Krakow <kai@kaishome.de>
kakra added a commit that referenced this issue May 26, 2022
Firmware 5.13 and later (all BLE models) queue rumble effects if we
send rumble commands faster than 20 Hz. This commit fixes it and
actually matches the rate the ff-memless emulation is supposed to send
us for single effects. ff-memless may still combine several effects
and send them at higher update rates thus we need to limit it here.

Fixes: #337
Fixes: #311
Maybe-affects: #347
Maybe-fixes: #319
Maybe-fixes: #180
Signed-off-by: Kai Krakow <kai@kaishome.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 | type: hardware support Support third-party hardware and clones 1 | state: dirty fix The issue is fixed, but in a dirty way
Development

No branches or pull requests

5 participants