fix(gamepad)!: improve PlayStation controller compatibility - #94
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #94 +/- ##
==========================================
+ Coverage 75.23% 75.32% +0.09%
==========================================
Files 34 34
Lines 8091 8131 +40
Branches 3030 3044 +14
==========================================
+ Hits 6087 6125 +38
- Misses 1467 1711 +244
+ Partials 537 295 -242
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 8 files with indirect coverage changes Continue to review full report in Codecov by Harness.
|
|
As a small note: you might want to use Bluetooth as the default profile type for DualShock4 as well as it's using the same EDIT: Did a quick test with ba53378 applied. Result is looking a lot better for the gyro but there's still noise spikes that cause the calibration to fail before it can finish. I know it's still a draft and you're working on it but I wanted to let you know that you're already getting a lot closer to solving this. |
780c758 to
b7cd9a1
Compare
b7cd9a1 to
91365cf
Compare
|
@Kishi85 thanks! I was going to ping you after I had time to test this, but you can probably test everything on the Linux side faster than me. I added some adjustments for DS4 as well a tweak that may fix the gyro spikes. I probably should have tested this better in the first place, but I guess I overlooked the gyro stuff (as I normally prefer the Xbox pads). I'm assuming Moonlight Android doesn't support the gyro and probably just QT does? If so I'll need to find a better way to test this. |
I'll test the latest commit first thing tomorrow and give you feedback. Moonlight-Android does support the gyro but IIRC there's a config option that needs to be enabled for gyro data to be sent to Sunshine. |
|
I must be blind because I don't see any such option with the DualSense connected to the Nvidia Shield. I see something about it in the code though. https://github.com/moonlight-stream/moonlight-android/blob/f10085f552b367cf7203007693d91c322a0a2936/app/src/main/java/com/limelight/preferences/StreamSettings.java#L304 Edit: Gyro is still noisy, looking into it more. Edit 2: Confirmed calibration works in CachyOS host using Moonlight QT in LizardByte/Sunshine#5531 Also discovered that rumble starts working only after opening the calibration in steam, even if rumble is already on before opening the calibration. That's probably a steam bug I guess. Edit 3: DS4 seems to be working just as well (now). This needed some additional tweaks though in 0c38b9f |
DualShock 4 Bluetooth input reports now set the HID-present header bit (0x80) while keeping existing BT framing and CRC behavior. This enables HIDAPI/SDL consumers to accept live input after hotplug on Linux. Updated report and Linux consumer tests to assert the new behavior, and refreshed platform-support docs to describe the BT report contract and unchanged transport boundaries.
Might require a newer Android base version that the Shield does not have? Like Android 14 is required for rumble with Bluetooth controllers? Not sure which Android version the Shield currently ships. On my phone (Pixel with Android 17) those options show up:
On my Chromecast wiith GoogleTV (Android 14) I've only got the first option available but that's to be expected as that device does not have a gyro built-in.
Gyro is now working fine for me as well with this PR and LizardByte/Sunshine#5531 applied. Not sure about rumble not working instantly for you but on my end it is picked up and working upon connecting. Another additional tool that could be very useful for further development and testing (without having to open Steam's controller settings which could fix things that are otherwise broken, like rumble seems to be on your machine): https://store.steampowered.com/app/2104320/ToS_Gamepad_Tester/ |
|
Good to know about the Android version requirement, that will make it a little easier to test everything out for me. Hopefully newer Android supports the full range of DualSense features. On the shield I think all of the following didn't work properly:
And good to know about the gamepad tester. I'd like to do one more test on this PR with Sunshine on Windows to see if things improve there as well. If all good, then I'll merge it. Edit: Tested on Windows as well, but using Moonlight Android as a client. Gyro seems to be working fine, but the following are still not working (LED and battery). Touchpad just controls the host mouse even if the setting is off in moonlight settings. Will test from Moonlight-QT to see if these are client issues. Edit 2: From Moonlight-QT touchpad works as expected. LED and battery still not working. Probably just due to these appearing as USB instead of Bluetooth on the Sunshine host in Windows. And another possible bug on Windows is that Steam reports the gamepad needs a firmware update (same from Android or Moonlight-QT clients). Looking into this closer. |
|
From my experience anything above or equal to Android 14 has DualSense fully support over Bluetooth. USB might have it a few Versions earlier but I'm unable to verify due to lack of a matching device. |
Map the default Bluetooth DualShock 4 and DualSense profiles to effective USB framing on the Windows VHF backend so the exposed descriptor, reports, and `Gamepad::profile()` match what HIDAPI, Steam, and SDL can actually use. Update the public docs/runtime comments to explain the backend-selected effective transport, refresh the emulated DualSense firmware report to match the base controller series/version, and extend Windows protocol/backend/consumer tests to cover the new transport behavior plus RGB LED output handling.
|
|
100% working on Windows Sunshine host now as well. @Kishi85 if you could double check on Linux that would be great, otherwise I will test it again tonight. And should we disable "randomize mac" by default? I don't think re-doing the gamepad setup on each connection is the most user friendly thing. |
I've been testing as requested but somehow my LED control (via Steam's settings) is not working (with both of today's versions I've tested). Not sure as to why that is but I usually have the LED turned off anyway so I've not noticed it until now. Everything else is working perfectly fine now as far as I can see. Could also be that my controller has a firmware update pending (which will require me to start up Windows for once to do as there's no way to do that on Linux yet) or something with my streaming client is directly interfering here. So it's probably best if you test everything yourself as well just to be sure. Using index-based controller by default would be sensible as it's likely what most users expect probably. EDIT: Rebooting the controller seems to have fixed LED control. Still would be good if you could double-check everything. |
After installing the latest Sunshine build in that PR (on CachyOS), I thought something broke as well as the gamepad wasn't appearing in Steam. Restarting Steam resolved it though. Tested gyro calibration, LED, touchpad, battery, and rumble. All working, so going to go ahead and merge. |




Description
Default DualShock 4 and DualSense profiles to Bluetooth framing for
reliable Linux and Steam hotplug behavior. Set the DS4 HID-present flag,
correct DualSense motion scaling, and advance sensor metadata through
serialized periodic reports.
Use effective USB profiles on Windows VHF so descriptors and report
framing match HIDAPI transport detection. Restore LED and rumble output
and report a coherent base DualSense firmware identity.
Add cross-platform backend, protocol, report, and consumer coverage.
BREAKING CHANGE: profiles::dualshock4() and profiles::dualsense() now
default to Bluetooth framing. Use the corresponding _usb() factories
when USB framing is required.
Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage
See our AI usage policy.