DS5 Controller fixes - Gyro data and value scaling - #151
Merged
Conversation
https://github.com/moonlight-stream/moonlight-common-c/blob/e41355ea01670fd4c830b384009d31dd0339a705/src/Limelight.h#L810 ```c // LI_MOTION_TYPE_ACCEL should report data in m/s^2 (inclusive of gravitational acceleration). // LI_MOTION_TYPE_GYRO should report data in deg/s. ``` https://github.com/games-on-whales/inputtino/blob/f4ce2b0df536ef309e9ff318f75b460f7097d7c1/include/inputtino/input.hpp#L410-L412 ```c /** * Acceleration should report data in m/s^2 (inclusive of gravitational acceleration). * Gyroscope should report data in deg/s. * * The x/y/z axis assignments follow SDL's convention documented here: * https://github.com/libsdl-org/SDL/blob/96720f335002bef62115e39327940df454d78f6c/include/SDL3/SDL_sensor.h#L80-L124 */ ``` Moonlight delivers and inputtiino expects m/s^2 and deg/s – we don't need any conversion here.
Match the Channel Count with what moonlight-common-c uses: https://github.com/moonlight-stream/moonlight-common-c/blob/e41355ea01670fd4c830b384009d31dd0339a705/src/Limelight-internal.h#L66 Enables a reliable gyro data stream for a ps5 dualsense controller.
maugsburger
marked this pull request as ready for review
July 30, 2026 11:41
Owner
|
I hadn't tried gyro in a while, thanks for looking into it. I tried gyro on gamepad.set_motion(
motion.motion_type,
motion.x.to_radians(),
motion.y.to_radians(),
motion.z.to_radians(),
);After that the gyro seems to behave identically compared to a DS5 connected directly to Steam. Why did you need to change the scaling? |
Contributor
Author
As outlined in fa728e1 the comments in both libraries suggest they already work on the same units. TBH, never verified it end-to-end after I got it finally working. |
Owner
|
I checked and restored the original gyro scaling. They seemed to work for me and it also seems to be what wolf does. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug: (Nearly) no gyro data arrived on the streaming host.
Confirmed by evtest:
Client:
Server - mostly empty reports, but sometimes a bit of data comes through.:
Problem turned out to be different
ENET_PACKET_FLAG_RELIABLEflagsand a motion (gyro/accel) packet to
CTRL_CHANNEL_SENSOR_BASE + controllerNumber(line 1569) — sent unreliable, since it's fine to drop a stale gyro sample:and ENet therefore resetting the counter in
enet_peer_setup_outgoing_command(enet/peer.c:636-672):but then tokio-enet in moonshine discards the "too old" packets as stale:
moonshine's ENet reimplementation,
handle_send_unreliable(tokio-enet-0.1.1/src/host.rs:1178-1207):By giving every input channel its own enet channel we no longer have this problem with discarded packets.
The removal of
to_radianswas merely a random find when comparing the data types.