Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[MOD][KERNEL] Battery Life eXtender (BLX)

OP Ezekeel

11th September 2011, 06:07 AM   |  #1  
Ezekeel's Avatar
OP Retired Recognized Developer
Thanks Meter: 1,717
 
715 posts
Join Date:Joined: Jun 2011
Older types of rechargable batteries exhibited a 'memory effect' which made it neccessary to completely charge/discharge the battery when using to prevent degradation of the capacity. Modern Lithium-Ion batteries like in the Nexus S do not show this problem and thus it is not necessary to use the battery in complete (dis)charge cycles. In fact on the contrary, it is commonly accepted that both very low and very high charge states accelerate the degradation of the battery capacity (that is why you should store Li-Ion batteries at around 40% charge).

While a low charge state can be simply avoided by charging the device more often, the battery in the Nexus S by default is charged to around 95% capacity and I could not find any app or tweak to stop the charging at a lower capacity. Thus the only way was to use the manual override and pull the cable which is annoying since one had to monitor the charge state.

So I implemented a simple tweak I called Battery Life eXtender (BLX) which can be used to set a limit for the capacity to which the battery will be charged by passing a value between 0 and 101 to 'charging_limit' in '/sys/class/misc/batterylifeextender' (101 by default).


Changes to the source code: http://www.pastie.org/2516542


BUGFIX:

The battery status is set to 'full' once the user defined charging limit is reached.

Bug fix: http://www.pastie.org/2534319


BUGFIX #2:

The charging limit is set to 96 by default which will mimic the behaviour of the stock kernel. Also, the maximum value accepted by 'charging_limit' is set to 96.

Bug fix: http://www.pastie.org/2560599


BUGFIX #3:

1. Made BLX compatible with the 100% charging 'fix'.
2. If the charging limit is set to the maximum charging limit, charging will not be stopped until the interrupt signal is received from the MAX8998 chip.

Bugfix: http://www.pastie.org/2751140


No further patches will be published here. I have set up a git repo for all my tweaks. Each mod has its own branch to keep the tweaks cleanly separated and one can simply pull the latest patches from the corresponding branch.

https://github.com/Ezekeel/GLaDOS-nexus-s/tree/blx



I do not accept donations and since I reached my 50GB limit of free space on SpiderOak, thanks to all of you kind people who got an account using my referral link, I could not ask for more.
Instead if you really want to donate your hard earned money to someone who deserves and needs it, consider donating to the Free Software Foundation at fsf.org: These guys are at the frontline when it comes to keeping Linux free and fighting these greedy bastards who think they are entitled to collect royalties and other fees from Linux users due to some silly patents - and if Linux falls, Android will be next.
Last edited by Ezekeel; 7th November 2011 at 07:28 PM.
The Following 82 Users Say Thank You to Ezekeel For This Useful Post: [ View ]
11th September 2011, 06:15 AM   |  #2  
Senior Member
Flag Toronto
Thanks Meter: 140
 
616 posts
Join Date:Joined: Sep 2010
Donate to Me
Can't wait for Trinity to include this!

Sent from my Nexus S using XDA App
The Following 2 Users Say Thank You to king23adrianc For This Useful Post: [ View ]
11th September 2011, 06:18 AM   |  #3  
simms22's Avatar
Recognized Contributor
BROOKLYN!
Thanks Meter: 22,855
 
27,481 posts
Join Date:Joined: Jun 2009
i charge my ns to 100% all the time, i wish that i could charge it even more. lol!
11th September 2011, 06:44 AM   |  #4  
window7's Avatar
Senior Member
Thanks Meter: 295
 
738 posts
Join Date:Joined: Sep 2010
More
Wow! I am waiting for this for long time!

Sent from my Google Nexus S using XDA Premium App
11th September 2011, 06:48 AM   |  #5  
Ezekeel's Avatar
OP Retired Recognized Developer
Thanks Meter: 1,717
 
715 posts
Join Date:Joined: Jun 2011
Quote:
Originally Posted by simms22

i charge my ns to 100% all the time, i wish that i could charge it even more. lol!

