feat(protocol): TLV metadata on controller arrival, player LED and mic LED extensions #137

Open
hkirste wants to merge 2 commits from hkirste/feat/controller-metadata-tlv into master
hkirste commented 2026-04-05 01:08:44 -05:00 (Migrated from github.com)

Summary

Adds three Sunshine protocol extensions for DualSense controller support:

TLV metadata on controller arrival:

  • LiSendControllerArrivalEventWithMetadata() appends optional TLV (Type-Length-Value) entries after the fixed arrival packet fields
  • Defined tag LI_CTRL_META_TAG_FIRMWARE_INFO (0x01): carries the raw 64-byte HID feature report 0x20 from the client's physical controller
  • Existing LiSendControllerArrivalEvent() preserved as a thin wrapper (backwards compatible)
  • Old hosts ignore trailing bytes; old clients don't send them

Player LED (0x5504):

  • Forwards the 5-bit player indicator LED bitmask from host to client
  • Standard values: P1=0x04, P2=0x0A, P3=0x15, P4=0x1B, all=0x1F

Mic LED (0x5505):

  • Forwards the mic mute LED state from host to client
  • Values: 0=off, 1=on (solid), 2=pulse (blink)

Adds ConnListenerSetPlayerLed and ConnListenerSetMicLed to CONNECTION_LISTENER_CALLBACKS.

Context

These extensions support Sunshine's WinUHid-based virtual DualSense emulation on Windows (LizardByte/Sunshine#4948). The firmware passthrough prevents spurious "firmware update required" prompts, and the LED extensions enable full DualSense indicator fidelity during streaming.

Test plan

  • Firmware TLV parsed correctly by Sunshine, real firmware version appears on virtual DualSense
  • Player LED and mic LED states forwarded end-to-end from host game to physical controller on client
  • Backwards compatible: old clients without metadata work unchanged, old hosts ignore trailing bytes
## Summary Adds three Sunshine protocol extensions for DualSense controller support: **TLV metadata on controller arrival:** - `LiSendControllerArrivalEventWithMetadata()` appends optional TLV (Type-Length-Value) entries after the fixed arrival packet fields - Defined tag `LI_CTRL_META_TAG_FIRMWARE_INFO` (0x01): carries the raw 64-byte HID feature report 0x20 from the client's physical controller - Existing `LiSendControllerArrivalEvent()` preserved as a thin wrapper (backwards compatible) - Old hosts ignore trailing bytes; old clients don't send them **Player LED (0x5504):** - Forwards the 5-bit player indicator LED bitmask from host to client - Standard values: P1=0x04, P2=0x0A, P3=0x15, P4=0x1B, all=0x1F **Mic LED (0x5505):** - Forwards the mic mute LED state from host to client - Values: 0=off, 1=on (solid), 2=pulse (blink) Adds `ConnListenerSetPlayerLed` and `ConnListenerSetMicLed` to `CONNECTION_LISTENER_CALLBACKS`. ## Context These extensions support Sunshine's WinUHid-based virtual DualSense emulation on Windows (LizardByte/Sunshine#4948). The firmware passthrough prevents spurious "firmware update required" prompts, and the LED extensions enable full DualSense indicator fidelity during streaming. ## Test plan - [x] Firmware TLV parsed correctly by Sunshine, real firmware version appears on virtual DualSense - [x] Player LED and mic LED states forwarded end-to-end from host game to physical controller on client - [x] Backwards compatible: old clients without metadata work unchanged, old hosts ignore trailing bytes
This pull request has changes conflicting with the target branch.
  • src/InputStream.c
  • src/Limelight.h
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'hkirste/feat/controller-metadata-tlv:hkirste/feat/controller-metadata-tlv'
git switch 'hkirste/feat/controller-metadata-tlv'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'hkirste/feat/controller-metadata-tlv'
git switch 'hkirste/feat/controller-metadata-tlv'
git rebase 'master'
git switch 'master'
git merge --ff-only 'hkirste/feat/controller-metadata-tlv'
git switch 'hkirste/feat/controller-metadata-tlv'
git rebase 'master'
git switch 'master'
git merge --no-ff 'hkirste/feat/controller-metadata-tlv'
git switch 'master'
git merge --squash 'hkirste/feat/controller-metadata-tlv'
git switch 'master'
git merge --ff-only 'hkirste/feat/controller-metadata-tlv'
git switch 'master'
git merge 'hkirste/feat/controller-metadata-tlv'
git push origin 'master'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-moonlight-stream/moonlight-common-c!137
No description provided.