[PR #362] [MERGED] DualSense lightbar and player LEDs #2521

Closed
opened 2026-11-02 15:56:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/362
Author: @ludovic111
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @ludovic111

Base: main ← Head: feat/dualsense-lights


📝 Commits (4)

  • 0681064 DualSense vibration: shaped pulses, HD haptics on USB (opt-in)
  • be57f82 DualSense HD haptics: Windows' device name, the arming rule, Bluetooth notes
  • df3244d DualSense lightbar and player LEDs
  • f8bcfcf DualSense lights: pin the host defaults, document quit and the mute LED

📊 Changes

10 files changed (+447 additions, -8 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client/src/game/pad.rs (+61 -3)
📝 crates/horizon-client/src/gamepad.rs (+130 -1)
📝 crates/horizon-client/src/options_horizon.rs (+1 -0)
📝 crates/horizon-client/src/options_ui.rs (+16 -0)
📝 crates/horizon-dualsense/Cargo.toml (+2 -0)
📝 crates/horizon-dualsense/src/device.rs (+10 -2)
➕ crates/horizon-dualsense/src/haptics.rs (+149 -0)
📝 crates/horizon-dualsense/src/lib.rs (+14 -0)
📝 docs/controllers.md (+63 -2)

📄 Description

What

Last DualSense PR, stacked on #361. This one adds the lightbar and player LEDs, off-safe.

  • "Lightbar: Health / Dimension / Off" in the controller options (lightbar:, Health by default).
    • Health: green → amber at half → red.
    • Dimension: blue in the Overworld, orange in the Nether, violet in the End.
    • Both are at half brightness; menus keep the last colour.
  • Player LEDs show player 1 (the middle LED). Off leaves both to the pad.
  • The first write after opening fades out the firmware's own blue light (RELEASE_LEDS + LIGHT_OUT, as hid-playstation.c does).
  • When Horizon lets go (quit, controllers off), lights it changed go back to a host's defaults: blue (0, 0, 128) and the middle LED.

Verified

  • Unit tests: colour endpoints and midpoint, dimensions differ, Off = none, option round-trip.
  • On the pad over USB (in #348's session), the example cycled red/green/blue/violet and the player LED patterns. The writes succeeded, but I can't see the pad, so the colours themselves are unconfirmed.
  • In game: not verified on the pad (it was unplugged).

Self-check

cargo fmt --check / clippy -D warnings (horizon-client, horizon-dualsense)   ok
cargo test -p horizon-dualsense, -p horizon-client --lib gamepad            ok
tools/parity.py --changed origin/main (whole stack, local)                  running locally, result in the final report

Needs Ludovic

Look at the lightbar: take damage (green → red), go to the Nether with Lightbar = Dimension, set it Off. Quit: it should go back to blue with the middle LED.

Reference audit (dualsense-2, no pad)

Every byte was checked against SDL, the Linux kernel, dualsensectl and Nielk1's notes, and the discrepancies were fixed in this PR's top commit; see the audit comment. The self-check on the stack top passed: fmt, workspace clippy -D warnings, cargo test -p horizon-dualsense -p horizon-client. Anything not listed above as verified on hardware is verified against the references only.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/362 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/dualsense-lights` --- ### 📝 Commits (4) - [`0681064`](https://github.com/horizon-rust/horizon/commit/0681064767fc79401e0e320ac0543e1f68769c3a) DualSense vibration: shaped pulses, HD haptics on USB (opt-in) - [`be57f82`](https://github.com/horizon-rust/horizon/commit/be57f82a07342195f1a2dda7f8b388f54e096d45) DualSense HD haptics: Windows' device name, the arming rule, Bluetooth notes - [`df3244d`](https://github.com/horizon-rust/horizon/commit/df3244d33534d633b3e0518a5ccba91f8f5ff3c2) DualSense lightbar and player LEDs - [`f8bcfcf`](https://github.com/horizon-rust/horizon/commit/f8bcfcfec6b03667369d4548d37ef6ef518c98f4) DualSense lights: pin the host defaults, document quit and the mute LED ### 📊 Changes **10 files changed** (+447 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client/src/game/pad.rs` (+61 -3) 📝 `crates/horizon-client/src/gamepad.rs` (+130 -1) 📝 `crates/horizon-client/src/options_horizon.rs` (+1 -0) 📝 `crates/horizon-client/src/options_ui.rs` (+16 -0) 📝 `crates/horizon-dualsense/Cargo.toml` (+2 -0) 📝 `crates/horizon-dualsense/src/device.rs` (+10 -2) ➕ `crates/horizon-dualsense/src/haptics.rs` (+149 -0) 📝 `crates/horizon-dualsense/src/lib.rs` (+14 -0) 📝 `docs/controllers.md` (+63 -2) </details> ### 📄 Description ## What Last DualSense PR, stacked on #361. This one adds the **lightbar and player LEDs**, off-safe. - "Lightbar: Health / Dimension / Off" in the controller options (`lightbar:`, Health by default). - Health: green → amber at half → red. - Dimension: blue in the Overworld, orange in the Nether, violet in the End. - Both are at half brightness; menus keep the last colour. - Player LEDs show player 1 (the middle LED). Off leaves both to the pad. - The first write after opening fades out the firmware's own blue light (`RELEASE_LEDS` + `LIGHT_OUT`, as `hid-playstation.c` does). - When Horizon lets go (quit, controllers off), lights it changed go back to a host's defaults: blue (0, 0, 128) and the middle LED. ## Verified - Unit tests: colour endpoints and midpoint, dimensions differ, Off = none, option round-trip. - On the pad over USB (in #348's session), the example cycled red/green/blue/violet and the player LED patterns. The writes succeeded, but I can't see the pad, so the colours themselves are unconfirmed. - In game: not verified on the pad (it was unplugged). ## Self-check ``` cargo fmt --check / clippy -D warnings (horizon-client, horizon-dualsense) ok cargo test -p horizon-dualsense, -p horizon-client --lib gamepad ok tools/parity.py --changed origin/main (whole stack, local) running locally, result in the final report ``` ## Needs Ludovic Look at the lightbar: take damage (green → red), go to the Nether with Lightbar = Dimension, set it Off. Quit: it should go back to blue with the middle LED. ## Reference audit (dualsense-2, no pad) Every byte was checked against SDL, the Linux kernel, dualsensectl and Nielk1's notes, and the discrepancies were fixed in this PR's top commit; see [the audit comment](https://github.com/ludovic111/horizon/pull/362#issuecomment-6198164840). The self-check on the stack top passed: fmt, workspace clippy `-D warnings`, `cargo test -p horizon-dualsense -p horizon-client`. Anything not listed above as verified on hardware is verified against the references only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56:54 +07:00
Sign in to join this conversation.
No milestone
No project
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
horizon-rust/horizon#2521
No description provided.