Yeah, the drawback of course is the shorter battery runtime. If even a fully charged battery still is not enough for you to get over the day, this tweak is not for you. However, I mostly use the Nexus for internet, email and music and for me a fully charged battery last for about 3 days. So in my case when setting the charging limit to let's say 80% that is still plenty of reserves.

Before I wrote this tweak I thought about if it actually makes sense to try and prolong the lifetime of these batteries because they can be easily replaced and are also pretty cheap. However it seemed like a good idea purely from an environmental point of view (even if there is no climate change like Rick PArry totally has convinced me).
The Following 5 Users Say Thank You to Ezekeel For This Useful Post: [ View ]
11th September 2011, 07:04 AM   |  #6  
simms22's Avatar
Recognized Contributor
BROOKLYN!
Thanks Meter: 22,855
 
27,481 posts
Join Date:Joined: Jun 2009
Quote:
Originally Posted by Ezekeel

Yeah, the drawback of course is the shorter battery runtime. If even a fully charged battery still is not enough for you to get over the day, this tweak is not for you. However, I mostly use the Nexus for internet, email and music and for me a fully charged battery last for about 3 days. So in my case when setting the charging limit to let's say 80% that is still plenty of reserves.

Before I wrote this tweak I thought about if it actually makes sense to try and prolong the lifetime of these batteries because they can be easily replaced and are also pretty cheap. However it seemed like a good idea purely from an environmental point of view (even if there is no climate change like Rick PArry totally has convinced me).

i thought about the need to prolong the batterys life too. i thought about how long id be using my phone as a primary device before i get a new one vs the actual life of the battery. i figured id replace the phone before the battery actually died. of course, there is that odd random chance that the battery will die much quicker than expected. my original g1 battery from 2008 is still good, and i abused that phone for a long time. but, there is something else that i didnt think about. there are lots of people in the world that are less fortunate than i am. and they need their devices to last them as long as the devices can because they cant afford getting new ones. and that includes the battery too. they would appreciate something like this. of course, there is that envirenmental thing that you touched upon. less crap destroying our wonderful planet
11th September 2011, 09:40 AM   |  #7  
Borky_16's Avatar
Retired Recognized Developer
Flag Salzburg
Thanks Meter: 116
 
540 posts
Join Date:Joined: Jun 2010
More
Quote:
Originally Posted by Ezekeel

Yeah, the drawback of course is the shorter battery runtime. If even a fully charged battery still is not enough for you to get over the day, this tweak is not for you. However, I mostly use the Nexus for internet, email and music and for me a fully charged battery last for about 3 days. So in my case when setting the charging limit to let's say 80% that is still plenty of reserves.

Before I wrote this tweak I thought about if it actually makes sense to try and prolong the lifetime of these batteries because they can be easily replaced and are also pretty cheap. However it seemed like a good idea purely from an environmental point of view (even if there is no climate change like Rick PArry totally has convinced me).

so it is not for hardcore user? I have to recharge the phone every evening *argh* !

Sent from my Google Nexus S using xda premium
11th September 2011, 10:05 AM   |  #8  
dario3040's Avatar
Senior Member
Flag Oslo
Thanks Meter: 157
 
1,581 posts
Join Date:Joined: Feb 2010
More
Sounds like Simms is waiting for the Nexus Prime?
11th September 2011, 10:33 AM   |  #9  
Senior Member
Thanks Meter: 39
 
233 posts
Join Date:Joined: Aug 2011
Quote:
Originally Posted by simms22

i charge my ns to 100% all the time, i wish that i could charge it even more. lol!

Sry for the noob question, but how do u charge it to 100%?
11th September 2011, 10:40 AM   |  #10  
brainmaster's Avatar
Recognized Developer
Thanks Meter: 4,518
 
3,938 posts
Join Date:Joined: Dec 2006
Donate to Me
I appreciate your work Ezekeel.

I have one suggestion: Can you make one thread with all your MODs included so that it is not fragmented all over the Android Development forum?

That would be very kind of you.

The Following 3 Users Say Thank You to brainmaster For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes