Skip to contentSkip to conversation

Using libsensors in custom application

lm-sensors John Beavers 2 participants 2 messages Jul 5, 2007 – Jul 14, 2007

lore
Share & tools
lore
#0 lore raw

Hello,

I'm trying to develop an application that can get the temperature of the CPU / MB and send it to another machine on the network for remote temperature monitoring. I've managed to compile and run a program that successfully sends test data over the network, reads chip data like sensors (using the same code), but I cannot get it to do both together. Basically, I cannot tell where / how sensors is getting the information it is outputting to the screen. I've tracked it down to m->fn(&name); in the do_a_print() function, but I cannot see how that line prints out the chip information. My question is, is there a tutorial of how to use libsensors in an application somewhere, or can you give me a brief explanation of how to get the CPU & MB temp from libsensors?

Thanks,
John Beavers

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

Hi John,

Quoted 8 lines · John Beavers

I'm trying to develop an application that can get the temperature of the CPU / MB and send it to another machine on the network for remote temperature monitoring. I've managed to compile and run a program that successfully sends test data over the network, reads chip data like sensors (using the same code), but I cannot get it to do both together. Basically, I cannot tell where / how sensors is getting the information it is outputting to the screen. I've tracked it down to m->fn(&name); in the do_a_print() function, but I cannot see how that line prints out the chip information.

The callback function (m->fn) is chip-specific. The "matches" array gives the correspondence between a chip name and its printing function. All the printing functions are in a different source file (chips.c). Yes, it's a mess.

Quoted 3 lines

My question
is, is there a tutorial of how to use libsensors in an application somewhere,

sensors' source code is the tutorial. And you have the libsensors man page for reference, too.

Quoted 2 lines

or can you give me a brief explanation of how to get the CPU &
MB temp from libsensors?

libsensors can't give you that, because it has no knowledge of what sensor measures what. In its current incarnation, it doesn't even know which sensors are temperature sensors, and which are, say, fan sensors. This will be much better in the next (major) version, but for now, libsensors is heavily chip-specific.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors