Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,770,417 Members 43,381 Now Online
XDA Developers Android and Mobile Development Forum

[Script] Collin_ph Battery Tweak [10/23/2010]

Tip us?
 
Decad3nce
Old
(Last edited by Decad3nce; 26th October 2010 at 05:08 PM.)
#1  
Decad3nce's Avatar
Retired Forum Moderator / Recognized Developer - OP
Thanks Meter 2768
Posts: 2,083
Join Date: Feb 2010

 
DONATE TO ME
Default [Script] Collin_ph Battery Tweak [10/23/2010]

This is really a tool for power users

If you don't consider yourself 'comfortable' with messing with your phone, then don't.

This is mostly the work of collin_ph, all the ideas are mostly his and I have only contributed in part to getting some things functioning correctly and some optimizations. We've been enjoying the performance/battery life benefits for about a month now and everyone is, hopefully, enjoying it as well.

Collin, myself and a couple others have decided to turn this script into an app which I hope, and we hope, will be on the market sooner than later.
http://tweaktool.com

The original thread can be found here: http://forum.xda-developers.com/showthread.php?t=762283

This script is more functional and more efficient than applications that constantly run in the background(like setcpu,ocwidget); the reason for this is that it only polls all dependencies every 60 seconds(default) to check for changes. Even the polling interval can be changed.



Why use this?
This script has proven time and time again to not only battery life(on average, about 3-4 hours), but also improve the performance of the device.



Enough of the backstory, into the details:

READ THIS

Original documentation can be found here: http://www.primoweb.com/froyo/battery_tweak_v3.html








The entire 'application' is written in shell code and was first written just to give a performance and battery boost, but since has evolved more and more.

All the tools mentioned will be utilized either through the terminal, or in adb shell.

The Tools

batt.sh

This is the core of the entire script. Don't mess with it.
The one thing you should do after installing the script:
Code:
pidof batt.sh
If theres any number showing up after it, then it's working fine. Don't touch it.

batt-cfg

This is the 'main menu' of sorts, as it gives the user all the options and allows him to toggle tweaks/mods on the fly.



The Presets
The presets are just default configurations that I have set up that can make your phone more efficient without you, the user, having to manually set everything.

The preset of 806 literally means that 806400 is the scaling_max_freq, or the max frequency, that your phone can achieve after you enable it.

Just typing 1, and then enter, you'll be ready and set to go. Same with 2.

Customize Settings
This is only for the experienced user, and it allows you to manipulate most/ifnotall the configurables on your device.



All the settings explain what each option does, so read them carefully.

Disk Boost
Remounts via noatime and nodiratime. Look up what that means on your own, and why it benefits performance the way it does.

Audio 'Fix'
Disables stagefright for bettery audio quality, though it will hinder your benchmark scores only because it affects the AAC codec and how it behaves.

CFS Tweak
Echos NO_NEW_FAIR_SLEEPERS to sched_features to change CFS into more of a traditional scheduler like BFS, which gives a noticeable benchmark performance boost, but hinders how gps behaves(kind of like the real BFS).

Temperature Management
This new tool allows you to set a temperature(in celsius) at which to override the maximum frequencies to something a bit safer to save your phone battery from melting. It allows you to choose the override max frequency and the override min frequency.

So lets say that you choose the 710 preset.

And you enable the Temperature Management, and set the temperature to 450(45.0 C*) and you set the override max frequency to 537600mhz.

At 45 C*, the tweak will override the preset and echo 5376000 to scaling_max_freq until your battery temperature drops below 45.0 C*, at which point it will resume 710mhz.

Enjoy!

batt-diag
It's a diagnostics utility, allowing you or someone knowledgeable to figure out any issues that you may be having with your device and be able to pinpoint exactly where the problem is.

batt-diag -v gives a more thorough output as you can see here; http://pastie.org/1162034

batt-rm.sh
It's a battery tweak removal script, follow the onscreen prompts and it should remove just about any trace of the battery tweak script.





Prerequisites needed to run this
If you're running a version of CM6, this will work completely fine.

If you're running any other kind of rom, that developer will need to add an 'import' call in the init.rc(in the ramdisk) that imports the init.d script necessary for this application to function at boot. If you don't know how to do this, well, pm me, I might help you, depending on how much I like you.

This script will WORK even if you don't have the import call at boot, but it won't survive on the next reboot.

You can check via:

Code:
adb logcat | grep collin_ph
Code:
pidof batt.sh
NOTE: This script will also prompt you to try to run itself as root if you use it in terminal. Should work fine in CM6 ROMS but may not run fine in other ones.




Credits:
  • Collin_ph
  • Myself
  • Tomatosoup
  • s0be
  • Barackisbrown
  • vinylfreak89 for being so naggy about porting this here

Download Collin_ph BatteryTweak v3 DecaMod v2.2
MD5: 64c40363fdc1f4c5745154a627894850
Last update: Tues 10/26/2010 11:08AM CST.

Download Collin_ph BatteryTweak v3 DecaMod v2(TazzFroyo/KaosFroyo) TAKEN DOWN
MD5: 7ade3a05e20fedc958c714e62ef27bd8
If you flashed this earlier, it breaks wifi, so just reflash your ROM over the top. Tell your ROM cook to fix his CM6 :P!

Flash via recovery, enjoy!


