Project Ara Smartphone Will Run Modified Android L with Hot Swapping

Project Ara is a very exciting topic–both for hardware and … more

Streamline Android Theme Customization with Graphic Porter

I dont have a custom theme on my Android phone, and the reason for this is because … more

Boost the Brightness of Your Sony Xperia Z1’s LED

I think the last time anyone has ever used a physical torch to find their earphones, … more

XDA Xposed Tuesday: Modify the Look of Your Volume Control – XDA TV

How many screenshots have you seen with a volume status bar in the … more
Post Reply

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

16th September 2010, 04:24 AM   |  #1  
Decad3nce's Avatar
OP Retired Forum Moderator / Recognized Developer
Thanks Meter: 2,768
 
2,083 posts
Join Date:Joined: Feb 2010
Donate to Me
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.
Last edited by Decad3nce; 26th October 2010 at 05:08 PM.
The Following 3 Users Say Thank You to Decad3nce For This Useful Post: [ View ]
16th September 2010, 04:25 AM   |  #2  
Decad3nce's Avatar
OP Retired Forum Moderator / Recognized Developer
Thanks Meter: 2,768
 
2,083 posts
Join Date:Joined: 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)
Last edited by Decad3nce; 17th September 2010 at 08:05 PM.
16th September 2010, 04:44 AM   |  #3  
Senior Member
Thanks Meter: 36
 
2,105 posts
Join Date:Joined: Jun 2010
Yay it got ported. Thanks.
16th September 2010, 04:57 AM   |  #4  
vinylfreak89's Avatar
Senior Member
Thanks Meter: 226
 
214 posts
Join Date:Joined: 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
16th September 2010, 05:15 AM   |  #5  
eklipze's Avatar
Senior Member
Las Vegas
Thanks Meter: 25
 
324 posts
Join Date:Joined: Mar 2010
More
Cool
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!
16th September 2010, 05:18 AM   |  #6  
Junior Member
Thanks Meter: 0
 
26 posts
Join Date:Joined: 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?
16th September 2010, 05:23 AM   |  #7  
Decad3nce's Avatar
OP Retired Forum Moderator / Recognized Developer
Thanks Meter: 2,768
 
2,083 posts
Join Date:Joined: Feb 2010
Donate to Me
Quote:
Originally Posted by UNCbassbone

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.
16th September 2010, 05:43 AM   |  #8  
droidfreak's Avatar
Senior Member
Flag San Diego
Thanks Meter: 3
 
171 posts
Join Date:Joined: Apr 2010
Thanks checkin it out... see how tomorrow goes..
16th September 2010, 05:59 AM   |  #9  
swaggerwocky's Avatar
Senior Member
Thanks Meter: 13
 
121 posts
Join Date:Joined: 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.
16th September 2010, 06:09 AM   |  #10  
Decad3nce's Avatar
OP Retired Forum Moderator / Recognized Developer
Thanks Meter: 2,768
 
2,083 posts
Join Date:Joined: Feb 2010
Donate to Me
Quote:
Originally Posted by burndtjamb

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.
Last edited by Decad3nce; 16th September 2010 at 06:12 AM.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes