Code Monkey home page Code Monkey logo

batterychargelimit's People

Contributors

adroitadorkhan avatar angelsl avatar axelblaz3 avatar brb2000 avatar caiorrs avatar davidgro avatar fkeglevich avatar himura2la avatar hypothermic avatar ibilux avatar lozanro avatar milux avatar poussinou avatar sm4rk0 avatar sriharshaarangi avatar teualin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

batterychargelimit's Issues

Make charge range fully configurable

Currently, you can only choose a lower limit of 1-10 below your upper limit. Could you make the lower limit a textbox instead of a slider so we can enter anything we want?

Support for mipad 2

Control file for mipad 2: /sys/class/power_supply/bq2589x_charger/enable_charging

Support for Nexus 6 please >:o)

I’ve found the following file /sys/class/power_supply/battery/charge_enabled on my rooted Nexus 6 (Shamu) & toggling 1 to 0 does stop charging the device. The same file is selected by default in your apk.
Can you please add support for the Nexus 6?

Issue: The latest version of your apk does not function as intended on my N6 running RR Unofficial Android 7.1.1. (I gave it SU rights).
The Battery Charge Limit apk seems to stop the charge at the set limit once, however the N6 will not charge again once below the lower limit set in the apk unless rebooted. Than it will charge to the set limit again once only! I also don’t see the value of 1 change to 0 in the above mentioned control file.
I also don't like the idea of the phone being kept awake always if it is on hte charger...
Couldn't the ROM be modified to se 75% as full?
Let me know if I can help you in any way. Thank you!
Cheers

Note 3 issue

Hello
My note 3 (n9005 eur)phronesis v6 phantom kernel v1.2p stops recharging normally after the app has cut the load until restart
It is as if the app remains in "no charge or discharge" mode permanently
thank you in advance

Reduce necessity to run (most of) the code as root

It occurred to me that it might be a good idea to split the code into two parts - the existing code could run without root privileges, so long as something (could be a separate helper app - which does need to run as root - but only once per boot, or a shell script, or even a script or other type of permissions tweak which ships with the OS for custom ROMs) changes the necessary permissions on the /sys files to give the app write permissions to the necessary files (permissions only need changing on boot-up, thereafter the main part of the app can run without root privileges).

I've tested this using adb (confirmed that I could stop charging on a jfltexx as a non-root user - having changed the permissions on the necessary files under /sys).

Limit charge rate above/below a fixed charge threshold, temperature etc.

Some android devices support changing the charge rate via files in /sys, slow charging prolongs battery life (and the user probably won't be inconvenienced at all for overnight charging).

Would be good to offer option to limit charge current where supported (perhaps offering option to reduce current when very empty or near target fill).

Charge rate could be automatically limited based on Android "quiet hours" setting and also device temperature (or battery temperature if available).

Charging fast towards when near full and completely empty impacts battery life (more so with some cell chemistries than others I believe).

The same goes for charging batteries which are at high temperatures or very low temperatures. Some built-in chargers will be sufficiently intelligent to compensate for these factors on their own, but most aren't.

http://batteryuniversity.com/learn/article/charging_lithium_ion_batteries

https://www.digikey.com/en/articles/techzone/2016/sep/a-designer-guide-fast-lithium-ion-battery-charging

^^^ also see "Fast charging trade-off" section in the digikey article...

http://teslapedia.org/model-s/tesla-driver/understanding-charging-rates/

^^^ section on charging speed vs. temperature

Cheers,

Tim.

App suddenly exits

Samsung S3 Android 4.3

Sometimes during overnight charge BatteryChargeLimit process exits and thus device is charged to 100%.
Feel free to ask me any needed info, using ADB, collecting logs, etc.

control file access permissions (readable only)

related to #45

When testing BCL with Nexus 5 (running LineageOS 14.1-20170829-NIGHTLY-hammerhead), BCL failed to write to the control file (/sys/class/power_supply/ac/charging_enabled). BCL had therefore no effect on limiting the battery charge.

Reason: The control file was readable only.

After changing the file to read/write (chmod u+w), BCL was able to limit the battery charge level as intended.

Therefore it is suggested to include code to BCL, that checks and if necessary updates the control file's access permissions to read/write.

LG G5, palese give some love :*

Hi,

Im an LG G5 owner. I please ask you to supporto G5 because in my case this app would have saved my phone from bending the screen.. Yes read right.

(Little story spoiler)
LG G5 is unibody metal with sleeve battery (no back cover)..so a "keep growing battery" find his "locus minoris resistentiae"(alias avere could grow with minor pressure) in upper parte exactly below IPS frame.

As in my case you won't notice any bulging from back part but when happen, you recognize surfing on web page in white background some circular strain In various colour where the pressure hit the screen, like discolorations.

Further investigations made me conscious that leaving the phone face down on table gave the phone a " ship form".. yes my gorilla glass 4 was bendedand my battery stucked inside without possibility to remove it.

It also 1 and half months in LG assistant service (they took pieces from Singapore and take a while to ship in Italy)
(/finish spoiler)

So cross fingers for all LG G5 owners and a warning to them.. Sleeve the battery from inside at least once a week to recognize the first signs of bulging, or hug this app ;)

