yashsingh1/xdaforums huggingface dataset:
[Magisk] VR25:
Battery status “Unknown” seems to be the issue. ACC expects "Charging", "Discharging" or "Not charging". I'll check the logs. Meanwhile, install today's build, and see if acc --set batt_status_override=Discharging makes any difference.

There have been reports of acc working on the Pixel 3a.
[Magisk] KemikalElite:
Just installed 6.19 and tried the command. Shows "possibly incompatible" in ACC Settings. Still says Unknown in android settings.
[Magisk] downhere:
Thank you for your response.

Switched to 2022.6.9-dev version.

I set the charging switch to Automatic as I was curious if wired and wireless charging will work (Oneplus 9). So far it looks good for me.
[Magisk] VR25:
You can ignore this message. It just means that's not the acc build which comes with this version of AccSettings.

Do you confirm that status "Unknown" always means "Discharging"?
[Magisk] habloid:
Hi all, I have Jiayu s3 (MTK6752) and last version of ACC. I tried to test switches by "acc -t" and I take

s3_h560:/data/data/com.termux/files/home # acc -t

This may take a while... ⏳
Ensure the charger is plugged 🔌
curr=null,0 off=false status=Cmd discharging
/sbin/acc[649]: [: discharging: unexpected operator/operand
/sbin/acc[649]: [: discharging: unexpected operator/operand
/sbin/acc[649]: [: discharging: unexpected operator/operand
/sbin/acc[649]: [: discharging: unexpected operator/operand
/sbin/acc[649]: [: discharging: unexpected operator/operand
/sbin/acc[649]: [: discharging: unexpected operator/operand

Please, help me to take normal answer for "acc -t".
[Magisk] VR25:
**v2022.6.21-dev (202206210)** (PRE-RELEASE)

* 8fc9e92 Update strings

* 5b791e6 Add re-plug notice

* 6884e69 If flip=on, wait for charging to resume

* d22ac4b Update discharge_polarity description

* 637ca4a Fix read_status()

* f8a04d9 Fix AccA idle mode support detection

* 624487c Assume battery is "Discharging" if charging status is unknown/weird

* 20e20c9 Fix: charging can't be enabled, if it was disabled above pause_capacity
[Magisk] habloid:
@VR25 I have Jiayu S3 with MTK7652 and my work charger is /proc/mtk_battery_cmd/current_cmd 0::0 0::1

Last release ACC, where this charger detect automatically was **v2021.9.5 (202109050)** further nothing automatically only hands. I put log of release, where initially doesn't have detect my charger. It is **v2021.9.19 (202109190)**. But if I take forced switch /proc/mtk_battery_cmd/current_cmd 0::0 0::1 in this release all works goods.

Last release where works forced taking switch is **v2022.1.8 (202201080)**. Log is attached. And log of next release **v2022.2.3 (202202030)** where it does not work too attached.

I also attached the log of the latest release v2022.6.21-dev_202206210_0715, where nothing works.

I hope this helps make your script better.
[Magisk] VR25:
**v2022.6.25-dev (202206250)** (PRE-RELEASE)

* 6e3ad43 Optimize memory usage

* de4150c (origin/dev, origin/HEAD) Rewrite discharge polarity handling logic

* 348e707 Miscellaneous optimizations

* cf2de3b Remember auto-detected discharge polarity until accd is reinitialized

* 660132b Fix language selector

* 7a38b5e Prevent unwanted switch blacklisting

* ec3b204 Remove re-plug notice

* ad922cd Fix: daemon stop timeout not honored

* cf368d3 Exclude additional misleading uevent information

* 942c251 Show battery health % and power supply info (if interfaces are available)

* e8171ba Determine discharge polarity only when the battery is actually discharging

* a725111 Re-enable daemon stop timeout (10 seconds)

* 3a9aeaa Add Zelle donation info

* b768746 Fix switch filter

* bf13dfa Add new charging switches

* 92687bb Fix: misleading "Idle" status

* d2db8e3 acc -p: filter out additional files

* 863e5b1 Fix --parse (acc -p) crash

* 1db225b Fix voltage based idle mode inconsistencies

* 88855fd Disable verbose for -l|--log

* 61961b2 Fix typo
[Magisk] habloid:
@VR25 I had time to test the behavior of different versions of your script in more detail on my Jiayu S3. And I can say that my last message was not entirely accurate.

Still my only working charger is /proc/mtk_battery_cmd/current_cmd 0::0 0::1 I force it with acc -s charging_switch="/proc/mtk_battery_cmd/current_cmd 0::0 0::1 --" And it works in full functionality (resume_capacity=70 pause_capacity=75) only up to script version v2021.9.5. In v2021.9.19, only charging occurs, which does not stop when "pause_capacity" is reached. This happens up to version v2022.1.8 inclusive.

On the latest v2022.6.25-dev my charger doesn't work at all.

I understand that my phone is already old and it does not make sense to spend energy on supporting its version 3 kernel, but maybe this will somehow help in eliminating script errors.

I am attaching the logs of all versions below.
[Magisk] VR25:
Perhaps your device needs a longer delay to disable/enable charging. Try:

seqOff=30 acc -t /proc/mtk_battery_cmd/current_cmd 0::0 0::1

The default seqOff is 16.

Along with that (or separately), see also whether acc --set batt_status_workaround=false makes any difference. This disables current-aware charging status detection, which effectively makes acc work in legacy mode.
[Magisk] habloid:
I tried this and got nothing on the latest release and v2021.9.19 but on the v2021.9.5 work perfecrly.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.
[Magisk] VR25:
Let's focus on the latest version only, for now.

seqOff is only relevant on this month's versions anyway.

1. Plug the charger

2. Stop the daemon

3. Unplug the charger

4. Run sleep 5; acc -s bsw=false; accd -i; sleep 5

5. Run acc -t; acc -le

6. Share /sdcard/Download/acc-logs-*.tgz.
[Magisk] habloid:
@VR25 I did. Here are the logs.
[Magisk] VR25:
**v2022.6.28-dev (202206280)** (PRE-RELEASE)

* 18c08c4 Improve emulated idle mode feedback (info)

* 84b82de Fix typos

* e9188ae Auto-set discharge_polarity

* 8eba418 Fix acc-p.txt generation

* fda19e8 Improve battery status detection

Tested on two very different devices:

- Lenovorola Moto Z Play

- Nokia 2.2

I encountered major issues. Initially, acc worked only on the first device (but intermittently). Now it's working well on both.
[Magisk] habloid:
@VR25 OK, now it successfully detect wright charger automatically, but still don't charged. Permanently discharging. Permanent discharge code break occurred between releases **v2021.9.5 (202109050)** and **v2021.9.19 (202109190)**. Log of the last version there.

Spoiler content hidden.
[Magisk] VR25:
I'd like to see the logs generated by acc -t as well (stored in your Download folder after running it). Let's just focus on this particular log file, for now.
[Magisk] habloid:
@VR25, done.
[Magisk] VR25:
acc-t_output-s3_h560.log
[Magisk] habloid:
@VR25 I can't get acc-t_output-s3_h560.log. Do I understand correctly that I should run acc -t and wait for the process to complete. But the process does not end and I see endless

switch:on status:Discharging curr:null,17000

I waited 20 minutes and finally pressed ctrl+c. Nothing appears in the Downloads folder.

Here's what I got in the terminal is in the attached file.
[Magisk] VR25:
Does your current always fluctuate that way?

Anyway, see if acc -t works with the attached build. Test after acc -s bsw=true (default) and acc -s bsw=false.
[Magisk] habloid:
@VR25 If you leave the phone alone, then according to the readings of the Ampere application, the current really ranges from 0 to 50mA. If you charge the phone from the charger up to 80%, the current will be 700-800mA, after which it drops to 500mA.

I tested this build after applying the specified options and the result is still the same - acc -t does not want to terminate on its own. Accordingly, there is no log either.
[Magisk] habloid:
@VR25 I noticed a difference in the calculation of battery percentages in a working release and non-working ones. On a working release, 75% is already 4.3V and the battery is still taking charge current, i.e. Apparently, the charge percentages are calculated by the amount of energy taken. And on non-working releases, 75% is 4V, i.e. Charge percentages are calculated based on the battery voltage. This is just an observation.
[Magisk] KemikalElite:
I have a Pixel 3 now. I loaded LineageOS 19.1 and installed everything else on it and ACC still doesn't work as expected.

I have the default setting to pause charging at 80%

It is currently showing 94% and keeps switching between Discharging, Idle, and Full.

Every few minutes the phone will play the charging sound, then it goes back to discharging.

I was able to get it actually discharging with the charger connected and the battery percent decreasing one time, but then after i restarted the daemon to make sure, now it says discharging in acc settings but it shows charging in android and the battery percent is back up to 100%.

I see:

/sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/rerun_aicl 0 1
curr=212812,-197500 off=true status=Discharging
curr=212812,-197500 off=false status=Discharging
curr=212812,-197500 off=false status=Discharging
curr=212812,-197500 off=false status=Discharging
curr=212812,-197500 off=false status=Discharging
curr=212812,-182812 off=false status=Full
Switch works ✅
idleMode=false

So I tried both of the Qualcomm switches and it still doesnt stop at the set percentage.

accd v2022.6.12-dev (202206120)

2022.6.13-pre ACC settings

Magisk 25.1

Battery Service
AC powered: true
USB powered: false
Wireless powered: false
Max charging current: 1500000
Max charging voltage: 5000000
Charge counter: 2221000
status: 2
health: 2
present: true
level: 93
scale: 100
voltage: 4394
temperature: 223
technology: Li-ion

Uevent
BATTERY_TYPE=b1-68k
CAPACITY=93
CAPACITY=93
CAPACITY_RAW=241
CC_STEP=0
CC_STEP_SEL=0
CHARGE_COUNTER=2222000
CHARGE_COUNTER=2660260
CHARGE_COUNTER_SHADOW=2687720
CHARGE_FULL=2330000
CHARGE_FULL=2982000
CHARGE_FULL_DESIGN=2944000
CHARGE_FULL_DESIGN=2982000
CHARGE_NOW=0
CHARGE_NOW_RAW=2494497
CONSTANT_CHARGE_VOLTAGE=4389655
CURRENT_AVG=-347187
CURRENT_NOW=-342812
CURRENT_NOW=-361327
CYCLE_COUNT=1284
CYCLE_COUNT=927
DEBUG_BATTERY=0
HEALTH=Good
NAME=bms
NAME=maxfg
PRESENT=1
RESISTANCE=348877
RESISTANCE=399169
RESISTANCE_ID=67000
SERIAL_NUMBER=00048D20181215SWPRWSYAB1
SOC_REPORTING_READY=1
STATUS=Discharging
TECHNOLOGY=Li-ion
TEMP=223
TEMP=238
TEMP_COLD=0
TEMP_COOL=0
TEMP_HOT=550
TEMP_WARM=550
TIME_TO_EMPTY_AVG=-6
TIME_TO_EMPTY_AVG=78231
TIME_TO_FULL_AVG=229
TIME_TO_FULL_AVG=911
VOLTAGE_AVG=4392343
VOLTAGE_MAX_DESIGN=4400000
VOLTAGE_MIN_DESIGN=2960000
VOLTAGE_NOW=4389881
VOLTAGE_NOW=4394687
VOLTAGE_OCV=4253906
VOLTAGE_OCV=4259772

CURRENT_NOW=-0.34 Amps
VOLTAGE_NOW=43898811.00 Volts
POWER_NOW=-14925600.00 Watts
[Magisk] VR25:
v2022.7.4-dev (PRE-RELEASE)​

24dcfd7 Update translation info

3b882c1 Merge pull request #156 from Babilinx/dev (French translations)

d0b8b42 Merge pull request #160 from cutiness/dev (Turkish translations)

744911d Report status "Idle" as "Not charging" to "fix" AccA

36266da Update readme

873128e Implement current limiting hack (temp_level)

3a72767 Optimize charging control loop

bc46b40 Optimize forceOff

8bada33 Half batt status poll rate

426e749 Check config (reset if broken/missing) before loading it

50e19b6 Disable seqDrop timeout

f270ad7 Update config reference

21f68d1 Implement forceOff: for keeping stubborn switches off

e2edbf7 Add new wireless charging switch

45cd831 Make less invasive ctrl file permission changes

fb5cc27 Make each ctrl file read-only after writing to it

9f4a5c5 Improve "unplugged" detection

19fb9e0 Rename BATT_HEALTH -> HEALTH

eb0014e Fix: chargingSwitch[@], parameter not set

# force_off (fo) #

# Repeatedly call "flip_sw off" after disabling charging, until enable_charging is called.

# This is needed when the set charging switch is stubbornly reset by the system.

# The value (integer == enabled, null == disabled) dictates the number of seconds to wait between "flip_sw off" calls. While decimals are supported, anything less than 1 is overkill. Probably the optimal value is somewhere between 2 and 5.

# temp_level (tl) #

# This is a current limiting hack.

# Some devices have adjustable "temperature levels". At the highest level, charging current is blocked.

# The stock values are generally integers, ranging from 0 to 6, 7 or slightly more.

# For greater flexibility, this variable stores a percentage value -- which is internally converted to the system's scales.

Happy 4th of July, BTW!
[Magisk] habloid:
@VR25 Unfortunately, this version of the script does not work on my phone either. I continue to stay on version 2021.9.5 as the latest working version. I do not want to be annoying, but I would like to see the functionality that worked before in the latest versions of the script. acc -t still lasts indefinitely due to the constant mode of discharging the phone.
[Magisk] wilberfan:
Can we manually download today's (11.24) update from somewhere? The 11.19 is definitely not working properly for me. Shouldn't it be at the top of this thread?
[Magisk] psychoela:
btw module 19-2 is working perfect.
[Magisk] wilberfan:
Today's update still isn't halting charging for me. (Was set to stop at 70%.)

[Edit] 11.06 version IS working, though.
[Magisk] ntantinan:
Sony XZ Premium Not Supported

My Sony XZ premium (G8142) is not supported.

I attached the debug zip and appreciate any support that I can get. Would love to use charging switch.
[Magisk] VR25:
Found the culprit! Build 2017.11.24-1 will be up soon.

Thanks for pointing that out. Currently reviewing the commits.

Will take a look.
[Magisk] wilberfan:
For whatever reason, # cs 80 30 debug doesn't write anything to /sdcard for me. I'll bet I'm not doing something I should?
[Magisk] VR25:
# 2017.11.24-1 (201711241)

- Additional devices support

- Fixed `cs -d/-e` not working.

- Fixed `cs` & `cs % %` misreporting cs service as `running` even when it's paused.

- General optimizations

[MENTION=3442866]wilberfan[/MENTION], it's just "cs debug", not "cs 80 30 debug". If the latest build still fails to work properly for you, open /data/media/cs/cache, replace the text "charging_enabled" with "battery_charging_enabled", test again and report back. -- Thanks

Edit:

# 2017.11.24-2 (201711242)

- Decreased discharging timeout values for better charging control accuracy

- Fixed `cs -k` higher % loop

- Misc optimizations
[Magisk] wilberfan:
Flashed 24-1 update, rebooted. Ran # cs 80 45, then # reboot. Plugged-in charger, went past 80%. Made edit to cache file, rebooted, plugged-in charger. Still went past 80%. Tried again with 85 45 without a reboot. Still not halting the charge. Will try and send you a debug later today.

[edit] Tried again. Left terminal window open, still going past charging limit I set (80%). Here's the debug.
[Magisk] samteeee:
That did the job, thanks bro.
[Magisk] psychoela:
tested 24-2 all command is perfect! tyvm dev:victory:
[Magisk] iluvatrix:
Did you have to keep terminal window running in the background?
[Magisk] psychoela:
No
[Magisk] wilberfan:
Dammit. 24-2 still going past 80% for me.
[Magisk] VR25:
See if the following helps:

1. Run cs -c

2. Paste this directly on terminal: /sys/devices/soc/qpnp-smbcharger-17/power_supply/battery/charging_enabled 1 0

3. Hit ENTER twice
[Magisk] wilberfan:
Nope. Still went past (81% this time). Recall that the 11.06 version worked properly for me.
[Magisk] VR25:
The major difference between that version and the latest is cs service. The latter has it, whereas the first doesn't.

So, what happens when you run cs with service disabled (cs -a && cs)?

Also, check whether the file /sys/class/power_supply/battery/charging_enabled changes whenever you run "cs -d" or "cs -e".
[Magisk] mrmcshagbag:
First version I tried and went past 90% for me. I didn't configure anything. Just install and forget. Wanted a fail safe in case I forget to unplug my phone ☺️
[Magisk] VR25:
# 2017.11.25 (201711250)

- Fixed cs service exiting instead of applying default settings on first run

- Minor optimizations

- Updated service add-on info

You're good to go now. ;)
[Magisk] wilberfan:
Neither -e nor -d changed the content of charging_enabled (1), (or battery_charging_enabled) (0).
[Magisk] Droid_JD:
Once my phone reaches the desired level, the whole system gets incredibly laggy. Does this happen to anyone else?

Currently running 8.1 preview on Pixel XL. But it did the same thing on Stock 8.0.
[Magisk] VR25:
Not being annoying at all. I want acc to run on as many devices as possible. Since things are not perfect in the real world, some weirdness still applies. While it's now working on more systems, it stopped working on some (a rather fun mouse catching game).

Try with acc -s bsw=false.
[Magisk] habloid:
@VR25 No visible changes. I look forward to future builds.

Spoiler content hidden.
[Magisk] Spaceoid:
Sometimes, extremely rarely, my phone screen will just switch on during charging. Might this be due to a faulty hardware connection or does it have to do with ACC?

I am kinda sure it has nothing to do with cooldown, because last time it happened this morning, the phone was at 58% and cooldown only starts at 60.

No issue in it's core though, I am just asking out of interest.

Edit: I also pulled some logs from the ACC menu, maybe they are of any help. I myself had trouble understanding them.

Edit2: Happened twice today already, one time a few mins after plugging in the charger. Charging stops for a sec, phone thinks it got unplugged, then charging continues again. Might also be that my phone just needs a reboot or sth.
[Magisk] scottlam1:
Is there a setting in acca or a command for acc that allows you to keep otg on. When I plug in my hub for SD or ext hdd with acc enabled it kills the connections.
[Magisk] SpeedOxide:
Hi !

I have just registered on XDA to thanks you @VR25 !

It's been a while I look for an app like this.

It's work very well if I plug the charger, but it doesn't work if I use my wireless charger.

My phone: Xiaomi Mi 9

Thank you very much for your work !
[Magisk] VanGray:
v2022.7.10-dev (202207100)

* 4240644 Add voltage support to -e and -d options

* 5a63ada Fix offMid

* fee795b Each ctrl file gets written to 2x

* 6c6badb Optimize force_off

* 4a26458 Bump charging status check timeout
[Magisk] Soul drinker:
Hey i am using rooted redmi note 10 pro and ASOP based rom Project elixir(v1. 9). I had installed latest firmware for my region. But i am not getting fast charging on my device which used to be 33W now its capping @12w max! I tried out battery calibration but still it's not working. Can i use this app or magisk module to get back the phones fast charging.

Kernel: latest vantom

Os: 12L
[Magisk] VR25:
Did you try the latest (7.10) pre-release?

@habloid
[Magisk] VR25:
No, this is associated to a charging switch. It can only be fixed with a kernel patch. Try a different switch.
[Magisk] VR25:
Same issue as that from the previous post.

You're welcome!
[Magisk] VR25:
This could be related to buggy thermal management.

The following script creates and installs a Magisk module that disables all userspace thermal control programs. If a bootloop happens, the module disables itself. Still, use at your own risk. Paste and run on terminal (as root) to install. Reboot afterwards.

(dir=/data/adb/modules/vr25.fry/system
rm -rf ${dir%/*} 2>/dev/null
mkdir -p $dir
for i in $(pgrep -fl thermal | cut -d ' ' -f 2 | grep -v qti); do
j=$i
i=$dir${i#/system}i
mkdir -p ${i%/*}
touch $i
magisk --clone-attr $j $i
done
echo '#!/system/bin/sh
(touch ${0%/*}/disable
while [ .$(getprop sys.boot_completed) != .1 ] && [ ! -d /sdcard/Android ]; do
sleep 5
done
sleep 60
rm ${0%/*}/disable $0
exit &) &' > ${dir%/*}/post-fs-data.sh)
[Magisk] Spaceoid:
I installed the pre-release now and will report.

One thing I noticed though is that my charging cooldown cycle seems to be buggy with the pre-release again. The charging part of the cycle never takes longer than a few secs, while it is set for 50 seconds.
[Magisk] habloid:
@VR25 Thanks for the question. Yes, I have tried this version. I can say that nothing has changed. All the same constant discharge. The charger that works 2021.9.5 does not work here.
[Magisk] VR25:
**v2022.7.19-dev (202207190)**

* Bump version

* 423fadb Misc charging control fixes and optimizations

* d74a647 Systemlessly disable mi_thermald

* deb4736 Add support for cooldown_charge=0 (to be used with cooldown_current)

* 6286223 Update documentation

* ded8b86 Rewrite script scheduler

* 950709b Update BATT_HEATH calculator

* e778686 Goodbye loopCmd (replaced by one-line scripts)

* e5110f4 Improve force_off

This can be installed by acc -u dev (-f is not needed).

AccSettings fix:

echo "echo loop_cmd=" >> /data/adb/modules/acc/print-config.sh
[Magisk] Soul drinker:
I installed this in termux and the module got installed .but after restarting the device the module was switched off I think a boot loop occured and automatically turned off .so what should I do.
[Magisk] Spaceoid:
The latest dev version again has problems with the cooldown cycle on my OnePlus 6. Instead of respecting the 50/10 seconds ratio, the phone will only charge for two or three seconds, then interrupt charging again for a few seconds.

Maybe it is also a mistake on my end. Cooldown cycle works well on latest stable release, though, while being bugged again on a release before that one.
[Magisk] Doomkopf:
@VR25 Hey! I have a little trouble getting ACC setup, can I annoy you with it? xD

I realized having the chargingSwitch unset doesn't work for me, so I ran acc -t and tried all those switches manually by selecting it (with " --" at the end) and trying acc -d/acc-e to see what switch would actually disable charging for me. Then I found one ("battery/input_suspend 0 1 --") and set it. But when reaching the pause_capacity. It still continues charging. What did I do wrong? What could I try/check? Another switch? But this one worked when testing it, so it should theoretically be a correct one, right?

And another question, is it possible/did someone else ever report, that charging got hotter more easily after installing this? I'm not 100% positive on this, but I feel like my phone gets hotter more quickly since I installed this module. Could be the weather tho.

EDIT: I have a POCO F3 and I'm on LineageOS 19.1
[Magisk] hamidv2:
Does anyone know the charging switch for the Redmi Note 11 Global version ?

Thanks

P.S : I've alread tried /sys/class/qcom-battery/input_suspend but it doesn't work for me
[Magisk] Manoj8001:
Working on oneplus 6 evo X rom A12.1. Using the AccA front end app with default module that comes with it. No issues.
[Magisk] david003:
Also using AccA with the bundled version of ACC (which is older, v2021.8.31), with a Xiaomi Note 10 pro. It's been working fine for a long time, with Xiaomi.eu firmware (currently at 13.0.8.0). It charges up to 80% and stops.
[Magisk] tuan94_bg:
i am using xperia 5ii. i changed my phone battery to 4500mAh. can anyone tell me how to fix these values, i can't fix it directly. thank
[Magisk] panni:
@VR25 v2022.7.30-dev is working great here on the Nothing phone 1. Using battery/charge_control_limit 0 battery/charge_control_limit_max and forceOff. This even works with Qi charging, not only USB. Before forceOff some internal thermal management service turned the switch on again after some time.

The only thing I've noticed: The resume percentage isn't terribly accurate. I have it at 75, and yesterday it started charging even when it was a 76% battery.

Thanks for this great tool, been using it for years.
[Magisk] Zaxx32:
Got a new Pixel 6a...using AccA app but charging doesn't stop at 90% as it should and only ever makes it to 2.5A. What switch does the P6a use or should I jeave it on 'auto'. And yes, I gotta use AccA cuz I've no how to use ACC directly...lol So go easy on me guys...plz
[Magisk] sadaghiani:
plz help4 setting
[Magisk] MrMojo93:
Hello,

I have a OnePlus Nord which was recently updated to Android 12. Since than ACC doesn't work. Even though I set the limit at 80%, the phone charges up to a 100% every night.

I'm using the latest dev version. I'll attach the logs. Thanks very much for your help!

Marton