yashsingh1/xdaforums huggingface dataset:
[Magisk] Uluru25:
Some experiences of mcv (max. charging voltage) controlled chargings

There was some uncertainty of the "effects" of mcv-limitations on the charging process elsewhere so that I want to share my practical knowledge with interested users.

All what I am reporting here relates to experiments with a Redmi Note 8T (willow) running LOS 18.1 and 4.14.190-perf+ kernel and ACC build 202406060.

It is well known that a mcv-value limits also the possible SoC (state of charge), but this doesn't follow a simple linear function. To check the maximum SoCs for different mcv values, I used a "sweep mcv" MacroDroid macro which started charging with a low mcv, waited until charging reached a kind of steady state (no further increase of SoC in a certain period of time), and then increased the mcv by 50 mV until again reaching a steady state, and so forth... If setting mcv to lower values than 3700, these values were automatically replaced by ACC to 3700. That's the reason why the sweep experiment starts at 3700 mV. Since the sweep started at a SoC of ~ 20% (I try to avoid deeper discharging of the battery for longevity reasons) charging started only when reaching 3800 mV. The below result of this sweep shows at which SoC a steady state was detected:

- at 90 % for mcv=4300 mV

- at 88 % for mcv=4250 mV

- at 83 % for mcv=4200 mV

- at 78 % for mcv=4150 mV

- at 73 % for mcv=4100 mV

- at 67 % for mcv=4050 mV

- at 62 % for mcv=4000 mV

- at 54 % for mcv=3950 mV

- at 42 % for mcv=3900 mV

- at 28 % for mcv=3850 mV

- at 22 % for mcv=3800 mV

Don't understand these values too strict: during real charging the resulting SoC for a certain mcv might be some percent higher since my sweep macro waited only for a few minutes of detecting no further charging while real chargings can add a few percentage e. g. after a longer time.

Some mcv-controlled real chargings were also done and stopped as follows:

- at 84 % for mcv=4200 mV

- at 74 % for mcv=4100 mV

- at 60 % for mcv=4000 mV

Hope this inspires you for your own ACC-settings!

🤠
[Magisk] re_endymion:
Hello everybody,

Has anyone succeeded in installing ACC module with APatch ?

At first install from the APatch APM tab, I had a failure because of the lack of su command.

I then install a busybox module but the tools are installed in /data/adb/busybox-ndk/system/bin, and I think that the scripts that install ACC won't search the tools in this location, and even if the ACC module succeed its installation, I can't call acc from termux command line.

Any help or suggestion will be appreciated.
[Magisk] sic0048:
I don't recall any special methods needed to install ACC with APatch. I do have the Zygist Next module installed as well, but that's really for LSPosed. I don't think ACC needs it, but just for full disclosure, I have it installed.....
[Magisk] xXHenlolXx:
Hey everyone.

I have a question on how ACC works. Currently I have a Xiaomi Mi Mix 3 (a 2018 device with a 3200 mah battery) that has the battery in a really bad state. I plan to switch to a Pixel in ~6 months when Im going to travel to Europe. Meanwhile Im trying to find ways to just extend the battery life, but I dont care about extending battery life as its already ****.

Can AAC help me? I read the documentation and the thing that seems useful is the idle mode. If it can help me, how should I configure it?

Also, about xiaomi devices and charging switches. I installed the module and tested it, but pause_capacity aint working (not that I want it to), but I need to change the charging switch. The thing is Im a little scared about the xiaomi bug, if its going to happen, is it going to happen immediately or can it happen at any time?

Thanks in advance.
[Magisk] Uluru25:
... when you have installed it, let it check the charging switches with su -c acc -t in a terminal. If at least one switch shows that it supports BattIdleMode then choose this switch with su -c acc -s s and as soon as the battery reaches your pause_capacity (standard is 75 % but you can edit it) idle mode (also known as bypass charging) will start.

Instead of terminal commands you can also do this with sAFE.

🤠
[Magisk] kenshinta:
Am using a Nokia 6.1 with crdroid kernelsu support. Installed v2023.10.16 (as it was the github latest) as a kernelsu module. Although installation as a module was ok it Didn't work.

Read through the issues and releases, found out that v2023.7.17 is the only release explicitly mentioned kernelsu support. Installed that and works fine.

