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 88: | Line 88: | ||
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 106: | ||
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 123: | ||
... | ... | ||
- | 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. |
Learn more about Contributing to the wiki.