• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Question Managing battery charge

Search This thread

CapnRene

Member
Sep 20, 2021
13
4
OnePlus Nord 2 5G
Hello!
My Nord 2 will be plugged in 24/7 because I use it for E2E testing. I need to optimize battery so it wont swell up.
Is there any working solutions for doing it? Or is there a way to put battery charging to idle so main power will be drawn from usb.
I tried Magisk ACC plugin, but it seems it is not running. Shell has supperuser power on magisk
ADB shell:
"acc
/system/bin/sh: <stdin>[2]: acc: inaccessible or not found
accd,
/system/bin/sh: <stdin>[3]: accd,: inaccessible or not found"

Also same error in ACC app, magisk have given supperuser access for that app:
"/system/bin/sh: <stdin>[3544]: acc: inaccessible or not found"
 
Last edited:

CapnRene

Member
Sep 20, 2021
13
4
OnePlus Nord 2 5G
when i execut acc.sh in /data/adb/vr25/acc/ folder then i cant get ACCD running there. Well it runs for a minut then turns off
"

Advanced Charging Controller v2021.8.31 (202108310)
Copyright 2017-2021, VR25
GPLv3+

(i) accd is not running

1) Language
2) All commands
3) Documentation
4) Start/restart daemon
5) Stop daemon
6) Export logs
7) Charge once to #%
8) Uninstall
9) Edit config.txt
a) Reset battery stats
b) Test charging switches
c) Check for update
d) Flash zips
e) Battery info
f) Exit

#? b


(!) Charger must be plugged to continue...
(i) Alright, this may take a minute or so...

(!) [/proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0] won't work

(i) Press any key to continue..."
 

VR25

Senior Member
Apr 20, 2013
1,783
4,441
github.com
Hi, I'm the developer of acc.
Have you tried a slow charger or USB charging?
Refer to README > Troubleshooting.
This is a kernel/adapter issue.

Edit
Just noticed that you're not using the latest acc release.
Since you're facing issues, upgrading is a must.
Regardless, don't skip the documentation.
 
Last edited:
  • Like
Reactions: duttyend

CapnRene

Member
Sep 20, 2021
13
4
OnePlus Nord 2 5G
I am using PC USB connection for charging. Should ACC daemon allways run? It works for a minute and then stop. Do you mean oneplus nord 2 battery charging management have same kernel issue as you mentioned in ACC thread?

I have tested different versions to be sure. v2021.8.31 came from Magisk for first.
AccA is latest 1.0.35 Daemon/API 202109200

New ver.:
Advanced Charging Controller v2021.9.20 (202109200)
Copyright 2017-2021, VR25
GPLv3+

(i) accd is not running (PID 12046)

1) Language
2) All commands
3) Documentation
4) Start/restart daemon
5) Stop daemon
6) Export logs
7) Charge once to #%
8) Uninstall
9) Edit config.txt
a) Reset battery stats
b) Test charging switches
c) Check for update
d) Flash zips
e) Battery info
f) Undo upgrade
g) Exit

#? b


(!) Charger must be plugged to continue...
(i) Alright, this may take a minute or so...

(!) [/proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0] won't work
 
  • Like
Reactions: duttyend

VR25

Senior Member
Apr 20, 2013
1,783
4,441
github.com
This is usually a kernel and/or power adapter issue.

The daemon should be running to control charging.
The #1 reason for it to stop is total charging switch failure.
That is, all charging switches fail to respond.
In that case, it finds no reason to keep running.

Share a log archive (acc -le) and the output of acc -p.
 

CapnRene

Member
Sep 20, 2021
13
4
OnePlus Nord 2 5G
Where can i get those logs? From /data/adb/vr25/acc-data/logs/ ? Might it be acc-logs-OP515BL1.tar.gz file?
Somehow "pull" and "cp" are not working on me with adb shell. Is there any better tools for pulling files and logs? There is many tools witch are not working with my phones and cant find root folders, google is to big.
 

VR25

Senior Member
Apr 20, 2013
1,783
4,441
github.com
@VR25 Hi! I attached all logs from ACC-data logs folder. Will it help?
Perfect!
I found potential charging switches.

