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 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-15 18:40:35 +02:00
parent df3244d335
commit f8bcfcfec6
2 changed files with 15 additions and 1 deletions
+9
View File
@@ -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));
+6 -1
View File
@@ -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):