fix: fire CEC AND DPMS unconditionally for power commands

Pi5 cec-ctl returns ok even when monitor ignores CEC. Doing both
covers TVs (CEC) and monitors (DPMS) without detection logic.
Both idempotent.
This commit is contained in:
Mitchell R 2026-05-11 11:18:31 +02:00
parent 0cd508a2ec
commit 5a67c80caa

View file

@ -9,25 +9,25 @@ use tracing::{info, warn};
const CEC_DEVICE: &str = "/dev/cec0"; const CEC_DEVICE: &str = "/dev/cec0";
/// Put the display to sleep — try CEC first, fall back to compositor DPMS. /// Put the display to sleep — fire both CEC and DPMS.
/// CEC handles TVs that listen. DPMS handles monitors that don't.
/// Both are idempotent; doing both is cheap and covers both cases.
pub fn standby() { pub fn standby() {
info!("power: standby"); info!("power: standby");
if !cec_standby() { cec_standby();
if !wlr_output_off() { if !wlr_output_off() {
xset_dpms_off(); xset_dpms_off();
} }
} }
}
/// Wake the display — try CEC first, fall back to compositor DPMS. /// Wake the display — fire both CEC and DPMS.
pub fn wake() { pub fn wake() {
info!("power: wake"); info!("power: wake");
if !cec_wake() { cec_wake();
if !wlr_output_on() { if !wlr_output_on() {
xset_dpms_on(); xset_dpms_on();
} }
} }
}
fn cec_standby() -> bool { fn cec_standby() -> bool {
run_cec(&["--standby", "--to", "0"]) run_cec(&["--standby", "--to", "0"])