Thread: iLiad Battery status
View Single Post
Old 10-05-2009, 04:08 PM   #1
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
Battery status

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
Attached Files
File Type: zip bat.py.zip (823 Bytes, 415 views)

Last edited by Iņigo; 10-05-2009 at 04:58 PM. Reason: uploaded correct file
Iņigo is offline   Reply With Quote