Editing N900 software power management
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
+ | This is a work in progress. It is not yet ready for public consumption. Please don't link it into wiki yet. | ||
+ | |||
This page may be useful to application developers, as well as those interested in reducing power usage of software by configuring it correctly. | This page may be useful to application developers, as well as those interested in reducing power usage of software by configuring it correctly. | ||
Line 68: | Line 70: | ||
The below tools directly measure electrical current usage by the phone. They should be run with the device unplugged from USB. Battery capacity is measured in Amp-Hours. The BL-5J in the N900 has a capacity of 1.4 Ah. It can provide 1 A for a little over an hour, but it's very hard to get it to use that much. If the current drops, the time rises. | The below tools directly measure electrical current usage by the phone. They should be run with the device unplugged from USB. Battery capacity is measured in Amp-Hours. The BL-5J in the N900 has a capacity of 1.4 Ah. It can provide 1 A for a little over an hour, but it's very hard to get it to use that much. If the current drops, the time rises. | ||
- | For example, in standby with wifi and phone | + | For example, in standby with wifi and phone active but idle, the current usage is around .006 A, leading to a standby life of around 10 days. (1.4 Ah/.006 A = 220 h = 10 days. 0.006 A is a cumbersome figure, so the unit 'Milliamp' - mA - 1/1000th of an amp is used. 6 mA when idle is great, but it is easy if everything does not go right to use lots more than this when idle. For example, if the CPU is constantly active, it will use over 100 mA - draining the battery in around 12 hours. |
==Debugging== | ==Debugging== | ||
Line 88: | Line 90: | ||
if [[ -e /sys/class/power_supply/bq27200-0/current_now ]] | if [[ -e /sys/class/power_supply/bq27200-0/current_now ]] | ||
then | then | ||
- | + | current_read='cat /sys/class/power_supply/bq27200-0/current_now' | |
- | + | echo Using kernel battery driver to read current. | |
else | else | ||
- | + | if command -v i2cget >/dev/null | |
- | + | then | |
- | + | current_read='i2cget -y 2 0x55 0x14 w' | |
- | + | echo Using I2C to read charge meter directly | |
- | + | else | |
- | + | echo Cannot find a way to read the charge meter. | |
- | + | echo Either i2ctools from extras-devel must be installed, or the power kernel with the bq27x00_battery module which normally accompanies it. | |
- | + | echo Exiting. | |
- | + | exit | |
- | + | fi | |
fi | fi | ||
# Reset timer stats. | # Reset timer stats. | ||
Line 106: | Line 108: | ||
while true # Loop while printing stats | while true # Loop while printing stats | ||
do | do | ||
- | + | echo 1 >/proc/timer_stats # Start gathering stats | |
- | + | sleep 5 # Sleep 5s | |
- | + | echo 0 >/proc/timer_stats # Finish stats. | |
- | # | + | # Print output, assuming sense resistor is 22 milliohms. |
- | + | echo `date` $((`$current_read` * 3570 / 22 / 1000))mA `tail -1 /proc/timer_stats` | |
done | done | ||
</source> | </source> | ||
Line 123: | Line 125: | ||
... | ... | ||
- | This shows that immediately after starting, the script measured over the first 5 s | + | This shows that immediately after starting, the script measured over the first 5 s a power consumption of 25 mA. This will discharge in one hour the battery by 25 milliamp-hours. It has a total capacity of around 1200 mAh - so will last about 1200 mAh/25 mA = 75 hours (roughly). |
Wifi however uses a significant amount of power. By comparison, this is the result when redirecting the output to a file. | Wifi however uses a significant amount of power. By comparison, this is the result when redirecting the output to a file. | ||
Line 139: | Line 141: | ||
===Powertop=== | ===Powertop=== | ||
- | |||
- | |||
The output of powertop, when run as root, is shown below, with some comments. Much of the output is probably not directly useful for you. | The output of powertop, when run as root, is shown below, with some comments. Much of the output is probably not directly useful for you. | ||
Line 258: | Line 258: | ||
apt-get install htop | apt-get install htop | ||
- | Full documentation can be found [http://htop.sourceforge.net/ at the htop project pages on sourceforge] | + | Full documentation can be found [http://htop.sourceforge.net/ at the htop project pages on sourceforge] |
[[image:htop.png]] | [[image:htop.png]] |
Learn more about Contributing to the wiki.