[Olsr-dev] implementing auto-willingness based on battery info

Hans-Christoph Steiner (spam-protected)
Fri May 11 05:15:02 CEST 2012

I noticed that apm.c olsrd/stable just contains function prototypes.  Has anyone tried implementing some sort of auto-willingness based on battery life and charge status?

For the Linux kernel, it seems like it would be easy to implement.  You can get the data now via /sys:

/sys/class/power_supply/battery/charging_enabled  (boolean)
/sys/class/power_supply/battery/capacity  (percent)

I could see something like starting with a default willingness, say 3.  Then having some simple rules:

+1 connected to power/charging_enabled
+1 battery above 90%
-1 battery below 50%
-1 battery below 40%
-1 battery below 30%
-1 battery below 20%
-1 battery below 10%

Then these rules would add.  Starting with a default willingness of 3, a device fully charged and connected to power would have a willingness of 5, with 45% battery would be 2, with 15% battery would be 0.


More information about the Olsr-dev mailing list