X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=home%2Flib%2Flogin_functions.sh;h=1f6906100e840a0ef05bc97c48e207f5deb8e109;hb=d87138ae6c34ddd2dce2ee2c3703a4afcf2c27f3;hp=01e0ffa63d71c1de5b0de37c1b813c8b1e899be3;hpb=4406bd0b0fb13b8e1cd6c8fed26dc4146feeb595;p=khome.git diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index 01e0ffa..1f69061 100644 --- a/home/lib/login_functions.sh +++ b/home/lib/login_functions.sh @@ -556,14 +556,29 @@ status() { echo + local _dir temp_input label_file label + printf '%sthermal\n' "$indent_unit" - for _dir in /sys/class/thermal/thermal_zone* - do - printf '%s %.2f C\n' \ - $(cat "$_dir"/type) \ - $(( $(cat "$_dir"/temp) / 1000 )) + for _dir in /sys/class/hwmon/hwmon*; do + cat "$_dir"/name + find "$_dir"/ -name 'temp*_input' \ + | while read -r temp_input; do + label_file=${temp_input//_input/_label} + if [ -f "$label_file" ]; then + label=$(< "$label_file") + else + label='' + fi + awk -v label="$label" '{ + if (label) + label = sprintf(" (%s)", label) + printf("%.2f°C%s\n", $1 / 1000, label) + }' \ + "$temp_input" + done \ + | sort \ + | indent "$indent_unit" done \ - | column -t \ | indent "${indent_unit}${indent_unit}" echo 'net'