yashsingh1/xdaforums huggingface dataset:
[Magisk] Dant3s:
# Advanced Charging Controller (acc) Configuration
# /data/media/0/acc/config.txt

capacity=,,90-100 # <shutdown,coolDown,resume-pause> -- ideally, <resume> shouldn't be more than 10 units below <pause>. <shutdown> and <coolDown> can be null/disabled (i.e., capacity=,,70-80).

coolDown=50/10 # Charge/pause ratio (in seconds) -- reduces battery temperature and voltage induced stress by periodically pausing charging. This can be disabled with a null value or a preceding hashtag.

temp=400-450_90 # coolDown-pauseCharging_wait -- <wait> is interpreted in seconds and it allows battery temperature to drop below <pauseCharging>. By default, temperature values are interpreted in <degrees Celsius times 10>. If <coolDown> is null (i.e., temp=-450_90), the cooling engine acts upon coolDown capacity and max temperature only.

verbose=false # Alpha and Beta versions will generate verbose whether or not this is enabled.

resetUnplugged=false # Reset battery stats every time charger is unplugged, as opposed to only when max battery capacity is reached.

loopDelay=10 # Time interval between loops, in seconds -- do not change this unless you know exactly what you're doing!

maxLogSize=10 # Log size limit in Megabytes -- when exceeded, $log becomes $log.old. This prevents storage space hijacking.

switch=./battery/batt_slate_mode 0 1 # Charging switch parameters (<path> <onValue> <offValue>), example: switch=/sys/class/power_supply/battery/charging_enabled 1 0, pro tip: <./> can be used in place of </sys/class/power_supply/> (i.e., switch=./battery/charging_enabled 1 0). NOTE: if acc's database contains a working charging switch for your device, it is set automatically when charger is connected for the first time after installing and rebooting.

onBoot=./usb/device/razer_charge_limit_enable:1 ./usb/device/razer_charge_limit_max:80 ./usb/device/razer_charge_limit_dropdown:70 # These settings are aplied on boot. Note that the default working path is "/sys/class/power_supply/"; "./" can be used in place of it.

onBootExit=false # Exit after applying "onBoot" settings from above. Enabling this is particularly useful if voltage_max or similar is being set -- since keeping accd running in such cases is pointless.

#onPlugged=./wireless/current_max:2000000 ./usb/current_max:2000000 # These settings are applied every time an external power supply is connected. The default working path is "/sys/class/power_supply/"; "./" can be used in place of it.

It's almost default.
[Magisk] VR25:
<coolDown> is the battery % level at which charging starts being paused regularly and briefly (default: every minute for 10 seconds) to keep battery temperature and voltage within less stressful thresholds.

The other values dictate when to resume and pause charging, respectively.

e.g., capacity=5,60,70-80

5: shutdown at this level if battery is not charging

60: coolDown (as described above)

70: resume charging when battery level drops to or below this value

80: pause charging when battery level rises to or above this value

___

IMPORTANT NOTE

Refrain from setting null values (e.g., capacity=,,70-90) to disable features. For some of the variables, this causes logical errors and malfunctioning. The updated documentation and config have details on how to properly handle these.

Regarding this, sorry for the logical errors I've made and the misleading information I've put out.
[Magisk] semdxd:
how to download latest version ? 201901092?
[Magisk] alex moymoy:
[MENTION=5228676]VR25[/MENTION] I tried what you said but unfortunately doesn't sticks, booth files. I don't know if it have to do with this custom ROM and its Kernel. With stock rom your "MCC" mod worked. I already tried all the mods and apk for charge control and nothing works. But thanks anyway and continue with your great work.?

Sorry for rusty English
[Magisk] ugvpkn:
Open Magisk Manager - from the hamburger menu on the top left - 'Downloads;' you should see a 'update available' section, click on the download icon on the right.
[Magisk] lvbaal:
Message from Huawei weirdo: ¨charging interrupted at max capacity level¨ :good:
[Magisk] lentm:
[MENTION=5228676]VR25[/MENTION], I attached the log file for further assistance regarding the way to enable the fast wireless charging at 10W (default 15W only) for LG V30+.

Looks like it doesn't show the default value that you mentioned.

Thank you so much for your help!!
[Magisk] Ixioon:
Ok then something went wrong because my phone keep charging until i unplugged it at 89% and i tchek with acc -D it was running
[Magisk] heithered:
Latest update fails to install for me. It gets stuck at "-Generating /data/media/0/acc/logs/acc-power-supply-griffin.log" and just sits there. Promted with magisk manager isnt responding and after 5mins i closed magisk manager, older version also got messed up after this and had to uninstall it and now i cant install acc. Anyone experiencing this?
[Magisk] pekkle_hksar:
just to report there are many "sh: write error: Invalid argument" in acc-daemon-dipper.log