Why doesn't it work for KaosFroyo/TazzFroyo?
Because they're not built like the CM6 repos, and do not have the init.local.rc import and updated busybox's as well lacking some dependencies found in CM6 itself when its built from source.
ROMs that need to have init.rc patched with import call of init.local.rc(This is necessary for this script to work correctly)
  • KaosFroyo
  • TazzFroyo


'start collin_ph' starts the service created in init.local.rc. If init.local.rc isn't imported at boot via the init.rc, then it fails.
The Following 3 Users Say Thank You to Decad3nce For This Useful Post: [ Click to Expand ]
 
Decad3nce
Old
(Last edited by Decad3nce; 17th September 2010 at 08:05 PM.)
#2  
Decad3nce's Avatar
Retired Forum Moderator / Recognized Developer - OP
Thanks Meter 2768
Posts: 2,083
Join Date: Feb 2010

 
DONATE TO ME
Original Source: http://github.com/collinph/battery-tweak-v3
My Source: http://github.com/Decad3nce/battery-tweak-v3

Help us debug!

Before you complain about anything, do this.
Code:
adb shell batt-diag -v > battdiag.txt
and upload that txt file so that we can diagnose your problems more thoroughly.

For ROM Modders
You need 3 things for the script to survive a reboot:
  • An overclockable kernel(duh)
  • An 'import' call for init.local.rc in init.rc in the ramdisk.
    Just paste this into init.rc after the "Define TCP buffer sizes" setprops
    Code:
    # Include extra init file so that the battery tweak will function
        import /system/etc/init.local.rc
  • Proper file structuring/permissions(The update script in the update.zip really does all of this for you)
 
Hungry Man
Old
#3  
Senior Member
Thanks Meter 36
Posts: 2,105
Join Date: Jun 2010
Yay it got ported. Thanks.
blah blah signature
 
vinylfreak89
Old
#4  
vinylfreak89's Avatar
Senior Member
Thanks Meter 225
Posts: 214
Join Date: May 2010
im naggy huh... no seriously... great job dude... immediately my CPU usage has gone down and tomorrow we'll see if battery life goes up as well.. i sure hope so... phone is overall... smoother
If you like my work, any amount you'd like to donate is very appreciated.



Codeveloper: KaosFroyo and ErisLightningBolt

Feel free to PM me any time or hit me up on IRC.
 
eklipze
Old
#5  
eklipze's Avatar
Senior Member
Thanks Meter 25
Posts: 324
Join Date: Mar 2010
Location: Las Vegas
oh happy day! i had been using the original version of this and am happy to see it ported and enhanced... me and my eris thank you greatly!
"Software is like sex: it's better when it's free." Linus Torvalds
 
UNCbassbone
Old
#6  
Junior Member
Thanks Meter 0
Posts: 26
Join Date: Jul 2010
I'm assuming that since this sets frequencies on it's own that it would be ill advised to use along with something like SetCPU?
 
Decad3nce
Old
#7  
Decad3nce's Avatar
Retired Forum Moderator / Recognized Developer - OP
Thanks Meter 2768
Posts: 2,083
Join Date: Feb 2010

 
DONATE TO ME
Quote:
Originally Posted by UNCbassbone View Post
I'm assuming that since this sets frequencies on it's own that it would be ill advised to use along with something like SetCPU?
It' CONFLICTS with setcpu, so no.

Same thing with OC widget.
 
droidfreak
Old
#8  
droidfreak's Avatar
Senior Member
Thanks Meter 3
Posts: 171
Join Date: Apr 2010
Location: San Diego
Thanks checkin it out... see how tomorrow goes..
New Bionic....rooted!...
rooted OG Eris!
 
swaggerwocky
Old
#9  
swaggerwocky's Avatar
Senior Member
Thanks Meter 13
Posts: 121
Join Date: Aug 2010
After choosing option [1] in batt-cfg I noticed it said "/system/bin/batt-cfg: line 467: load_806: command not found". I did the "pidof batt.sh" command before running batt-cfg and no number displayed after inputting the command. I ran it again after saving settings in batt-cfg and it displayed a number.
 
Decad3nce
Old
(Last edited by Decad3nce; 16th September 2010 at 06:12 AM.)
#10  
Decad3nce's Avatar
Retired Forum Moderator / Recognized Developer - OP
Thanks Meter 2768
Posts: 2,083
Join Date: Feb 2010

 
DONATE TO ME
Quote:
Originally Posted by burndtjamb View Post
After choosing option [1] in batt-cfg I noticed it said "/system/bin/batt-cfg: line 467: load_806: command not found". I did the "pidof batt.sh" command before running batt-cfg and no number displayed after inputting the command. I ran it again after saving settings in batt-cfg and it displayed a number.
Oops, bug. Thanks. Will fix in a sec

EDIT: Fixed. Same URL, check md5.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Navigate to Your Favorite Places with LocationDetector

If you’re enjoying an active way of life, you probablytravel a lot, go fishing, … more

LifeStats Automatic Journal Keeps Tabs of Your Day

Most of us live very active lives. This is after all why we’re fans of mobile … more

Android App Review: Hide Your Files with Androignito – XDA Developer TV

Stop right now, look at your phone, and see how many pictures, … more

BrightNotes Makes Cloud Notes Simple and Easy

There are literally thousands of note taking apps available on Android, with practically every … more