diff options
author | ZachIR <zachir@librem.one> | 2025-08-09 08:36:35 -0500 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2025-08-09 08:36:35 -0500 |
commit | 07d6429c676d7fc9771bc45ac85c100bd33656b5 (patch) | |
tree | 2b5776a5ce4877f794fa436233ef480759e3d676 | |
parent | 1994547bb7da4c09fbfe05adec45c5bea32af758 (diff) |
Fix power_now for batteries with no power_now file
-rwxr-xr-x | power_now | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -26,9 +26,9 @@ case "$BATTERY" in fi elif [ -f "${DIRNAME}/current_now" ]; then if [ -n "${MILLIWATTS}" ]; then - POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | awk '{print $1*$2/1e9}' | head -1)" + POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | paste -d' ' -s | awk '{print $1*$2/1e9}' | head -1)" else - POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | awk '{print $1*$2/1e12}' | head -1)" + POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | paste -d' ' -s | awk '{print $1*$2/1e12}' | head -1)" fi fi if [ -n "${TOTAL}" ]; then @@ -68,9 +68,9 @@ case "$BATTERY" in fi elif [ -f "${DIRNAME}/current_now" ]; then if [ -n "${MILLIWATTS}" ]; then - POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | awk '{print $1*$2/1e9}' | head -1)" + POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | paste -d' ' -s | awk '{print $1*$2/1e9}' | head -1)" else - POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | awk '{print $1*$2/1e12}' | head -1)" + POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | paste -d' ' -s | awk '{print $1*$2/1e12}' | head -1)" fi fi if [ -z "${QUIET}" ]; then |