although daemon is running, is it normal having error in log?
[Magisk] emperor8696:
Will the limit still work if my phone's turned off while it's being charged?
[Magisk] VR25:
The default values should show up while charging wirelessly, but forget about it for now.

See whether setting /sys/devices/soc/c175000.i2c/i2c-1/1-0061/power_supply/dc-wireless/fastchg to 1 enables fast charging.

Something Else (off topic)

Looking at your log, I see several "voltage_max" paths. Target the values starting with 4 (e.g., 4395000 --> 3925000). Try changing only the first 3 numbers. Test all files until you find one that holds the change. If this works, it will be the very best thing to do for your battery lifespan!
[Magisk] VR25:
Please, upload all files from /sdcard/acc/logs/ for further assistance.

Does it Install via TWRP? Does the previous version work correctly (controls charging)?

Regardless of this, is everything working as expected? I'd like to see the log.

No, since acc won't be running.
[Magisk] pekkle_hksar:
Seems everything working. Attached the logs.
[Magisk] heithered:
Flashed with twrp but in magisk manager module shows as acc (no info provided) and still shows an update available but it's the same version. Previous versions worked like a charm and had no issues at all till this one.

[IMG="Magisk manager info"]https://i.imgur.com/9V5zCKw.png[/IMG]
[Magisk] pekkle_hksar:
Flash Magisk again may help :)
[Magisk] aouerfelli:
Looks like it's working now! I'll let you know if anything pops up. Thanks a ton!
[Magisk] lentm:
I see. I will give it a try and report.

Appreciate your help!
[Magisk] heithered:
I dont think the issue is with magisk since i can install, uninstall or update other modules just fine. At least even though i cant update with magisk manager and acc module looks weird and commands like acc/acc -D stop etc returns "/system/bin/sh: acc: not found" it still works as it stops charging at 80%.
[Magisk] VR25:
[MENTION=670241]testguest[/MENTION], try acc -s s /sys/devices/platform/tegra-i2c.4/i2c-4/4-0055/battery_smbus 1 0.

Run acc -e (enable charging) and acc -d (disable charging) to test whether it works.

If it does, run accd to start the daemon.

[MENTION=5550046]heithered[/MENTION], weird issues...

I'm investigating.
[Magisk] semdxd:
Latest version works perfectly on Honor 8 stock Nougat EMUI 5

But when i try to disable charging ( acc -d 1m) accd stops!
[Magisk] testguest:
Thanks, unfortunately it keeps charging after acc -d.
[Magisk] VR25:
It has to be stopped. Otherwise, it would nullify that command's goal. You can't have both things running side-by-side.

To restart accd, run accd.

Commands can be chained: acc -d 1m && accd.
[Magisk] aouerfelli:
After using it on another Huawei device for a while, I can safely say that it also works as expected on my end. Thank you once again for this!
[Magisk] Ahugari:
Am seeing a lot of default values (5000000). Should I change all of them or I only need to change one?

Thanks
[Magisk] Jedi.Tester:
I found voltage_max in several folders under /sys/class/power_supply. Which ones should I change on boot in order to limit charging voltage from USB and wireless charger?

Answering my own question. Modified ./battery/voltage_max from 4400000 to 3960000. Ampere shows around 3.93v when cable plugged in for charging.

I suppose that's all I need to modify? Or am I missing something?

Haven't tested wireless charger yet though.
[Magisk] Doomkopf:
Wow, just installed this module and I am amazed. It does everything I did manually before automatically, which is VERY comfortable :)
[Magisk] paolocorpo:
Dear [MENTION=5228676]VR25[/MENTION]

I want report here that I have installed your acc module on Nexus 5X with Gzero Pie ROM

The charge overnight plugged to AC charger was Ok

The max capacity was reached as expected

Thanks

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] Jedi.Tester:
After changing ./battery/voltage_max to 3960000 I see in Ampere that the charge dropped from ~1500-1700 mA to ~300-400 mA. Is this normal? Or do I need to change something else apart from voltage_max?
[Magisk] veetoe:
If you run "acc -i" in terminal you will probably see that the voltage_now value is near the 3960000 you have set and the charge type will be taper or slow. This is the system slowing down charging to keep you from going over that voltage. The system will also probably report you're phone is fully charged before actually reaching 100% capacity. For example when I set max voltage to 4200000 as opposed to 4400000, my phone will report fully charged at 83%. So long answer short, I think what you're seeing is intended behavior, especially since lowering the voltage. If you let your battery capacity get lower before charging, it will probably fast charge for a bit until it nears that 3960000 voltage then taper off with a slower charge.
[Magisk] Kungfu73:
Hi [MENTION=5228676]VR25[/MENTION]