Would the latest release on the telegram channel have proper kernelsu support?
[Magisk] Uluru25:
Sure. And if not, just rollback with acc -b

🤠
[Magisk] Hastaloego:
you either found free energy or wireless charging :D

CS doesnt work for me if i start charging outside the settings. i use "cs 80 50" start charging at 40%, it charges till 100%, didnt stop at 80%
[Magisk] VR25:
# 2017.12.11 (201712110)

- `cs -c` on steroids -- manually set control file config -- syntax: `cs -c /path/to/ctrl/file ON OFF`

- CS service ignitor no longer in zzz-cs-service directory

- Documentation available in /data/media/cs/info

- Enhanced debugging resources/tools -- `cs debug` & verbose logging (toggle: `cs -v`, default OFF)

- Fixed charging control not working in-between/outside set % limits

- Fixed lag/memory leak issues

- Full Magisk 14.5 support

- Massive reduction in RAM consumption

- New charging control & uevent files identication engine -- wider device compatibility & easier/faster debugging

- No more "garbage" generation

- Root check -- reminder to run cs as root

- Updated reference -- it's about time to befriend `cs -h`

**Release Comments/Notes**

- All data generated by previous CS versions will be wiped.

- [NEW FEATURE] cs has a `charging control files database` ($ModPath/config/ctrl_files_db) and it can be updated separately -- no rebooting necessary.

- Settings will be reverted to defaults (90 10).

- Unfortunately, a couple of devices (i.e., ASUS Zenfone 2, BLU R1 HD, TECNO L9 PLUS) have [very] odd/non-intuitive charging control files. I've been working on reverse engineering to figure out how to disable charging on such targets. I'm afraid a couple of these phones don't even support that feature. As long as cs development is up, I'll keep diving deeper into this, though.

--------------------------

Other/suggested features haven't been left behind. It's just a matter of following the hierarchy. That is, the most important gets added first.

Keep suggesting and cs will keep growing!
[Magisk] bombername:
Alert! ?

Unsupported device.

Device:

HTC 10 with Android 7.0
[Magisk] onliner:
OnePlus 5 (Paranoid Android): works perfectly.

Redmi Note 3 (Lineage OS): doesn't work, but previous versions works without problems.
[Magisk] guest4711:
[MENTION=5228676]VR25[/MENTION] Thx for the Update. On my Samsung Tab 2 -which is still unsupported- I get an error with latest version:

u0_a183@:/ $ su
root@:/ # cs -v

/system/xbin/cs[290]: syntax error: '(' unexpected
1|root@:/ # cs

/system/xbin/cs[290]: syntax error: '(' unexpected
1|root@:/ # cs -debug

/system/xbin/cs[290]: syntax error: '(' unexpected
1|root@:/ #
[Magisk] psychoela:
Debug zip from latest cs, could be help for developers,many thanks VR25
[Magisk] psychoela:
[MENTION=5228676]VR25[/MENTION],latest also not working properly here, charging not stop as value.thanks
[Magisk] Sagittarius199x:
My device Xperia Z5 can't debug

[IMG="Image"]https://i.imgur.com/JJnqaRj.png[/IMG]
[Magisk] x1reN:
It doesn't stop charging at the limit I set. cs 90 89 and I'm at 95% now.

Sent from my Samsung Galaxy S8
[Magisk] VR25:
So, what's happening, why/solution (what I'll do):

- Can't generate a debug zip (missing busybox/zip binary, built-in zip path not specified in cs)

- Charging not stopping for some (add entries to control files db, change ctrl files hierarchy)

- Misc issues (quick changes review)

A new version with more fixes will be up in a few hours.

- Indeed the new debugging tools speed things up.
[Magisk] Jaymin.0.1910:
[MENTION=5228676]VR25[/MENTION], this time, you gave me a new idea with your ctrl_file finding algorithms, my huge thanks to you, appreciated...:)

But, instead of a for loop with "sed 's/ /+/'"and "sed 's/+/ /'" inside, a while read loop over $sys_cache would be better to improve readability

