From da55d78f6fd5bebe51d91c97b6bdc6182953f28d Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Thu, 30 Jul 2009 01:07:27 +0000 Subject: [PATCH] tweaked comments in sensors section --- inxi | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inxi b/inxi index 0f9286d..b5724ad 100755 --- a/inxi +++ b/inxi @@ -3045,12 +3045,14 @@ get_sensors_data() tempWorking="" 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 - # there are some guesses here, and we will need a lot more data of - # 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 + # there are some guesses here, but with more sensors samples it will get closer. # 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]+)/ { moboTemp=gensub( /[ \t]+\+([0-9\.]*)(.*)/, "\\1", 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 - # $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/ { aFanMain[1]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 ) }