Nexus 6 - Cannot charge

Nexus 6 (shamu)
Magisk systemless root using Magisk Manager

Charge limit worked perfectly until the max cutoff. After falling below the minimum, it is continuing to drain. Phone will not charge even after disabling Battery Charge Limit or even uninstalling the application.

Currently /sys/class/power_supply/battery/charging_enabled is set to 1 and still won't charge.

(disabling and re-booting restores charging functionality)

support for teclast x98 air lll (M5C5)

Congrats for a good job. Your APP is working perfectly in my mobile phone.Is it possible to support the teclast x98 air ? Which Informations you need oft the Intel cherry trail tablet?
Some files are located /sys/class/power_supply/dollar_cove_charger/enable_charging
Thanks in advance!

Shield Tablet random crash after unplugging

I received a random crash at 17:29 today after unplugging power cable. Attached is an unfiltered logcat. If this is another weird crash like that crash i had at first run after installing the app this morning, don't worry about it, just close the issue. I'm going to uninstall this app and wait to test again until I get my system straightened out from that bad Titanium Backup restore I did a while back. I'm not really helping the situation here by continuing to test with a known system issue on my end. Thanks for your work on this app and adding experimental Shield Tablet support though! I appreciate it.

2017-08-16-17-34-48.txt

Charge stop not working on Xiaomi Redmi Note4/Note4x

Model: Xiaomi Redmi Note4/Note4x
Android version: 7
Miui version: 7.8.24

There are two control files for changing charging state.

  1. sys/class/power_supply/battery/battery_charging_enabled
  2. sys/class/power_supply/battery/charging_enabled

For both files, 0 is not charging, 1 is charging
Changing the value of either of the files turns off the charging. Even if any one of the files have value '0', charging is cut-off.

I'll be happy to provide any other info

I need volt charging limmter

hi every body I need voltage limit because my p9lite dont stop charging 4.5volt andgo upper to 4.6 volt ineed ur help percentage is always false hardware problem but give real battery volt

Smartmanager reports 12 fc's in the last 5 days

Hey following setting:

-S7 edge (exynos)
-Nougat (batman rom)
-magisk 13.5 rooted

The samsung smartmanager reports 12 force close of bcl in the last 5 days. Beside that its working 100%. I mean the app does what it should do. But im scared it could drain battery or something like that if its fc's and needs to restart.

If i need to provide a log please give short advice how to do that. If you give me the codes im able to extract necessary information via adb or something else :)

Regards

Feature Request: ELE Phone P9000 (maybe all MTK Phones) support

Hello,

i think i've found the configurations named online.

It is in /sys/class/power_supply/ac/
/sys/class/power_supply/usb/
/sys/class/power_supply/wireless/
The online file change its number for non charging 0 and charging 1

I don't know if it's important, that the online file is also available in /usb /wireless

I also found the direct path /sys/devices/platform/battery/power_supply also with /ac / usb /wireless and the online file

For now I wasn't able to change the numbers with a text editor, i think its the issue, that Magisk is rooting as read only.

Support for Nexus 10 (manta)

Support for Samsung Nexus 10.
The file is /sys/class/power_supply/manta-battery/charge_enabled (1 = charging enabled, 0 = disabled).

Thanks :)

Add support for Nvidia Shield Tablet

I posted in the forum, but I'm adding here also.

I found the correct file to make this work on the Nvidia Shield Tablet (Android version 7.0 stock rooted OS).

File location: /sys/devices/platform/7000c400.i2c/i2c-1/1-006b/charging_state
File has one line of text and only one word: "enabled" or "disabled"

Setting text to "enabled", which is the default text, allows charging, and setting it to "disabled" stops charging.

Took me almost two hours to find the correct file and test it.

Differences when using Battery Charge Limit with Magisk v13 compared to Magisk v12

When I started using Magisk v13 (beta) on my N6P running lastest PureNexus, I notice Battery Charge Limit behaved differently and sometimes it didn't work properly after reconnecting.

When rooted with Magisk v12 (stable), I was used to see the "Battery Charge Limit enabled" toast as soon as I plugged the power cord in and the "Battery Charge Limid disabled" toast right after I unplugged the power cord. Also it was possible to replug the cord immediately and the enabled toast will show again.

With Magisk v13, the first toast is usually showed but the second one never shows and very often if I plug the power cord again Battery Charge Limit will not work as intended.

The logcats I capture just before I plug the power cord and right after I unplug it with each Magisk version installed are attached.
Magisk_v12.txt
Magisk_v13.txt

Feature request

I would like to see a feature to have battery charge limiter be able to auto enable and disable a specific times. E.g. turn on in the am and of in the pm so the phone will charge fully overnight only.

option to not display a permanent notification

Please add an option to not display the permanent status of the app in the notification aera.
In my opinion, the status is just useful for someone that is worried about this status ;-) If everything works fine, it's like another parameters of the phone and a permanent notification is not required anymore.

Support for Nexus 9

I found the following on my nexus 9:

flounder:/ # cat /sys/devices/platform/tegra12-i2c.0/i2c-0/0-006b/charging_state
enabled

Can you add support for the Nexus 9? It would be much appreciated!

Add Support for Xiaomi Mi6 - I found a proper file to enable/disable charging

I found a right file which works for Mi6 on stock Android 7.1.1 (MiUi 9)
by editing this file

"file": "//sys/class/power_supply/battery/input_suspend",
"label": "input_suspend",
"details": "Xiaomi Mi6",
"chargeOn": "0",
"chargeOff": "1",

"0" allow charging and "1" disables charging
I tested it and works without any problem, please add support for Mi6 ASAP. Thanks

Support for Nexus 10 please =o)

Thank you for your work on the Battery Charge Limit apk! I know there is some support for the N10 already...
Issue: It does not function as intended on my N10 running DU Android 6.0.1! It charged up to the set limit the first time & the next time I put my N10 on charge (once the charge level was below the set low limit) my N10 it got fully charged the second time around, despite the limit been set to 75%.
Let me know if I can help you in any way. Thank you!
Note: Link to a script control feature => https://forum.xda-developers.com/nexus-10/general/script-to-control-nexus-10-charge-35-65-t3035588
Kernel mod anyone => https://forum.xda-developers.com/showthread.php?t=2469261
Cheers

Shield Tablet, charging resumes.

OK I just noticed an issue. When the tablet is plugged in it stops charging at 80% like it should, but if I turn on the display and use the tablet a little while its plugged in (just a few seconds, maybe 15 or 20) it re-enables charging for a little bit and then disables it again, repeatedly. In doing so, the charge keeps increase above the 80% limit.
2017-08-16-10-14-36.txt

