From 30768087bc14377b776e97e45466478a6e494ebb Mon Sep 17 00:00:00 2001 From: user Date: Sat, 4 Oct 2025 02:57:53 +0200 Subject: [PATCH] Move smc capability logging out of global scope so it does not interfere with status_csv command --- battery.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/battery.sh b/battery.sh index 6b7b9ed..5691f94 100755 --- a/battery.sh +++ b/battery.sh @@ -184,7 +184,10 @@ function smc_write_hex() { [[ $(smc -k CHIE -r) =~ "no data" ]] && smc_supports_adapter_chie=false || smc_supports_adapter_chie=true; [[ $(smc -k CH0I -r) =~ "no data" ]] && smc_supports_adapter_ch0i=false || smc_supports_adapter_ch0i=true; [[ $(smc -k CH0J -r) =~ "no data" || $(smc -k CH0J -r) =~ "Error" ]] && smc_supports_adapter_ch0j=false || smc_supports_adapter_ch0j=true; -log "SMC capabilities: tahoe=$smc_supports_tahoe legacy=$smc_supports_legacy CHIE=$smc_supports_adapter_chie CH0I=$smc_supports_adapter_ch0i CH0J=$smc_supports_adapter_ch0j" + +function log_smc_capabilities() { + log "SMC capabilities: tahoe=$smc_supports_tahoe legacy=$smc_supports_legacy CHIE=$smc_supports_adapter_chie CH0I=$smc_supports_adapter_ch0i CH0J=$smc_supports_adapter_ch0j" +} ## ################# ## SMC Manipulation @@ -609,6 +612,8 @@ fi # Maintain at level if [[ "$action" == "maintain_synchronous" ]]; then + log_smc_capabilities + # Checking if the calibration process is running if test -f "$calibrate_pidfile"; then pid=$(cat "$calibrate_pidfile" 2>/dev/null) @@ -688,6 +693,8 @@ fi # Maintain at voltage if [[ "$action" == "maintain_voltage_synchronous" ]]; then + log_smc_capabilities + # Recover old maintain status if old setting is found if [[ "$setting" == "recover" ]]; then