5,598,171 Members 44,130 Now Online
XDA Developers Android and Mobile Development Forum

[MOD] Collin_ph Battery Tweak For EVO By Myn

Tip us?
 
myn
Old
(Last edited by myn; 29th October 2010 at 05:07 PM.)
#1  
myn's Avatar
Senior Recognized Developer - OP
Thanks Meter 3997
Posts: 2,652
Join Date: Nov 2007

 
DONATE TO ME
Default [MOD] Collin_ph Battery Tweak For EVO By Myn

Background

As many of you recently saw in my Warm TwoPointTwo RLS2 thread there was an optional download for Collin_ph's battery tweak ported to the EVO by me.

This mod was so large I figured It deserved it's own thread and at the same time I'd like to share it with the community so other ROM devs can incorporate this into their ROMs

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 for the EVO and INCredible. The original thread from Collin_ph can be found here and the original documentation can be found here.


What does it do?
  • This tweak creates a service that periodically checks the phone's power source.
  • If the power source changes, it reconfigures the device for maximum performace, battery and safety.
    • Tweaks compcache (if enabled) for current power source
    • Tweaks memory settings for current power source
    • Re-clocks CPU based upon battery remaining or current power source
      • Reclocks for maximum performance if on AC power
      • Reclocks for maximum performance and charging safety if on USB
      • Reclocks for performance and battery if on Battery
        • As Battery life is diminished, Maximum CPU frequency is lowered
    • Tweaks scaling charactaristics depending on power sourcee
      • CPU Scales up less frequently on battery power
      • CPU Scales up more frequently on USB/AC power
  • The CPU is allowed to scale dynamically in all charging states based upon CPU usage
  • Includes a batt-cfg utility to configure the system
    • You may load 1 of 2 pre built profiles
    • Manually configure CPU Frequencies in all charging states
    • Determine the percentage of underclocking as the battery drains
    • Configure how often to poll the power state / battery statys
    • Disable batt.sh service from running at startup
  • Includes a batt-rm.sh uninstall utility
  • Includes a batt-diag diagnostic utility
  • Includes an LED fix if your LED is stuck on
  • Includes optional experimental performance tweaks (disabled by default)
  • Includes optional Disk performance tweaks (enabled by default)
  • Includes optional froyo Audio quality fix (disables stagefright)


The Tools

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.


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.



batt-cfg

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




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.


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 998 literally means that 998400 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.

Note, you do not need to configure anything to enable this battery mod. Default settings will be assigned.



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

Currently not functional. Will evolve in time. What it will eventually do is Echo 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).


Prerequisites needed to run this

If you're running a version of CM6 or Warm TwoPointTwo RLS2 and above, 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, please see post #2.

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:
pidof batt.sh
NOTE: This script will also prompt you to try to run itself as root if you use it in terminal.


Contributors:
  • Collin_ph
  • Decad3nce
  • myn
  • onicrom
  • shabbypenguin

Download And Install:

Version 3 RC2 Download Here

A new guide is available: [GUIDE]* How to properly flash collin_ph battery tweak & have best battery life ever! *
  • Disable SetCPU or other overclocking programs as they will interfere with this tweak.
  • Kernels that manage and throttle CPU (ex HAVS) may interfere with the operation of this mod as they will fight and conflict with CPU deltas.
  • Download, the zip, copy to SD card.
  • Reboot into recovery and flash.
  • Reboot and run the batt-cfg configuration utility.
The Following User Says Thank You to myn For This Useful Post: [ Click to Expand ]
 
myn
Old
(Last edited by myn; 17th October 2010 at 04:57 AM.)
#2  
myn's Avatar
Senior Recognized Developer - OP
Thanks Meter 3997
Posts: 2,652
Join Date: Nov 2007

 
DONATE TO ME
Help us debug!

Having issues with this mod? Help us debug your issue by doing 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 Developers
You need 3 things for the script to survive a reboot:
  • A clockable kernel
  • 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)



Future Development:

I'd love to have a bunch of developers contributing to this project. I maintain this project out on github branched from Collin_ph's base code. If you'd like to contribute let me know and I'll add you as a contributor to the project.

http://github.com/myn/battery-tweak-v3


Original Source: http://github.com/collinph/battery-tweak-v3
The Following User Says Thank You to myn For This Useful Post: [ Click to Expand ]
 
myn
Old
#3  
myn's Avatar
Senior Recognized Developer - OP
Thanks Meter 3997
Posts: 2,652
Join Date: Nov 2007

 
DONATE TO ME
* This one reserved too *
 
