Recent

Author Topic: Accessing lm-senors with Lazarus?  (Read 3190 times)

psychojock

  • New member
  • *
  • Posts: 8
Accessing lm-senors with Lazarus?
« on: July 30, 2012, 02:48:28 am »
Hi all, I have been a Linux Admin for about 5 years, a Delphi programmer for 15 years and a Lazarus user for about a year.  I am very impressed with Lazarus, it allows me to port most of my software to Linux, which is great!!  I would like to write some siftware which will allow my server to e-mail me if various system values are approaching/exceeding set levels (i.e. cpu temp, system temp etc).  Is there any way that I can access the lm sensors data from Lazarus?
Thanks for any help.

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: Accessing lm-senors with Lazarus?
« Reply #1 on: July 30, 2012, 08:57:48 am »
Similar to most of the system info on linux, thermal info can be found in the file system. Newer systems have all their thermal info in the /sys/class/hwmon/hwmon[0-*] directory structure. Older systems where using /sys/class/thermal/thermal_zone[0-*]. Some systems use both.
Docs can be found at: http://www.kernel.org/doc/Documentation/hwmon/sysfs-interface and http://www.mjmwired.net/kernel/Documentation/thermal/sysfs-api.txt

avra

  • Hero Member
  • *****
  • Posts: 2015
    • Additional info
Re: Accessing lm-senors with Lazarus?
« Reply #2 on: July 30, 2012, 09:48:18 am »
You might choose any of the 3 methods mentioned in this link:
http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/developers/applications
Besides already mentioned sysfs, you might want to catch output of sensors command line program. Otherwise you will have to make a Pascal wrapper for the libsensors library (but beware of the library license).

For making Pascal wrappers for C library you can take a look at this: http://www.lazarus.freepascal.org/index.php/topic,12763.msg66330.html#msg66330
« Last Edit: July 30, 2012, 09:55:43 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018