Since I have been doing some personal research about the charging-software-mechanism, I was trying to understand the way the charging-LED is being controlled. So far I do not completely understand it, but there are some things going on that I find a bit strange. Maybe they are bugs, so I want to report my discoveries and thoughts here.
LEDs are being controlled in "/sys/class/leds/". Each LED has it's own subdirectory. For example you can turn on the charging-LED by typing (as root):
Code:
echo "250" > /sys/class/leds/pandora\:\:charger/brightness
Turn it off with the value "0".
Additionally I found a init-script (/etc/init.d/led-config) that is run on system-start. This script echoes a "trigger"-value depending on the configuration stored in "/etc/default/leds" into the file "trigger" of each LED-subdirectory in "/sys/class/leds/". If you "cat" that file, you get for the charge-LED the following output:
Code:
cat /sys/class/leds/pandora\:\:charger/trigger
[none] nand-disk bq27500-0-charging-or-full bq27500-0-charging bq27500-0-full bq27500-0-charging-blink-full-solid twl4030_ac-online twl4030_usb-online mmc0 mmc1 mmc2 timer heartbeat backlight gpio default-on
As far as I understand you can set some trigger this way. The one currently shown is the the one printed in [], which is "none" by default. If you "echo" one of the listed triggers you can activate that trigger. The strange thing is that "/etc/default/leds" sets the trigger "twl4030_bci_battery-charging", which obviously does not exist. So IMHO this is a mistake in "/etc/default/leds".
Unfortunately I do not understand the benefit of setting that trigger. For now. So I can't judge the importance of this. Any info on this would be welcome.
Next, while searching for an answer to the question "What turns the LED on/off?", I found an info that pndevmapperd somehow is involved. So i browsed it's sourcecode and found indeed a part where it turns the LED on/off by sending integer-values to the "brightness"-file. Now here comes the next strange part:
When I kill pndevmapperd, then the LED still nicely turns on/off when I plug in/out the AC- or USB-cable. So something else is controlling the LED too.
Is this maybe a reason for the LED-confusion that is going on? IMHO only one of them should control the LED.
Last but not least I again paid attention to the behavior of the charge-LED when you take the turned-off Pandora, plug in the AC-cable and make it boot this way. The LED is turned off after boot, but the Pandora IS charging. So this is a flaw in the startup-scripts. Would it be wise to put a small code in one of the startup-scripts (e.g. either in /etc/init.d/led-config or /etc/init.d/pndevmapperd-init) that checks the status of the battery-charging and lights the LED if it is charging?
I'm still unsure about the whole method being used, which is also the reason why I write this. If you know more about it, then please let me know.