Feature Request: Amazon Fire support

Support for Amazon Fire tablets. The file is /sys/class/power_supply/battery/device/Charging_Enable (1 = charging enabled, 0 = disabled) or /sys/devices/platform/battery/Charging_Enable (direct file), either works.

Nexus 5 support

Nexus 5 running LineageOS 14.1-20170829-NIGHTLY-hammerhead

Control File (default = read-only ... -r--r--r--):
/sys/class/power_supply/ac/charging_enabled
1 = charging enabled
0 = charging disabled

I had to change the file to read/write:
/sys/class/power_supply/ac # chmod u+w charging_enabled

Testing

/sys/class/power_supply/ac # echo 0 > charging_enabled
/sys/class/power_supply/ac # cat status
Not charging

Waited for 10 minutes ... battery charge level didn't go up.

After setting the file back to 1, the phone got charged again and battery charge level increased.

/sys/class/power_supply/ac # echo 1 > charging_enabled
/sys/class/power_supply/ac # cat status
Charging

Nexus 7 2013 Wi-Fi (razor/flo)

I'm trying to support my device but failed to find the correct file. Can you please look at my attempts and give some advice?

1|shell@flo:/sys $ su
root@flo:/sys # find . -iname *charg*
./fs/cgroup/memory/sw/memory.move_charge_at_immigrate
./fs/cgroup/memory/memory.move_charge_at_immigrate
./bus/platform/devices/pm8921-charger
./devices/i2c-0/0-0055/power_supply/battery/charge_full_design
./devices/i2c-0/0-0055/power_supply/battery/charge_avg
./devices/i2c-0/0-0055/power_supply/battery/charge_now
./devices/i2c-0/0-0055/power_supply/battery/charge_full
./devices/i2c-0/0-0055/power_supply/battery/charge_counter
./devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger
./kernel/fast_charge
./kernel/fast_charge/force_fast_charge
./module/msm_otg/parameters/usbhost_charge_mode

root@flo:/sys/bus/platform/devices/pm8921-charger # ls -l
-r--r--r-- root     root         4096 2017-10-15 17:02 modalias
drwxr-xr-x root     root              2017-10-15 16:59 power
lrwxrwxrwx root     root              2017-10-15 17:02 subsystem -> ../../../../../bus/platform
-rw-r--r-- root     root         4096 2017-10-15 16:59 uevent

root@flo:/sys/bus/platform/devices/pm8921-charger # cd /sys/devices/i2c-0/0-0055/power_supply/battery
root@flo:/sys/devices/i2c-0/0-0055/power_supply/battery # ls -l
-r--r--r-- root     root         4096 2017-10-15 16:59 capacity
-r--r--r-- root     root         4096 2017-10-15 17:02 charge_avg
-r--r--r-- root     root         4096 2017-10-15 16:59 charge_counter
-r--r--r-- root     root         4096 2017-10-15 17:02 charge_full
-r--r--r-- root     root         4096 2017-10-15 17:02 charge_full_design
-r--r--r-- root     root         4096 2017-10-15 17:02 charge_now
-r--r--r-- root     root         4096 2017-10-15 16:59 current_now
-r--r--r-- root     root         4096 2017-10-15 17:02 cycle_count
lrwxrwxrwx root     root              2017-10-15 17:02 device -> ../../../0-0055
-r--r--r-- root     root         4096 2017-10-15 17:02 energy_now
-r--r--r-- root     root         4096 2017-10-15 16:59 health
drwxr-xr-x root     root              2017-10-15 16:59 power
-r--r--r-- root     root         4096 2017-10-15 17:02 power_now
-r--r--r-- root     root         4096 2017-10-15 16:59 present
-r--r--r-- root     root         4096 2017-10-15 16:59 status
lrwxrwxrwx root     root              2017-10-15 17:02 subsystem -> ../../../../../class/power_supply
-r--r--r-- root     root         4096 2017-10-15 16:59 technology
-r--r--r-- root     root         4096 2017-10-15 16:59 temp
-r--r--r-- root     root         4096 2017-10-15 16:59 type
-rw-r--r-- root     root         4096 2017-10-15 17:02 uevent
-r--r--r-- root     root         4096 2017-10-15 16:59 voltage_now
root@flo:/sys/devices/i2c-0/0-0055/power_supply/battery # cat status
Charging
root@flo:/sys/devices/i2c-0/0-0055/power_supply/battery # cat charge_full
3626000
root@flo:/sys/devices/i2c-0/0-0055/power_supply/battery # cat charge_full_design
3828000