First, Thanks for your very useful modules!

This module is working great, but has a problem with cool-down!! (I'm using the default configs)

the cooldown process is working fine UNTIL the screen is on. while I turn off the phone screen, after 50s (default), charging stops, but never starts (after default 10s) TILL I turn the screen on again!

I tried with toggling Doze mode, changing config values, also with changing SElinux mode, but with no luck! any help is appreciated ? (also logs and config are attached). Thanks again ?
[Magisk] andrei25025:
Hi. Installed everything you need. I can't figure out what to do, I can't. Terminal can not use study. Help to understand, the step-by-step instruction for the user. In the message.
[Magisk] Jedi.Tester:
Hi veetoe.

Yes, I suspected that to be the case because it started with a slow charge when reaching 60%.

Will try to play a bit with max voltage to find a sweet spot. I think that 3.92v is way too low for a mobile device. 4.0-4.1 should be optimal IMO.
[Magisk] VR25:
Try all until you find a file which keeps the changes. Ignore files with voltage values above your battery's max. If you can't read your battery's max voltage rating (i.e., because the battery is sealed into the phone), look for VOLTAGE_MAX_DESIGN value in the log. That's the default.

Now, to make the actual change, modify the file ending in /battery/voltage_max.

Other possible files are /main/voltage_max, /bms/voltage_max.

This seems to be one of your system's own quirks. I'll take a a closer look. :cool:

You don't have to figure out everything at once. That's not how people usually learn. There's a lot to take in.

You don't have to use terminal. Most of the features don't require user intervention and the module has default settings (my personal settings). Although, usually users want to tweak things, you can simply install, reboot and forget. The config file can be modified using a regular text editor. Just don't use Windows software to edit it. The file itself contains instructions and its path is /sdcard/acc/config.txt.

Since you lowered the max charging voltage, coolDown will unnecessarily reduce the charging rate. Disable it with acc -s coolDown (this nullifies its value).

Yes, 3.92V is low and not meant for daily usage patterns. That's intended for prolonged use while plugged in. Apparently, this voltage is longevity's sweetest spot.

For regular usage, limiting the charging voltage to just below 4.2 is WAY better than the regular 4.3+V. So, you can't go wrong with 4.0-4.1 Volts.
[Magisk] Jedi.Tester:
I just set the voltage_max in onBoot settings and then set onBootExit=true, so I don't think the coolDown should be working since the account daemon is stopped.

Thanks for a nice module. Definitely simplifies things :)
[Magisk] VR25:
You're welcome.

Yeah, coolDown and everything else don't apply when onBootExit=true. You're all set.

By the way, what device are you using? I'm creating a "champions" list. For those who care, that's a major feature to look for when purchasing a smartphone.
[Magisk] Jedi.Tester:
I'm using a Xiaomi Mi MIX3.
[Magisk] guest4711:
Please keep in mind that this feature heavily depends on the kernel. So it runs e.g. well on my GN (maguro) with andis anykernel but it does not work on maguros stock kernel.
[Magisk] Kungfu73:
Thanks:good:. no problem, I'm just OK with nullifying cooldown value for now :). it fulfills my needs
[Magisk] paolocorpo:
Dear [MENTION=5228676]VR25[/MENTION]

I am back with your precious module on my Xiaomi Mi A1 now with Pie Android One

All runs well so far !

I don remember ...

... In case of necessity how temporarily disable acc ? And reable ??

Thanks

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Yes, I'm aware of this.

To disable, run acc -e. Reasoning: it enables charging (which is the default behavior) and stops acc daemon.

To enable, run accd. A reboot has the same effect.
[Magisk] paolocorpo:
Dear

Are you sure about last comand ?

accd

or

acc -d

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Yes, that's right, accd, not acc -d. It stands for "acc daemon".

-d disables charging.

Alternatives to accd are acc -D start and acc -D restart. Mind the capitalization.
[Magisk] Ixioon:
ok very weird i just run acc -D restart yesterday and now it's look like everything working fine i will keep you update the charging stop at 70% i'm assuming it is normal
[Magisk] KitsuneFoxy:
[MENTION=5228676]VR25[/MENTION]