Can I collaborate on CS development with you ?? You know, we both seek knowledge, like it so much, would be a good idea
[Magisk] novalis01:
Do I need to run a separate terminal everytime the device is restarted to change my settings to cs - k 80 or can I change this permanently so that Magisk would start the module with this setting by default?
[Magisk] Jaymin.0.1910:
CS service do not automate "-k" flag. That's why you see "cs service paused" message everytime you run cs with "-k" flag. Only [PAUSE%] and [RESUME%] are automated.

So, you need terminal for the job
[Magisk] novalis01:
So how can I change the min max levels permanently then?

If I change them by terminal they would be reset after a restart or not?
[Magisk] VR25:
# 2017.12.12 (201712120)

- Fixed charging not working properly after changing % limit values while CS service is running

- Fixed control file ID engine not parsing its database entirely (limited to "battery/charging_enabled" control file)

- Fixed missing built-in zip binary path

- Updated debugging tools

Always coming up with nice ideas, thanks. I've made the necessary changes accordingly. :)

Regarding the collaboration, you're welcome to join me. However, as I'm really bad keeping up with group demands in this kind of project, all we'll do is share ideas/code occasionally at best. Discussions will take place here on the forum, either via PM or public posts -- just like how we've been interacting lately, except a bit more dynamically.

Adding to MCMotherEffin''s words -- to make that change permanent and automatic, replace "cs service" (last line) with "cs -k 80" in /sbin/.core/img/cs/service.sh, and you're done. Note: don't remove the "&".

I've been thinking...

- What if CS service switched its operating mode at user-defined times -- from "pause resume" to "maintain"?

-- Say, during the day, it works the standard way (pause resume) and at night it switches to "cs -k" mode...

Once I get this well sorted out in my mind, I'll eventually make it happen.
[Magisk] onliner:
Latest version.
[Magisk] VR25:
Paste this on a root terminal, run and test cs again:

cs -c /sys/devices/soc.0/qpnp-smbcharger-16/power_supply/battery/charging_enabled
[Magisk] onliner:
It worked, thanks.
[Magisk] DuskGolem:
Probably just a typo, well what i know:laugh::laugh::laugh:

Just reporting this, I am using Xpetia Z5 Premium and latest version of your module.

Thanks for this brilliant project. Keep up the good work.

EDIT:

Two things I observed on my device

1) debug log is stored in /data/media/cs instead of /sdcard although it says /sdcard in terminal. I am unable to get debug log as the log file is empty

2) I'm getting the mentioned error (in screen shot) after every command.
[Magisk] x1reN:
Changed the settings to CS 86 85, now my battery is at 83% and it doesn't start charging again.
[Magisk] Sagittarius199x:
In lastest version, i can't debug

[IMG="image"]https://i.imgur.com/b8et75a.png[/IMG]
[Magisk] psychoela:
Charging still not stop with max limit:(. Thanks
[Magisk] iluvatrix:
Also not working on my Nexus 6 on official LOS 14.1. please help

Thanks
[Magisk] donny110:
Okay.. First started, my device is a op 3t running oreo beta rom oxygenos (latest beta at this time).. Installing as magisk module didn't work.. So i flashed from twrp.. Seemed to be so far so good.. However terminal gave cs not found.. So I used the search function im this thread and found a reply from OP that copying the files manually might work... Well I might have interpreted that wrong or it didn't work in this case.. See attached screenshot not sure if it even made a debug as the screenshot kind of denies it.

This might be a very stupid mistake, might be overlooking something.. Or might even be incompatibility, I simply don't know. Nougat used to work a month or 2 ago with this mos though (not alot to go on I know)..
[Magisk] VR25:
Everyone facing issues, try cs-2017.12.12-debug.zip from post #3 -- https://xdaforums.com/showpost.php?p=73676133&postcount=3

Below are extra instructions for some of you.

[MENTION=7217268]x1reN[/MENTION], paste this on your terminal, run, reboot and test cs again:

su -c sed -i s/store_mode/batt_slate_mode/ /data/media/cs/config

[MENTION=7389939]donny110[/MENTION], run touch /data/b as root before installing the aforementioned build and see how it goes.
[Magisk] donny110:
Okay, I did indeed miss something.. I had to apply the command in the twrp terminal and afterwards the debug version works!

Edit: it doesn't actually stop at the mentioned charge level.. I used cs 85 35.. However as the screenshot shows, it's currently at 87 and still charging..
[Magisk] guest4711:
Thank you for the update, but same syntax error with this new version for an (yet) unsupported device:

u0_a183@:/ $ su -c cs debug
/system/xbin/cs[309]: syntax error: '(' unexpected

u0_a183@:/ $ su -c cs
/system/xbin/cs[309]: syntax error: '(' unexpected

1|u0_a183@:/ $ ls -l /system/xbin/cs*
-rwxrwxr-x 1 root root 17722 Dec 13 10:08 /system/xbin/cs
u0_a183@:/ $
[Magisk] merbiyatch:
Latest update render nexus 6p on pn nougat incompatible. Iam not even able to compile a debug.
[Magisk] Jaymin.0.1910:
Do run in terminal, "echo $SHELL" and then, "echo $KSH_VERSION" ( without quotes ), and tell us the output

---------- Post added at 02:36 PM ---------- Previous post was at 02:35 PM ----------

You can't debug ??? really ???, please explain
[Magisk] merbiyatch:
Cs -debug ok r basically anything is tyoe after cs or just cs i get a checking compatibility.
[Magisk] guest4711:
Here you are

u0_a183@:/ $ echo $SHELL
/system/bin/sh
u0_a183@:/ $ echo $KSH_VERSION
@(#)MIRBSD KSH R50 2015/04/19
u0_a183@:/ $ uname -a
Linux localhost 3.0.101-g0a1ac92 #1 SMP PREEMPT Sat Dec 2 19:22:41 CET 2017 armv7l
u0_a183@:/ $
[Magisk] Jaymin.0.1910:
First, I didn't mean no offense, I'm new to English language, please understand. and Second, it's "cs debug", not "cs -debug". And a screenshot would be appreciated. Again, I don't mean no offense :)
[Magisk] Zoono:
cs stopped working for my HTC10 with Android 7.0.1 after version from 7 Nov. Earlier it worked but switches -d and -e functioned in opposite way. Switch -d was enabling charging, -e was disabling it. I was using it with Tasker but I wanted to upgrade to the newest version of cs. But like I said now it hasn't been working at all since version after 6th Nov. Attached is the debug file.
[Magisk] Jaymin.0.1910:
Please run attached script and upload /sdcard/cs_debug-test.log here. If what I'm thinking succeeds, then there is gonna be a great change in ctrl_file finding algorithms
[Magisk] Jaymin.0.1910:
That script is here

Edit: My internet dont seem to be working properly right now.

Create a text file "cs_debug.sh" with following as content

**starts**

#!/system/bin/sh

dir="`readlink /sys/class/power_supply/battery`"

echo -e "$dir\n\n\n" >/sdcard/cs_debug-test.log

dir="/sys/${dir#*/*/}"

find "$dir" ! -type d >>/sdcard/cs_debug-test.log

for file in `find "$dir" ! -type d`; do

cat $file >>/sdcard/cs_debug-test.log

echo -e "\n\n\n">>/sdcard/cs_debug-test.log

done

**ended**

and run "su -c sh /sdcard/cs_debug.sh" and upload the generated logfile here, and remember, do run script while charging on
[Magisk] Zoono:
Thx for help.

The log has been linked.

https://drive.google.com/file/d/1lCtfXb43lrDvrKcTLSq3vp72yJfjta7u/view?usp=drivesdk

Wysłane z mojego HTC 10 przy użyciu Tapatalka
[Magisk] abuttino:
Got a debug log for devs

https://drive.google.com/file/d/1eyMtDZoZ9y1SlHlnQpOzePs6pAKmHcvh/view?usp=drivesdk

Not working on Pixel 2 XL

Sent from my Pixel 2 XL
[Magisk] donny110:
Even though using the command with the debug version in twrp makes it actually function. It doesn't actually stop at the mentioned charge level.. I used cs 85 35.. it's currently at 87 and still charging..
[Magisk] abuttino:
Edit: That didn't fix it.
[Magisk] Razor10707:
The last update doesn't work on my vns-l21c432

It checks compatibility for about a minute then says unsupported device im sorry but i can't provide logs because where it says the log is placed there's nothing there but i keep trying maybe i can atleast get a log out of it

---------- Post added at 09:43 PM ---------- Previous post was at 09:18 PM ----------

Ah finally got a log

https://drive.google.com/file/d/1A5OH2eb_QO4YpNpPLK0h1DEsYpmgzE_k/view?usp=drivesdk
[Magisk] guest4711:
I think you missed the space between the command "cs" and the parameter "-c 80"...
[Magisk] RMarques:
in the first try, yes I did missed, however, in the second try I didn't.
[Magisk] RMarques:
...any clue why?
[Magisk] 0-W4lly:
Hi People !

Am I missing something?

$ su
trltexx:/data/data/com.termux/files/home # cs -i

Battery Info
STATUS=Discharging
CHARGING_TYPE=N/A
HEALTH=Good
ONLINE=1
TECHNOLOGY=Li-ion
VOLTAGE=3909000
VOLTAGE_AVG=3829000
CURRENT=-407
CURRENT_AVG=-943
CHARGING=0
LEVEL=78%
TEMP=311
TEMP_AMBIENT=330

trltexx:/data/data/com.termux/files/home # source /path/to/script
sh: source: /path/to/script: No such file or directory
ource /script/path/cs_debug.sh.txt <
sh: source: /script/path/cs_debug.sh.txt: No such file or directory

trltexx:/data/data/com.termux/files/home # cs -d

/system/xbin/cs[160]: can't create /sys/class/power_supply/battery/charging_enabled: No such file or directory
Charging disabled.
S/OFF --> Thu Oct 5 18:03:59 RET 2017

trltexx:/data/data/com.termux/files/home # cs -e

/system/xbin/cs[160]: can't create /sys/class/power_supply/battery/charging_enabled: No such file or directory
Charging enabled.
S/ON --> Thu Oct 5 18:04:16 RET 2017

trltexx:/data/data/com.termux/files/home #

Thanks a lot.
[Magisk] frdc0410:
I ran it as root already but when I entered a command, nothing appeared afterwards; just blank spaces when you press enter :crying:

EDIT: I thought I was able to make it work already, but maybe it still isn't compatible with my phone? I'm using S7 Edge with Batman ROM and kernel. My 1st problem was when I was still on Superman rom. When I entered commands, nothing happened; just blank spaces. I finally got to have a response when I switched to batman rom and kernel but when entering cs -i, the only response I get is "Battery Info" and nothing else.

This is what I got:

Charging to 45%...

S/ON --> Sat Oct 7 01:31:08 +08 2017

/system/xbin/cs[196]: can't create /sys/class/power_supply/battery/charging_enabled: Permission denied

Desired charge % reached!

S/OFF --> Sat Oct 7 01:34:09 +08 2017

- Press RETURN to re-enable charging & exit.

return

/system/xbin/cs[201]: can't create /sys/class/power_supply/battery/charging_enabled: Permission denied

hero2lte:/data/data/com.termux/files/home # cs -i

Battery Info

hero2lte:/data/data/com.termux/files/home #
[Magisk] kishore001986:
can anyone help me, how to use this module?

where i have to enter the commands
[Magisk] 0-W4lly:
Read :
[Magisk] kishore001986:
Thanks for reply, i have tried that but error is (no command '-' found)
[Magisk] frdc0410:
Try running the commands as root

From guest4711's comment previously:
[Magisk] onliner:
I think the function to stop the charge during "x" time does not work well:

su
cs -e 2m && -d 1m && cs 90

Results:

Charging enabled for 2m.
S/ON --> Sat Oct 18:49:29

Timeout reached.
- Charging disabled.
S/OFF --> Sat Oct 18:53:21

sh: -d: not found.
[Magisk] guest4711:
I think you missed one "cs" command.

cs -e 2m && -d 1m && cs 90

should read

cs -e 2m && cs -d 1m && cs 90

The shell tries to execute all given commands one after on (therefore the "&&" (ampersands) stand) until an error occurs or everything is done. Because there is no command called "-d" the 3rd command is never executed.
[Magisk] goodburner:
Sorry if it has been answered previously, but the problem I have is that it does not resume charging after it gets triggered once. So say if I ask it to stop charging at 87%, it works but when I plug it back again, it does not charge until I reboot it. Is there a way to fix this or am I doing something wrong? I do have the second option to resume charging set at the same 87%

EDIT : I'm confusing this app with the f-droid one that was posted here, sorry about it, I'm actually yet to test this one out.
[Magisk] Taracair:
It seems you've forgot space between the - and the d or e command.

I have found another bug - the cs 100 command doesn't work. It doesn't stop the charging after reaching 100%. However the cs 99 command works fine.
[Magisk] VR25:
A New Version is Up

- Read the OP & changelog before installing.

- Available from Magisk Manager.
[Magisk] :
I tried this module once. But the only issue is the terminal should run in the background to execute the command given. This slows down the charging time. But fortunately, MIUI 9 has a feature by which Power supply is cut off when 100% battery charge is reached. You could see no notification light after 100% battery charge.

0-9%-red

10-89%- greenish yellow

90-99%-green

100%-nil

???
[Magisk] Eng.Raman:
Status: Unsupported device

Zenfone 2 (Z00A) / Stock 6.0.1
[Magisk] guanto96:
Unsupported device

Nexus 5 / Android 7.1.2
[Magisk] umut1432:
How to disable charging when usb connected on pc
[Magisk] VR25:
Hm... nah. Running cs isn't such a power hungry task. In fact, it's the opposite -- very efficient.

Still trying to study your device's /sys tree (even without having access to it). Hard job -- you can imagine. ;) Rest assured, though -- I'm not stopping here. If you still get "(!) cs: Unsupported device" message on build 2017.10.8.1, see if you can run "cs debug".

cs debug --> generates 3 debugging zips in /data/_cs_debug (one per run). Upload these here manually.
Run
- While charging (USB)
- While charging (AC)
- While unplugged (not charging)

2017.10.8.1 build includes more devices -- Nexus 5 is on the list.

su

cs -d
[Magisk] Ph4:
Here from Nexus 5 it says "Unsupported device", is there a way to help you adding support for Nexus 5?
[Magisk] Jaymin.0.1910:
Try "su -c cs -c /sys/devices/soc/qpnp-smbcharger-16/power_supply/battery/charging_enabled" and see if it works, it succeeded, a great improvement in compatibility is ahead

---------- Post added at 07:35 AM ---------- Previous post was at 07:17 AM ----------

Can you do the same as I told [MENTION=912565]Zoono[/MENTION] upload cs_debug-test.log ??
[Magisk] GlowMann:
I want my phone to charge for 1 hour and 45 minutes I know theirs a command for that but what about after the hour and 45 minutes if the phone goes lower than 99% can it charge back up to 100%? And is there a way to disable/ turn it off because I only need it for when I go to sleep?
[Magisk] Jaymin.0.1910:
Do "cs -e" or "cs -d" work ?? If not, do the same as I told [MENTION=912565]Zoono[/MENTION] and upload logs here
[Magisk] Shivam's tweak:
Guys, I want to uninstall this module so please anyone provide the zip file for uninstalling it.
[Magisk] Razor10707:
Just delete it from magisk....
[Magisk] Jaymin.0.1910:
Thanks for the idea, flash again to uninstall feature will be added in the near future
[Magisk] Shivam's tweak:
Thanks:)
[Magisk] chandr1000:
Weird, it worked on my device on older version.

But broken on newer version (it said my device not compatible)
[Magisk] donny110:
These seem to indeed work? Anything I can do from there to fix this or automate?
[Magisk] aheadofsingularity:
i just tried your latest version 12.12 of cs but it says incompatible with nexus 6p

so i switched back to cs 11.6 and working fine.

edited（12.15）:11.6 does'nt work on my device.

11.25-1-debug2 is woking fine.

here is log: currently i can not paste external links :(
[Magisk] wilberfan:
Tried the latest on my One plus 3T Oreo. Went past the charge limit. Back to the Nov 6 version! ?

[edit] I ran cs -c /sys/class/power_supply/battery/charging_enabled first, then cs 80 50, but still went past 80%.
[Magisk] novalis01:
no .core in /sbin

can only find it in /magisk/zzz-cs-service

any advice?
[Magisk] Didgeridoohan:
Try /magisk instead of /sbin/.core/img
[Magisk] Palackan:
I'm sorry, i can't understand the method of configuring cs, from where can i find the module?