root@flo:/ # cd /sys/devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger
root@flo:/sys/devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger # ls -l
-r--r--r-- root     root         4096 2017-10-15 17:02 modalias
drwxr-xr-x root     root              2017-10-15 16:59 power
lrwxrwxrwx root     root              2017-10-15 17:02 subsystem -> ../../../../../bus/platform
-rw-r--r-- root     root         4096 2017-10-15 16:59 uevent

Support for Samsung Nexus 10 and Jiayu S3 Advance

Hi Sir,

Can you add support for two of my devices?
The Battery Charge Limit says my devices are not supported yet.

On Samsung Nexus 10, rooted, using root explorer, i mounted the partition as r/w, i tried to change from '0' to '1' the value of

/sys/class/power_supply/manta-battery/charge_enabled

Saved the file and exit.

Tried to run the Battery Charge Limit, but it still says the device isnt supported.

I then tried to reboot but the changes i made to the system didn't survive the reboot.

On Jiayu S3 Advance (please see xda), i cannot find an entry to edit using the guide you posted here. Can you point me in the right direction please?

Also, both devices are in Nougat 7.1.2 if that matters.
Jiayu is on MadOS 7.1.2
Nexus 10 is on LineageOS 7.1.2

Any suggestions?

Limit set to 90%, stops charging at 70%

Using superman ROM on a Samsung galaxy s7 sm-g930f. Tried both control files available to me (store_mode and batt_slate_mode) and didn't seem to make a difference.

Logs with suggested filter don't include anything at the moment it hits 70. But I can attach complete logs (is there any sensitive information I should edit out?)

Battery stats reset not working on my N6P with latest PureNexus (7.1.2.r17)

My N6P powered by latest PureNexus (7.1.2.r17) and rooted with Magisk v12 or Magisk v13 beta doesn't allow to reset battery stats with "dumpsys batterystats --reset" command, same as mentioned before by another Battery Charge Limit user at the XDA thread.

Using an elevated terminal, the command "dumpsys batterystats --reset" will return "Error dumping service info: (Unknown error -2147483646) batterystats".

And this is the corresponding logcat output:
[ 06-12 19:54:21.837 19200:19200 W/dumpsys ] type=1400 audit(0.0:67): avc: denied { write } for path="pipe:[107864]" dev="pipefs" ino=107864 scontext=u:r:system_server:s0 tcontext=u:r:su:s0 tclass=fifo_file permissive=0

Newest PureNexus just added an option to reset battery stats and it seems that's done with this commit.

Can this method be added to Battery Charge Limit as an alternative to the dumpsys command?

Support of maguro/tuna

My GN (maguro) running DU 11.7 has /sys/class/power_supply/battery/charge_enabled with values=0|1

Can you please add it?

On / Off mode

I'd like to use this app differently to most.

I have DJI Drone and the remote when connected to an android phone will automatically start charging the phone and therefore drawing power from the tiny battery on the controller.

I would like to be able to enable and disable charging with a simple click. Rather than having to use the charging limits.

Limit charge by voltage

Is there possibility to limit charge by real voltage, not by percents? It seems that percent indicator readings have no straightforward dependence with real battery voltage.
I would like to keep voltage about 3.8V, but it's difficult to say what percentage to choose.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.