mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
trying to handle fan1:, temp1:, temp2:
This commit is contained in:
parent
73a25f53cc
commit
7a6e1bdec3
45
inxi
45
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.0.85-b1
|
||||
#### version: 1.0.86-b1
|
||||
#### Date: 26 July 2009
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -3019,26 +3019,51 @@ get_sensors_data()
|
|||
moboTemp=""
|
||||
cpuTemp=""
|
||||
cpuFan=""
|
||||
tempData1=""
|
||||
tempData2=""
|
||||
}
|
||||
# dumping the extra + signs, nobody has negative temps
|
||||
# also, note gawk treats ° as a space, so we have to get the C/F data
|
||||
# explicitly by testing for $4 ~ /C|F/ then concatenating manually
|
||||
# there are some guesses here, and we will need a lot more data of
|
||||
# different systems before this can be trusted much
|
||||
# different systems before this can be trusted much. Note that there
|
||||
# is a hack here to handle cases where search term has 1 or 2 words with space
|
||||
/M\/B Temp|SYS Temp|temp2:/ {
|
||||
moboTemp=gensub( /\+(.+)/, "\\1", 1, $3 )
|
||||
if ( $4 ~ /C|F/ ){
|
||||
moboTemp=moboTemp "°" $4
|
||||
if ( $1 == "temp2:" ) {
|
||||
tempData1=$2
|
||||
tempData2=$3
|
||||
}
|
||||
else {
|
||||
tempData1=$3
|
||||
tempData2=$4
|
||||
}
|
||||
moboTemp=gensub( /\+(.+)/, "\\1", 1, tempData1 )
|
||||
if ( tempData2 ~ /C|F/ ){
|
||||
moboTemp=moboTemp "°" tempData2
|
||||
}
|
||||
}
|
||||
/CPU Temp|temp1:/ {
|
||||
cpuTemp=gensub( /\+(.+)/, "\\1", 1, $3 )
|
||||
if ( $4 ~ /C|F/ ){
|
||||
cpuTemp=cpuTemp "°" $4
|
||||
if ( $1 == "temp1:" ) {
|
||||
tempData1=$2
|
||||
tempData2=$3
|
||||
}
|
||||
else {
|
||||
tempData1=$3
|
||||
tempData2=$4
|
||||
}
|
||||
cpuTemp=gensub( /\+(.+)/, "\\1", 1, tempData1 )
|
||||
if ( tempData2 ~ /C|F/ ){
|
||||
cpuTemp=cpuTemp "°" tempData2
|
||||
}
|
||||
}
|
||||
/CPU Fan/ {
|
||||
cpuFan=$3
|
||||
/CPU Fan|fan1:/ {
|
||||
if ( $1 == "fan1:" ) {
|
||||
tempData1=$2
|
||||
}
|
||||
else {
|
||||
tempData1=$3
|
||||
}
|
||||
cpuFan=tempData1
|
||||
}
|
||||
|
||||
END {
|
||||
|
|
Loading…
Reference in a new issue