Skip to content

Commit

Permalink
More resiliant soc temp reading when kernels fails to output proper d…
Browse files Browse the repository at this point in the history
…ata.
  • Loading branch information
igorpecovnik committed Nov 29, 2017
1 parent a50100e commit 5cb346e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/bsp/common/etc/update-motd.d/30-sysinfo
Expand Up @@ -34,8 +34,8 @@ function display() {

function getboardtemp() {
if [ -f /etc/armbianmonitor/datasources/soctemp ]; then
read raw_temp </etc/armbianmonitor/datasources/soctemp
if [ ${raw_temp} -le 200 ]; then
read raw_temp </etc/armbianmonitor/datasources/soctemp 2>/dev/null
if [ ! -z "${raw_temp##*[!0-9]*}" ] && [ "${raw_temp}" -le 200 ]; then
# Allwinner legacy kernels output degree C
board_temp=${raw_temp}
else
Expand Down
4 changes: 2 additions & 2 deletions packages/bsp/common/usr/bin/armbianmonitor
Expand Up @@ -343,14 +343,14 @@ MonitorMode() {
echo -e "\n$(date "+%H:%M:%S"): --- $(printf "%5s" ${LoadAvg}) ${procStats}\c"
;;
esac
if [ "X${SocTemp}" != "Xn/a" ]; then
if [ "X${SocTemp}" != "Xn/a" ] && [ ! -z "${raw_temp##*[!0-9]*}" ]; then
read SocTemp <"${Sensors}/soctemp"
if [ ${SocTemp} -ge 1000 ]; then
SocTemp=$(awk '{printf ("%0.1f",$1/1000); }' <<<${SocTemp})
fi
echo -e " $(printf "%4s" ${SocTemp})°C\c"
fi
if [ "X${PMICTemp}" != "Xn/a" ]; then
if [ "X${PMICTemp}" != "Xn/a" ] && [ ! -z "${PMICTemp##*[!0-9]*}" ]; then
read PMICTemp <"${Sensors}/pmictemp"
if [ ${PMICTemp} -ge 1000 ]; then
PMICTemp=$(awk '{printf ("%0.1f",$1/1000); }' <<<${PMICTemp})
Expand Down

0 comments on commit 5cb346e

Please sign in to comment.