Author: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun Nov 30 15:50:59 2025 +0000 Refactor PCON creation logic and update sai-power - Extracted `saip_pcon_create` from `p-conf.c` to `p-utils.c` for reuse. - Updated `p-sai.c` to dynamically create PCONs if a builder registers with an unknown PCON name, logging a warning. - This ensures builders can register even if `sai-power` configuration is missing the PCON definition, improving robustness against configuration mismatches. diff --git a/src/power/p-ws-server.c b/src/power/p-ws-server.c index 05ed85e..107511d 100644 --- a/src/power/p-ws-server.c +++ b/src/power/p-ws-server.c @@ -168,7 +168,14 @@ saip_m_rx(void *userobj, const uint8_t *buf, size_t len, int flags) __func__, sb->name, pc->name); /* Update PCON stay state */ pc->manual_stay = stay->stay_on; - saip_pcon_start_check(); + + /* If stay is cleared, schedule power off check */ + if (!stay->stay_on) + saip_pcon_start_check(); + else { + /* If stay is set, ensure it is on immediately */ + saip_switch(pc, 1); + } goto found; } } lws_end_foreach_dll(b_node);