Hi all, i'm attempting to make a program to monitor and log my battery power (don't ask). I looked first at shell scripts, but I can't find any
working shell commands that will report power (
apm just says kernel doesn't support APM,
acpid says it's busy, etc).
Therefore i've gone to a c program, because i know those have access to apm somehow (I have the battstat applet running, and it reports power just fine). problem there is, I can't compile anything that uses
apm.h, the linker doesn't seem to find
apm_read(). I've even gone thru
apm.h itself and it does list that particular function.
Here's an excerpt of my test program:
Code:
#include <stdio.h>
#include <apm.h>
int main()
{
apm_info apminfo;
apm_read(&apminfo);
int batt_life = apminfo.battery_percentage;
printf("Battery life: %d%%", batt_life);
return 0;
}
As you can see, very simple. I got inspiration for this from the source of battstat. As far as I can tell,
apm_read() is supposed to fill the
apm_info struct, so without that function, this approach is pretty useless.
Any ideas why this won't compile? or can you suggest any other routes to write a battery power logger?