Hi there, the command you gave me worked, but the daemon doesn't stay enabled? Im not sure, however I am not sure what the best settings for my phone is, whether its capabilities to keep batteries at the 3.92? Thing. I know most people no longer use a nexus 4. Just wondering if yiu knew the charging capabilities of the phone and what might be best? Any help, links, or guides are helpful.
[Magisk] VR25:
Let's start from scratch...

1) Reset config by removing /sdcard/acc/config.txt and running accd afterwards.

2) Make sure you have the latest version. Check for updates in Magisk Manager.

3) Upload /sdcard/acc/logs/acc-power_supply-mako.log.
[Magisk] Ahugari:
The ./bms file path don't contain the voltage_max file. Whereas the ./battery file path changes don't stick. So I changed the one located in the ./main path and it seemed to have committed the changes.

Am I supposed to test it's working by running the dumpsys command while charging? Of course after a restart.
[Magisk] VR25:
To test, run acc -i or open the Ampere app and check whether max charging voltage doesn't surpass the value you set.

To automatically set a custom charging voltage on boot, run acc -s onBoot FILE:VALUE.
[Magisk] Ixioon:
The voltage max is not set by default to around ~3.9V ?
[Magisk] sumgyimr:
i got the same problem
[Magisk] RaphaelHam:
I dont really know if it works or not. I can use all the command in terminal. But in this .log it full of 'not found' . Enlighten me please
[Magisk] Sreekantt:
It has been so long I opened this thread. That explains how stable this module was. However, looks like something broke on the newer build which is causing qcom-step-chg(Kernel wakeclock) to drain battery. Uninstalling this module solved that.
[Magisk] Kungfu73:
mentioned in post #1
[Magisk] jiexi:
if i change coolDown to

coolDown= 45/15

is

loopDelay= 15

okay?
[Magisk] Ahugari:
I tried this with no luck. It keep changing back to other figures. Anyone using lg v30 stock kernel to achieve this should help me figure this out. I think this kernel is hindering the change.

I think I'll just stick to the other way of limiting charge. :(
[Magisk] Ixioon:
I don't think changing loopdelay is a good idea.

Can't see how it is related to coolDown
[Magisk] VR25:
The new build cycles through all available charging switches to control charging. One or more of these switches may be the problem. A solution to this is telling acc to work with a single switch and ignore the rest. To do that, run acc -s s, pick a number and test. Repeat this procedure until you find a switch that doesn't cause the qcom-step-chg wakelocks.