tonwarr.the.incredible
Old
#4  
tonwarr.the.incredible's Avatar
Senior Member
Thanks Meter 31
Posts: 558
Join Date: Jun 2010
Quick question....is v3 the same that was included with rls2?? Another question that was asked in your ROM thread, does this need to be activated via ADB or does flashing activate? Thanks in advance and keep up the phenomenal work.
 
luckylui
Old
#5  
luckylui's Avatar
Senior Member
Thanks Meter 363
Posts: 4,019
Join Date: Aug 2010
Location: Chi-Town
Nice nice im reading at the moment but looks tastey and im in!!!

Sent from my phone... I think Tapatalk??
Current: LG Nexus 5

Past: HTC One

Past: LG Nexus 4

Tablet: ASUS N7 8GB

Sent from my shuttle to mars!
 
stanglifemike
Old
#6  
stanglifemike's Avatar
Senior Member
Thanks Meter 411
Posts: 2,938
Join Date: Apr 2008
Location: outside of ATL, GA
I assume you use this OR SetCPU and can't use them both together as it sounds like they would clash...

Swyped from my supercharged Evo!
Main Phone: White Samsung Note 3 + 64GB card
Other phone:White Note 2
Other Phone: White HTC Evo 4G LTE
Other Phone: Black HTC Evo 4G LTE
Main Tablet: Asus Infinity 32GB Internal + 64GB card
Main Tablet: 2013 Nexus 7 32GB

98 GT: Lots of bolt-ons, suspension, exhaust.
06 GT: Vortech supercharger 10 lbs boost, full suspension, exhaust, too much to list here
Both purchased new and all mods done by me
 
luckylui
Old
#7  
luckylui's Avatar
Senior Member
Thanks Meter 363
Posts: 4,019
Join Date: Aug 2010
Location: Chi-Town
So far so good myn. I jumped right in and gave it a shot w the latest stock kernel.. Will report as i go
Thanx much man!!!

Sent from my phone... I think Tapatalk??
Current: LG Nexus 5

Past: HTC One

Past: LG Nexus 4

Tablet: ASUS N7 8GB

Sent from my shuttle to mars!
 
overthinkingme
Old
#8  
overthinkingme's Avatar
Senior Member
Thanks Meter 45
Posts: 625
Join Date: Feb 2010
Location: Los Angeles
Can I use this AND keep setcpu a long as I don't use profiles?

Wouldn't this interfere with havs the same way that profiling in setcpu does?

Sent from my PC36100 using XDA App
--| Nexus 4 | CM10: Nightly |--
Dropbox +500MB Referral
Phone History:
2008: Moto v557_ATT
2009: Blackberry 8310_ATT
2010: HTC Hero_Sprint | Blackberry 9630_Sprint | HTC Evo_Sprint | Nexus One_TMO
2011: LG Optimus V_VM | myTouch 4G_TMO | SGS4G_TMO | HTC HD2_TMO | Vibrant_TMO | iPhone 3Gs_TMO | iPhone 4_TMO | Sensation 4G_TMO
2012: Galaxy Nexus_TMO | Nexus 4_TMO

 
myn
Old
#9  
myn's Avatar
Senior Recognized Developer - OP
Thanks Meter 3997
Posts: 2,652
Join Date: Nov 2007

 
DONATE TO ME
Quote:
Originally Posted by tonwarr.the.incredible View Post
Quick question....is v3 the same that was included with rls2?? Another question that was asked in your ROM thread, does this need to be activated via ADB or does flashing activate? Thanks in advance and keep up the phenomenal work.
Yes. V3 is the same as what was included in RLS2. This mod is automatically activated as soon as you flash it.

Quote:
Originally Posted by stanglifemike View Post
I assume you use this OR SetCPU and can't use them both together as it sounds like they would clash...

Swyped from my supercharged Evo!
Quote:
Originally Posted by overthinkingme View Post
Can I use this AND keep setcpu a long as I don't use profiles?

Wouldn't this interfere with havs the same way that profiling in setcpu does?

Sent from my PC36100 using XDA App
Exactly. Anything that controls the CPU may conflict with this mod.

I'd love to hear feedback from people about what configurations work and what don't though.
 
lido
Old
#10  
Member
Thanks Meter 4
Posts: 55
Join Date: Nov 2006
Quote:
Originally Posted by myn View Post
Yes. V3 is the same as what was included in RLS2. This mod is automatically activated as soon as you flash it.





Exactly. Anything that controls the CPU may conflict with this mod.

I'd love to hear feedback from people about what configurations work and what don't though.
Myn, what kernal do you recommend given the potential conflicts with the tweak?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


TRENDING IN THEMER...