From f8bcfcfec6b03667369d4548d37ef6ef518c98f4 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 15 Oct 2026 18:40:35 +0200 Subject: [PATCH] DualSense lights: pin the host defaults, document quit and the mute LED Tests pin player 1 (0x04), the default blue (0, 0, 128) and the instant bit (0x20) to hid-playstation.c and SDL; the docs say what Horizon resets on quit (more than SDL or the kernel do) and that the mute LED is never touched. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-dualsense/src/lib.rs | 9 +++++++++ docs/controllers.md | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/horizon-dualsense/src/lib.rs b/crates/horizon-dualsense/src/lib.rs index 2027b4584..438d8f6fe 100644 --- a/crates/horizon-dualsense/src/lib.rs +++ b/crates/horizon-dualsense/src/lib.rs @@ -346,6 +346,15 @@ mod tests { assert_ne!(out.bluetooth(Vibration::V2, 1)[74..], r[74..]); } + #[test] + fn host_defaults() { + // hid-playstation.c: player 1 is BIT(2) ("--x--"), as SDL's first pattern 0x04; the + // blue it gives a pad; SDL's 0x20 switches LEDs without fading. + assert_eq!(PLAYER_1, 0x04); + assert_eq!(DEFAULT_LIGHTBAR, [0, 0, 128]); + assert_eq!(PLAYER_LEDS_INSTANT, 0x20); + } + #[test] fn dualsense_ids() { assert!(is_dualsense(0x054c, 0x0ce6)); diff --git a/docs/controllers.md b/docs/controllers.md index ec0015790..4e3d82a75 100644 --- a/docs/controllers.md +++ b/docs/controllers.md @@ -446,7 +446,12 @@ Nether, violet in the End. Both at half brightness (the pad's full light is glaring); menus keep the last colour. The player LEDs show player 1 (the middle LED). Off leaves both to the pad. When Horizon lets go of the pad, a lightbar or LEDs it changed go back to a host's defaults: blue (0, 0, 128) -and the middle LED, as Linux's driver gives a first pad. +and the middle LED, as Linux's driver gives a first pad (neither SDL nor +the kernel resets anything when it lets go; Horizon does, so the pad never +keeps a game's colour or a stiff trigger). The microphone's mute LED is +never touched (flags 1, bit 0 stays clear): whatever the system set +stays. Over Bluetooth the colour waits for the pad's connection +animation (see "DualSense output"). Verified against the references only. Byte layout from public references, read for facts; no code is copied from them (the kernel and dualsensectl are GPL):