[APP][ROOT][4.0+]Battery Charge Limit v1.1.1

mj7649

New member
Jul 12, 2007
4
0
0
how are you able to write to /sys? mine says "/sys not enough memory"
hummm all I did was unlocked bootloader and rooted with magisk, and then I set that file path in "Configure Control Data" in the Battery Charge Limit app, I didn't do anything else special, I am new to this but that error sounds like a permission problem...
 

mmoiron

Member
Oct 5, 2008
19
1
0
Feature request / application idea:
I no longer root my smartphones but this is something I'd like to have. I've tried to do something similar with Tasker but didn't manage to get it working properly. It would be nice if your application was able to send GET requests to switch ON or OFF a smartplug (sonoff basic with Tasmota but should work with others) thus controlling the charging process. Another nice functionality would be to keep battery level between two thresholds, say 75-80, until time to next alarm is less than a certain time (1 hour). This would allow us to charge our smartphones every night, without having it fully charged for too long, yet maintaining the full charge available when the wakeup alarm is triggered.
Just an idea.
Cheers
MFM
 

larsdennert

Senior Member
Dec 5, 2007
967
307
93
Feature request / application idea:
I no longer root my smartphones but this is something I'd like to have. I've tried to do something similar with Tasker but didn't manage to get it working properly. It would be nice if your application was able to send GET requests to switch ON or OFF a smartplug (sonoff basic with Tasmota but should work with others) thus controlling the charging process. Another nice functionality would be to keep battery level between two thresholds, say 75-80, until time to next alarm is less than a certain time (1 hour). This would allow us to charge our smartphones every night, without having it fully charged for too long, yet maintaining the full charge available when the wakeup alarm is triggered.
Just an idea.
Cheers
MFM
Buy a new oneplus phone or iPhone. They have this feature built in.
 

sfaeium

Member
Dec 8, 2020
10
0
1
My old Nexus 5 has a ROM which sets the control file to be read only, so without "user intervention" Battery Charge Limit (BCL) won't be able to change the content of this file and it won't work as expected. As a workaround, I created a script using ElementalX Kernel Manager, which runs after every boot, to allow the control file to be writable. After that BCL works perfectly.

My other rooted Android devices don't need this workaround.
Could you share this script?
 

aamadorj

Senior Member
Jan 11, 2010
990
559
123
My old Nexus 5 has a ROM which sets the control file to be read only, so without "user intervention" Battery Charge Limit (BCL) won't be able to change the content of this file and it won't work as expected. As a workaround, I created a script using ElementalX Kernel Manager, which runs after every boot, to allow the control file to be writable. After that BCL works perfectly.

My other rooted Android devices don't need this workaround.
Could you share this script?
Sure, it's attached as a text file.
 

Attachments

d3smond

Senior Member
Aug 8, 2020
50
12
8
I have a Xiaomi Mi 10T Pro running Lineage OS with Magisk.
I granted root permission for the app but the app does not work, I set it to 80% but it charged past 80%.
What do I have to change to make it work?

Thx
 

yaconsult

Senior Member
Nov 13, 2013
318
52
48
I would LOVE to get this working on my new Pixel 4a 5G. Here are the nodes under the power_supply directory. Can someone tell me how to enable and disable charging on this magisk rooted phone? I am willing to experiment and report back results.

I have uploaded a copy of all the file nodes under /sys/class/power_supply at the following pastebin:
https://pastebin.com/T0VJqiW4

I know something has changed on the 4a 5G because advanced charge controller worked fine on the 3a but on the 4a 5G the phone always thinks it is charging even when ACC has stopped the charging.

Thanks!
 

Gibsonflyingv

Senior Member
Jul 28, 2011
354
56
48
I would LOVE to get this working on my new Pixel 4a 5G. Here are the nodes under the power_supply directory. Can someone tell me how to enable and disable charging on this magisk rooted phone? I am willing to experiment and report back results.

I have uploaded a copy of all the file nodes under /sys/class/power_supply at the following pastebin:
https://pastebin.com/T0VJqiW4

I know something has changed on the 4a 5G because advanced charge controller worked fine on the 3a but on the 4a 5G the phone always thinks it is charging even when ACC has stopped the charging.

Thanks!
I'm also trying to get this to work on my P5. I noticed, when I was looking, only some of those are files are writable. I don't know much about this stuff but I wonder if setting "current max" to 0 once we hit our limit would do it?
 

evronetwork

Senior Member
Jan 19, 2012
1,525
401
113
North
Wish this app would still be in development, my gf phone(my prev phone) oneplus one works great, as for mine Xiaomi Mi Mix 2S, I need to reset battery stats each time ...but it does honor the limit
 

pleomaxell

Senior Member
Oct 20, 2012
332
75
48
I am trying to make it work on Nexus 7 3G. The default /sys/class/power_supply/battery/status file isn't working. It keeps on charging past my set limit. Is there any other way to make it work?
 

the_cr0w

Senior Member
Jan 25, 2014
86
8
28
Cervia
I am trying to make it work on Nexus 7 3G. The default /sys/class/power_supply/battery/status file isn't working. It keeps on charging past my set limit. Is there any other way to make it work?
same to me in my asus zenpad 10 :(
it shows only motorola defy+ in the control files, don't know if that is the problem

UPDATE: found out that the app should automatically edit /sys/class/power_supply/battery/charging_enabled but on my device the control file points to /sys/class/power_supply/battery/status , which is a file that does not have a binary value, thus cannot be automatically switched, i guess? however a custom file can be pointed enabling configurable ctrl file data option, but i don't know what file should be. any ideas?
 
Last edited:

the_cr0w

Senior Member
Jan 25, 2014
86
8
28
Cervia
But is there a charging_enabled file on /sys/class/power_supply/battery/?
no! maybe that's the problem ? or maybe there is another file with the same function?

UPDATE: found out that there is a file in sys/class/power_supply/ac/device that is called charge_status, and as expected the content of the file is 0 while not plugged and 1 while plugged. i tried to set that as ctrl file but nothing changed, then i noticed that it has only read permissions, tried to set rwxrwxrwx so that the app could edit the file but changing the permissions bugged my system ui and forced me to reboot. after booting the permissions of the file are reset into r--r--r--. Is this the problem?
 
Last edited:

pleomaxell

Senior Member
Oct 20, 2012
332
75
48
There is another file called sys/class/power_supply/ac/online which becomes 1 when the charger is connected. I face similar issue with that file too. The phone restarts as soon as I change the permission and set an upper and lower limit.
 

the_cr0w

Senior Member
Jan 25, 2014
86
8
28
Cervia
There is another file called sys/class/power_supply/ac/online which becomes 1 when the charger is connected. I face similar issue with that file too. The phone restarts as soon as I change the permission and set an upper and lower limit.
eww let me know if you find out anything new... i guess the app is discontinued by the developer as of now, and it's sad because it's still used even in modern devices
 
  • Like
Reactions: pleomaxell