As already said by another user, loopDelay has no businesses with coolDown and you shouldn't touch it under normal circumstances. This controls how often acc daemon checks for variable changes (e.g., temperature, capacity). If you go too low, acc will waste resources. If you go to high, it won't control charging effectively (e.g., it'll be late).

Please, upload /sdcard/acc/logs/* for further assistance.
[Magisk] Sreekantt:
Any hint on the switch which was used in the previous builds? Than can make things lil easy for me.
[Magisk] arifsukmaraga:
edit
[Magisk] Kglim:
Acc module with L speed causing bootloop everytime when magisk set this module on boot
[Magisk] Da-BOSS:
I'm using both and I don't suffer from any issues... I guess your kernel or ROM is unstable :)
[Magisk] Ahugari:
There you go. Thanks.
[Magisk] Kglim:
Which kernel do u using? Im using nx r19 kernel with alexis rom 6.0.1.
[Magisk] jiexi:
so loopDelay is in ms then?

I'm trying to reduce the amount of time the phone isn't deep sleeping after it reaches Pause%. It seems the phone doesn't really go to sleep while hovering between Pause% and Resume%
[Magisk] Ixioon:
It'salways stop charging at 70% for me even if i use acc -e its not working.

Could you give it a look
[Magisk] Edocsiru:
My tablet doesn't seem to be supported since the log is filed with 'no such file or directory' errors. And xda doesn't allow me to post links or attach files..

drive.google com/file/d/1U5Pn_cjabVTmXmG7hqSxuCf81H25XYdZ/edit
[Magisk] VR25:
I only remember two default switches:

Samsung - store_mode

Generic - charging_enabled

You can check the commit history on GitHub to see the order of switches (common/switches.txt) in previous versions.

loopDelay's value is in seconds and it doesn't have to do with wakelocks either.

acc itself doesn't prevent deep sleep.

Try enforcing a single charging switch by running acc -s s. Test all until you find the one which doesn't keep your device awake.
[Magisk] ricardofago:
Did anyone get this working on OnePlus 6T lately? It used to work for me when I first installed it but now for some reason I can't make it work. Tried stock and several custom kernels (EX, HolyDragon) on OOS v9.0.11. Tried removing /sdcard/acc and reinstalling the module several times through both Magisk Manager and TWRP. acc -D always says the daemon is disabled, even after trying accd, acc -D start and acc -D restart. acc -s default also seems to apply but makes no difference, it always charges all the way to 100%. I have attached the config and log (which seems to have either weird binary data or some encoding issues towards the end of the file) in case they can be helpful.

config.txt: https://filebin.net/rnyi5hu0ws6butm0/config.txt?t=xtz6kc94

acc-power_supply-OnePlus6T.log: https://filebin.net/rnyi5hu0ws6butm0/acc-power_supply-OnePlus6T.log?t=bb3lpzh4
[Magisk] VR25:
I assume you don't have acc-daemon* logs, since it hasn't been running lately.

The issue is, daemon isn't starting.

Does it work when you execute sh /sbin/.magisk/img/acc/accd and leave the terminal running in the background?

Have you tested whether acc -d and acc -e disable and enable charging, respectively?
[Magisk] ricardofago:
Yea, no daemon logs, just that one I mentioned. When I run through sh and keep the process running it still charges beyond the config (tried from 85% to 92%). If I open a new session and try acc -D it still says daemon not running. acc -d and acc -e do disable and enable charging properly.
[Magisk] YongJeah:
Hi, I'm one of acc user.

I wonder if it is possible to manually charge the phone even if it is paused . For example, I set 70-80 for resume-pause, now my battery level is 72, can I force charge it manually? And how ?
[Magisk] ricardofago:
Try

su
acc -e

from a terminal.
[Magisk] heithered:
Does anyone have the previous release? Since i can't install the latest one i want to try installing the previous one but couldnt find it.
[Magisk] guest4711:
Have a look into post#3. There is an archive of older versions: https://xdaforums.com/apps/magisk/module-magic-charging-switch-cs-v2017-9-t3668427/post73676133
[Magisk] heithered:
Yeah but they are way older releases back when the module was called mcs. I need(want :p ) the acc version just before the latest update. I looked to the archive post and github before posting.

Edit: Latest release in the archive working like a charm.
[Magisk] YongJeah:
Thanks , I read the hole OP and found this terminal command too. But it would be greater if there is a more simple way to do this
[Magisk] VR25:
An update is coming to address "stuck on Generating acc-power_supply..." and other issues.

Let's try the following:

1) cd /sbin/.magisk/img/acc

2) sh -n accd

3) sh -v accd

4) sh -x accd

Commands 2-4 will show us at which line the daemon crashes and why.
[Magisk] Da-BOSS:
My signature :)
[Magisk] ricardofago:
That did the trick. sh -n accd showed no output. sh -v accd displayed the entire script. sh -x accd highlighted it was looping while waiting for data to be decrypted (checking for /media/0/Android), while my path was lowercase /media/0/android (I wipe everything when updating so one of OOS versions probably recreated it that way and acc stopped working since then). Fixed it by renaming the folder itself. Upon reboot, I got the daemon log, acc -D shows it's running and charging control works as expected. Thank you very much!
[Magisk] VR25:
You're welcome.

Who would have thought! :p

Other users may have the same issue.

I wonder if encrypted folders are displayed as regular files... ?

If that's the case, instead of checking whether /data/media/0/Android exists, we could check whether there are any folders in /data/media/0.

Test script: /data/adb/post-fs-data.d/testdir.sh (755 permissions)

#!/system/bin/sh

ls -Al /data/media/0 >/data/adb/testdir.log

# self-remove
rm $0

exit 0
[Magisk] Ixioon:
:confused: nobody had the same issue than me ?
[Magisk] ricardofago:
Folders are encrypted so that their names are scrambled but remain as folders, files are encrypted as files (checked with ls -FAlR on TWRP without decrypting).
[Magisk] paolocorpo:
[MENTION=5228676]VR25[/MENTION]

I recently purchased a new smartwatch (Ticwatch Pro) with Android Wear OS 2.2

What your idea and experience about the possibility to use your module acc on this device ??

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] ricardofago:
I don't know much about Android, but couldn't it be

while [[ ! ( -e "/media/0/android" || -e "/media/0/Android" ) ]]; do sleep 10; done

so it sleeps until either the lowercase or the uppercase one is available?
[Magisk] VR25:
Tell me about the root solutions for Wear OS 2.2.

[MENTION=3137143]ricardofago[/MENTION], yes, that works. A simpler solution is...

until [ -d /data/media/0/?ndroid ]; do sleep 10; done
[Magisk] paolocorpo:
The procedure is always the same

Activate developer options

USB debug

Unlock bootloader

Install TWRP

Install Magisk