Hi there,
while looking at /proc on the iLiad and dreaming on some ideas I noticed there isn't an easy way to get the battery status as it doesn't exist any related file on /proc.
So, professional as I am
I looked at the sources and there was the answer, hidden inside eventPoller function in powerMgr.c file [1]: ioctl call to /dev/battery device.
Initially I thougth on writing a simple lua script translating that code, but as lua itself has no ioctl module it can't be done with pure lua.
My second try was with python (use ericshliao's [2]), you can find the proof of concept on attached file.
Future? now I'm dreaming with an iLiad extension module for lua, which would include these useful functions to power our lua scripts...
Hope you find it interesting,
Iņigo
[1]
http://iliad.hpelbers.org/irexdox/po...8c-source.html
[2]
https://www.mobileread.com/forums/showthread.php?t=30169