Test the following commands one by one and report the ones that work:

su -c acc -t /sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0

su -c acc -t /sys/devices/platform/charger/enable_sc 0 1

su -c acc -t /sys/devices/platform/charger/enable_sc 1 0

su -c acc -t /sys/devices/virtual/oplus_chg/battery/stop_charging_enable 0 1

su -c acc -t /sys/firmware/devicetree/base/charger/usb_charger_current_suspend 0 1

Note
One/some of the commands may trigger a reboot.
That's not a big deal. Just move to the next on the list.
 

CapnRene

Member
Sep 20, 2021
13
4
OnePlus Nord 2 5G
First line got response:

OP515BL1:/ # su -c acc -t /sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0

(!) Charger must be plugged to continue...
(i) Alright, this may take a minute or so...

(i) [/sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0] works
- battIdleMode=true

As i understand i need to change switch now to get it working?
 
Last edited:

VR25

Senior Member
Apr 20, 2013
1,783
4,441
github.com
su -c acc -s s="/sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0"

You should be all set after running that.
The next release will include the new switch.

Edit
Since the device will be plugged in 24/7, you may want to run `acc 3920` to set it up.
Essentially, this will keep the battery voltage between 3870-3920 millivolts.
3920 is said to be the sweet spot for longevity.
 

CapnRene

Member
Sep 20, 2021
13
4
OnePlus Nord 2 5G
Not 100% sure did it work, need to test it a litte to be sure. It seems it updated log

OP515BL1:/ # su -c acc -s s="/sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0"

/system/bin/acc[580]: export: 1: is not an identifier

(i) Alright, this may take a minute or so...
(i) /data/adb/vr25/acc-data/logs/acc-logs-OP515BL1.tar.gz
 

Attachments

  • acc-logs-OP515BL1.tar.gz
    303.4 KB · Views: 0

VR25

Senior Member
Apr 20, 2013
1,783
4,441
github.com
It worked! Ty! I set my swich to turn on 59% and off 60% for optimal ressult.

It seems that those are not working or maybe i have made some mistake somewhere:
shutdown capacity
charge current
charge voltage
From the documentation:

# shutdown_capacity (sc) #
# When the battery is discharging and its capacity/voltage_now_millivolts <= sc and phone has been running for 15 minutes or more, acc daemon turns the phone off to reduce the discharge rate and protect the battery from potential damage induced by voltage below the operating range.
# sc=-1 disables it.
# [Beta] if the file /data/adb/vr25/acc-data/warn exists, accd posts Android shutdown warning notifications at sc + 5% or sc + 200 mV.


The last two features are not supported by all devices.
I'm yet to see a MediaTek device that supports at least one of the those.

Please ask further questions in the actual forum, so that other users can help you whenever I'm unavailable.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hi, I'm the developer of acc.
    Have you tried a slow charger or USB charging?
    Refer to README > Troubleshooting.
    This is a kernel/adapter issue.

    Edit
    Just noticed that you're not using the latest acc release.
    Since you're facing issues, upgrading is a must.
    Regardless, don't skip the documentation.
    1
    I am using PC USB connection for charging. Should ACC daemon allways run? It works for a minute and then stop. Do you mean oneplus nord 2 battery charging management have same kernel issue as you mentioned in ACC thread?

    I have tested different versions to be sure. v2021.8.31 came from Magisk for first.
    AccA is latest 1.0.35 Daemon/API 202109200

    New ver.:
    Advanced Charging Controller v2021.9.20 (202109200)
    Copyright 2017-2021, VR25
    GPLv3+

    (i) accd is not running (PID 12046)

    1) Language
    2) All commands
    3) Documentation
    4) Start/restart daemon
    5) Stop daemon
    6) Export logs
    7) Charge once to #%
    8) Uninstall
    9) Edit config.txt
    a) Reset battery stats
    b) Test charging switches
    c) Check for update
    d) Flash zips
    e) Battery info
    f) Undo upgrade
    g) Exit

    #? b


    (!) Charger must be plugged to continue...
    (i) Alright, this may take a minute or so...

    (!) [/proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0] won't work