Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH v0 0/2] HID: nintendo: avoid BT rumble disconnections
@ 2023-02-03 21:51 Daniel J. Ogorchock
  2023-02-03 21:51 ` [PATCH v0 1/2] HID: nintendo: prevent rumble queue overruns Daniel J. Ogorchock
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Daniel J. Ogorchock @ 2023-02-03 21:51 UTC (permalink / raw)
  To: linux-input
  Cc: jikos, benjamin.tissoires, Roderick.Colenbrander,
	Daniel J. Ogorchock

The hid-nintendo driver has been plagued by an issue where rumble
command traffic to bluetooth-connected controllers can cause frequent
power downs of the controllers.

Digging into other pro controller driver implementations, I've not found
anything that hid-nintendo is doing incorrectly. Some implementations
seem to be working around the same problem (e.g. libsdl's hidapi
implementation rate limits rumble commands to avoid the problem).

hid-nintendo already rate limits rumble control packets, but that does
not solve the problem.

Using btmon output, I've fuond the the disconnections reliably occur
shortly after the controller's reporting rate become erratic. The
controller is meant to report input packets roughly every 15ms. Sending
rumble commands can sometimes result in the input packets arriving in
bursts/batches. Once the controller and/or BT stack enters this state,
even halting rumble commands will never allow the reporting rate to
recover to nominal. The controller will eventually disconnect.

This patch set strives to avoid the problematic scenario. It detects if
input reports arrive at clearly incorrect deltas. During these times,
the driver will hold off on transmitting any rumble commands to the
controller. This approach has allowed the reporting rate to reliably
recover in my testing. I've not been able to generate a controller
disconnection during hours of testing games with frequent rumble.

The behavior of this mechanism is tunable using #defines. We may need to
tweak/tune as the mitigation is used on different hardware setups.

My suspicion is that the core issue is somewhere in the bluez stack. My
next step is to investigate that lead in more detail. This patchset at
least allows for use of the controllers via bluetooth with rumble
enabled without frequently disconnecting.

Daniel J. Ogorchock (2):
  HID: nintendo: prevent rumble queue overruns
  HID: nintendo: fix rumble rate limiter

 drivers/hid/hid-nintendo.c | 95 ++++++++++++++++++++++++++++++++++----
 1 file changed, 86 insertions(+), 9 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-10 14:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-03 21:51 [PATCH v0 0/2] HID: nintendo: avoid BT rumble disconnections Daniel J. Ogorchock
2023-02-03 21:51 ` [PATCH v0 1/2] HID: nintendo: prevent rumble queue overruns Daniel J. Ogorchock
2023-02-03 21:51 ` [PATCH v0 2/2] HID: nintendo: fix rumble rate limiter Daniel J. Ogorchock
2023-03-07 21:03 ` [PATCH v0 0/2] HID: nintendo: avoid BT rumble disconnections Silvan Jegen
2023-03-07 21:06 ` Silvan Jegen
2023-03-10 14:02 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox