tweaked comments in sensors section

This commit is contained in:
inxi-svn 2009-07-30 01:07:27 +00:00
parent f410dc896c
commit da55d78f6f

12
inxi
View file

@ -3045,12 +3045,14 @@ get_sensors_data()
tempWorking="" tempWorking=""
tempWorkingUnit="" tempWorkingUnit=""
} }
# dumping the extra + signs, nobody has negative temps # dumping the extra + signs after testing for them, nobody has negative temps.
# also, note gawk treats ° as a space, so we have to get the C/F data # also, note gawk treats ° as a space, so we have to get the C/F data
# there are some guesses here, and we will need a lot more data of # there are some guesses here, but with more sensors samples it will get closer.
# 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
# note: using arrays starting at 1 for all fan arrays to make it easier overall # note: using arrays starting at 1 for all fan arrays to make it easier overall
# more validation because gensub if fails to get match returns full string, so
# we have to be sure we are working with the actual real string before assiging
# data to real variables and arrays. Extracting C/F degree unit as well to use
# when constructing temp items for array.
/^(M\/B|MB|SYS)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ { /^(M\/B|MB|SYS)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
moboTemp=gensub( /[ \t]+\+([0-9\.]*)(.*)/, "\\1", 1, $2 ) moboTemp=gensub( /[ \t]+\+([0-9\.]*)(.*)/, "\\1", 1, $2 )
tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 ) tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
@ -3107,7 +3109,7 @@ get_sensors_data()
} }
# note: can be cpu fan:, cpu fan speed:, etc. Some cases have no space before # note: can be cpu fan:, cpu fan speed:, etc. Some cases have no space before
# $2 starts, so skip that space test in regex # $2 starts (like so :1234 RPM), so skip that space test in regex
/^CPU(.*)[ \t]*([0-9]+)[ \t]RPM/ { /^CPU(.*)[ \t]*([0-9]+)[ \t]RPM/ {
aFanMain[1]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 ) aFanMain[1]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
} }