From b047aee25e1c0af072efd64a43aa317605afb907 Mon Sep 17 00:00:00 2001 From: Thomas Koch Date: Sun, 12 Jan 2025 16:06:44 +0100 Subject: [PATCH] tlp chargeonce: better explain the process in the output Reference: * https://github.com/linrunner/TLP/issues/773 --- bat.d/05-thinkpad | 3 +++ bat.d/10-thinkpad-legacy | 2 ++ bat.d/55-cros-ec | 2 ++ tlp.in | 3 --- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bat.d/05-thinkpad b/bat.d/05-thinkpad index d6ec5038..d9d81e52 100644 --- a/bat.d/05-thinkpad +++ b/bat.d/05-thinkpad @@ -692,10 +692,13 @@ batdrv_chargeonce () { return 3 fi + printf "Current charge level of battery %s is %s%%, we are about to charge to %s%%.\n" "$_bat_str" "$soc" "$cur_stop" 1>&2 printf "Setting temporary charge threshold for battery %s:\n" "$_bat_str" 1>&2 write_sysf "$temp_start" "$_bf_start" || rc=5 if [ $rc -eq 0 ]; then printf " start = %3d\n" "$temp_start" 1>&2 + cprintf "notice" "Charging start now, keep the charger connected.\n" 1>&2 + printf "If charging does not start immediately, unplug the charger for a moment and reconnect it.\n" 1>&2 else cprintf "err" " start = %3d (Error: write failed)\n" "$temp_start" 1>&2 fi diff --git a/bat.d/10-thinkpad-legacy b/bat.d/10-thinkpad-legacy index b8fdd3ea..38876d4a 100644 --- a/bat.d/10-thinkpad-legacy +++ b/bat.d/10-thinkpad-legacy @@ -556,6 +556,7 @@ batdrv_chargeonce () { return 3 fi + printf "Current charge level of battery %s is %s%%, we are about to charge to %s%%.\n" "$_bat_str" "$soc" "$cur_stop" 1>&2 printf "Setting temporary charge threshold for battery %s:" "$_bat_str" 1>&2 case $_bm_thresh in tpsmapi) @@ -565,6 +566,7 @@ batdrv_chargeonce () { if [ $rc -eq 0 ]; then printf " start = %3d\n" "$temp_start" 1>&2 + cprintf "notice" "Charging starts now, keep the charger connected.\n" 1>&2 else cprintf "err" " start = %3d (Error: write failed)\n" "$temp_start" 1>&2 fi diff --git a/bat.d/55-cros-ec b/bat.d/55-cros-ec index 9697cf50..b613234c 100644 --- a/bat.d/55-cros-ec +++ b/bat.d/55-cros-ec @@ -550,10 +550,12 @@ batdrv_chargeonce () { return 3 fi + printf "Current charge level of battery %s is %s%%, we are about to charge to %s%%.\n" "$_bat_str" "$soc" "$cur_stop" 1>&2 printf "Setting temporary charge threshold for battery %s:\n" "$_bat_str" 1>&2 write_sysf "$temp_start" "$_bf_start" || rc=5 if [ $rc -eq 0 ]; then printf " start = %3d\n" "$temp_start" 1>&2 + cprintf "notice" "Charging starts now, keep the charger connected.\n" 1>&2 else cprintf "err" " start = %3d (Error: write failed)\n" "$temp_start" 1>&2 fi diff --git a/tlp.in b/tlp.in index 917bb1e7..6fcfb1a3 100644 --- a/tlp.in +++ b/tlp.in @@ -506,9 +506,6 @@ case "$_cmd" in # shellcheck disable=SC2086 chargeonce_battery "$_carg1" exitcode=$? - if [ $exitcode -eq 0 ]; then - cecho "Charging starts now, keep AC connected." "notice" 1>&2 - fi else exitcode=2 fi