fluid-lab / gamepad-navigator

GSoC 2020 project
Other
6 stars 10 forks source link

Some controllers vibrate too hard and long #140

Open duhrer opened 6 months ago

duhrer commented 6 months ago

In recent testing work, I noticed that vibration-triggering events (like scrolling too far up) were continuing for far too long (like 30 seconds), when they should last for half a second. They also seemed more intense than intended.

After some testing with an online gamepad tester, I realised that the controller was showing up twice, once connected via bluetooth, and once connected via USB. Since we send vibration events to all connected game controllers that support it, a single controller was being asked to vibrate twice, and the odd behaviour was the result.

I looked into things, it seems like it's possible to end up with duplicate controllers if you first connect via bluetooth and then connect a USB cable. Unfortunately, their IDs are different, and there are not great options for comparing them. For something like the DualShock, the slight offset of each of the thumb sticks in the resting state is a kind of signature, but even a short time difference in checking the values would be thrown off if any stick is in use.

As the circumstances to reproduce are very specific, I am more documenting this for future reference than planning to fix it at this point. I may revisit when and if we decide to improve the support for multiple game pads.

For now, the workaround is simply to only connect via one means or another, i.e. either use USB or use bluetooth.