Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'CPU temperature and hardware sensor readouts in bash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
CPU temperature and hardware sensor readouts in bash
Authored by: 31d1 on Oct 25, '05 07:46:24AM

Hi, I wrote this script, and since I sent it in a few days ago a few things have come to my attention. Basically, I was informed that:

"Your function, by coincidence, outputs a value that is ‘close' on some machines when compared to values spewed by some other tools that do the correct interpretation leading to believe that the problem is a simple one.
The correct reading for powerbooks goes like this: The value written in the registry is actually encoded to the hardware sensor. On most machines, the value is a 32 bit int, with the upper word being the degrees in C and the lower word the fractional part of the temperature.
On other machines the value may not even be a temperature, but just some seed for the fan, or needed to be read from the fan itself. In those cases the actual temp cannot be deduced by looking at this value without having the calibration data for the fan (in prom). As you can see this ends up being quite a bit of work it requires custom code for each of the machines or sensor types."

I'm pretty much a n00b at computer science, and this confused me to no end, so I ended up asking metafilter for help, here:

http://ask.metafilter.com/mefi/25932

and the upshot seemed to be that (for temperature sensors) a more accurate value than (n/2^16) is (( n / 2^13 - n / 2^13 % 1 ) / 2^3) - .5).

I've made up a version of the script that uses that value at http://cutup.org/_2tp, but on my machine it seems to output the same value as before less .5 degrees.

I'm not sure if thats coincidence or if I still have this wrong, and I would appreciate any input on the matter.



[ Reply to This | # ]
CPU temperature and hardware sensor readouts in bash
Authored by: GlowingApple on Oct 25, '05 11:57:36AM

The temperature widget I use shows a value that's 0.5 lower than your first script shows for me. Using the new script, the numbers are off by less than 0.2 on average (yours being a bit lower). Definitely well within good enough range for me.

Thanks for the script, it's nice to have a command line way of checking this.

---
Jayson --When Microsoft asks you, "Where do you want to go today?" tell them "Apple."



[ Reply to This | # ]
CPU temperature and hardware sensor readouts in bash
Authored by: iamdw on Oct 25, '05 10:22:22PM
Wonderful script 31d1, and after reading through the Ask Metafilter thread I see your confusion, though i don't completely understand it as i'm an even fresher n00b than you. Anywhen, my math skill are rather weak, and i was wondering if a Celsius to Fahrenheit conversion is a simple switch of the "
$(i+1)=((( (($(i+1) / 2^13) - ($(i+1) / 2^13) % 1 ) / 2^3) - .5)" Ct")
" formula or something more complext in translating the output from hex etc? If it is, don't worry about it... get the accuracy confusion out of the way first. That said, us Fahrenheit users would love an °F output. Anyone up for the challenge? I've dicking around with it bout as i said, my math is weak...

[ Reply to This | # ]