diff options
author | Lisa Nguyen <lisa.nguyen@linaro.org> | 2015-10-31 03:09:43 -0700 |
---|---|---|
committer | Lisa Nguyen <lisa.nguyen@linaro.org> | 2015-11-19 17:34:09 -0800 |
commit | fb1103cc0ecaa81bacf435705eaf61f1b7a50f39 (patch) | |
tree | 374a3ad02c8bff1f74449d87f5b82dbb34878dc0 | |
parent | ddd07af132140ef3f984ca4a24d2089278e35e84 (diff) |
thermal: Fix display of cooling devices and thermal zones
Improve the format to display lists of cooling devices
and thermal zones for readability.
Signed-off-by: Lisa Nguyen <lisa.nguyen@linaro.org>
-rwxr-xr-x | thermal/thermal_00.sh | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/thermal/thermal_00.sh b/thermal/thermal_00.sh index 1479a02..8860eba 100755 --- a/thermal/thermal_00.sh +++ b/thermal/thermal_00.sh @@ -29,21 +29,35 @@ check_cooling_device_type() { all_zones=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']") - echo "Cooling Device list:" - for i in $all_zones; do - type=$(cat $THERMAL_PATH/$i/type) - echo "- $type" - done + echo "Cooling Device list" + echo "-------------------" + if [ -z "$all_zones" ]; then + echo "- None" + else + for i in $all_zones; do + type=$(cat $THERMAL_PATH/$i/type) + echo $i + echo "- $type" + done + fi + echo "\n" } check_thermal_zone_type() { all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") - echo "Thermal Zone list:" - for i in $all_zones; do - type=$(cat $THERMAL_PATH/$i/type) - echo "- $type" - done + echo "Thermal Zone list" + echo "-----------------" + if [ -z "$all_zones" ]; then + echo "- None" + else + for i in $all_zones; do + type=$(cat $THERMAL_PATH/$i/type) + echo $i + echo "- $type" + done + fi + echo "\n" } -for_each_thermal_zone check_thermal_zone_type -for_each_thermal_zone check_cooling_device_type +check_thermal_zone_type +check_cooling_device_type |