Hi,
I want to enhance GNUstep's battery monitor to support, if available,
ACPI data. Currently, only the basic APM information gets retrived
trhough ioctl() of /dev/apm
Most information I need and which I get on other operation system is
found in hw.sensors:
hw.sensors.acpibat0.volt0=11.10 VDC (voltage)
hw.sensors.acpibat0.volt1=12.41 VDC (current voltage)
hw.sensors.acpibat0.current0=0.00 A (rate)
hw.sensors.acpibat0.amphour0=3.17 Ah (last full capacity)
hw.sensors.acpibat0.amphour1=0.32 Ah (warning capacity)
hw.sensors.acpibat0.amphour2=0.00 Ah (low capacity)
hw.sensors.acpibat0.amphour3=3.17 Ah (remaining capacity), OK
hw.sensors.acpibat0.raw0=0 (battery full), OK
hw.sensors.acpiac0.indicator0=On (power supply)
I miss battery manufacturer and technology, not really essential data,
but it is usually returned by acpi and in fact I suppose some of it gets
read, in dmesg I find:
acpibat0 at acpi0: C137 model "Primary" serial 01767 2008/09/18 type
LIon oem "Hewlett-Packard"
Anyway, I suppose that the best way to retrieve such information is by
using sysctl() and querying it with the MIB CTL_HW, HW_SENSORS right?
According to man, it would be a "node".
HW_SENSORS node
This node however has several levels. The manpage states:
The sensordev and sensor structures and sensor_type
enumeration
are defined in <sys/sensors.h>.
Now, how do I really call that? I wonder what the sysctl() will return
and how I might use that.
I understand that for data with variable information size, I need two
sysctls, one to size, one to get the actual data, that makes me still
remain fuzzy. Someone has further advice or perhaps example code? Of
what type would be "old pointer" ?
I wonder if I can go down in the MIB block? or if I get some sort of
array of all blocks? I wound "SENSOR_AMPHOUR" for example, but no BATTERY.
I hope I was clear enough in my doubts.
Riccardo