yashsingh1/xdaforums huggingface dataset:
[Magisk] davidzam:
Hello. I was reading this post. Interesting. I would like to know if I can use this mudule for this and this only.

I want to be able to charge my phone all to 100% and after reaching that value if I don't disconnect, I want it to stop recharging (even if it's still connected) and resume charging when it reach 80% (for example). And I don't want that the phone turns off itself at 20% or 15%, I want to be ble able to use the saving battery features from my device if I ever get in the necessity of use the whole charge, belive me, that's a constant where I live. Thank you.

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
You can definitely do that. Simply set maxCapacity=100 and resumeCapacity=80.

The default auto shutdown capacity is 5. You can set it to whatever you want (any value from 0 to 100).

MCS doesn't interfere with battery saving features.

Thanks.

P.S., the config file's path is </data/media/mcs*/config.txt>.

EDIT

[MENTION=3943384]davidzam[/MENTION], in case you're wondering, there are no commands for setting things up. To simplify setup and usage in general, all you have to deal with is the text file listed above.
[Magisk] davidzam:
Thank you very much I will install and see how it goes. It's on the magisk download section right?

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
You're welcome. Install the latest beta, as the stable will soon be replaced.

Download the last zip from post #3!
[Magisk] davidzam:
2018.10.12.1 right? Twrp...

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
That's it. You can install either from Magisk Manager or TWRP.
[Magisk] davidzam:
So I just edit the text. 100 the firts line. But I don't see the others you mention.

Enviado desde mi SM-G550T1 mediante Tapatalk

---------- Post added at 03:33 AM ---------- Previous post was at 03:32 AM ----------

Resume capacity or out shutdown.

Enviado desde mi SM-G550T1 mediante Tapatalk

---------- Post added at 03:37 AM ---------- Previous post was at 03:33 AM ----------

# MCS CONFIG

# <charging limits>

higherLimit=100

lowerLimit=80

# <power supply info>

uevent=/sys/devices/battery.29/power_supply/battery/uevent

# <charging switch>

switch=on

onKey=80

offKey= 1

# <daemon>

autoRun=true

pauseDaemon=false

# <debugging>

loopVerbose=false

Something like that?

Enviado desde mi SM-G550T1 mediante Tapatalk

---------- Post added at 03:39 AM ---------- Previous post was at 03:37 AM ----------

# MCS CONFIG

# <charging limits>

higherLimit=100

lowerLimit=1

# <power supply info>

uevent=/sys/devices/battery.29/power_supply/battery/uevent

# <charging switch>

switch=on

onKey=80

offKey= 1

# <daemon>

autoRun=true

pauseDaemon=false

# <debugging>

loopVerbose=false

Like this?

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
[MENTION=3943384]davidzam[/MENTION], sorry, that's not the right config file!

Make sure mcs stable is disabled or removed to avoid conflicts.

Assuming you installed the latest beta (2018.10.12.1), your target is </data/media/mcs_beta/config.txt>.

EDIT

[MENTION=3943384]davidzam[/MENTION], set

maxCapacity=100

resumeCapacity=80

shutdownCapacity=0

EDIT 2

[MENTION=3943384]davidzam[/MENTION], yes, you won't need the .bak file.
[Magisk] davidzam:
Yes I did unistall and erase and began from scratch.

Enviado desde mi SM-G550T1 mediante Tapatalk

---------- Post added at 04:31 AM ---------- Previous post was at 04:23 AM ----------

Should I erased the bak file created by root explorer? I did edit the values as you told me and save the changes. I did not touch anything else

Enviado desde mi SM-G550T1 mediante Tapatalk

---------- Post added at 04:36 AM ---------- Previous post was at 04:31 AM ----------

Thanks man. You are very kind. I'll leave the file alone. So. Lest try now. You are very welcome. This was the module I was looking for... Exactly... [emoji2]

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] ale.giordano:
Hi! I installed last beta but in terminal the commands in first page doesn't work. Help me please
[Magisk] onliner:
Are you running the commands with root access?
[Magisk] ale.giordano:
Yes, do you give right commands please?
[Magisk] onliner:
Can you send me an example of the commands you are using? Probably you are missing something, because the commands in the OP work perfectly for me and for the rest of the users.
[Magisk] ale.giordano:
This
[Magisk] paolocorpo:
Ciao !

As [MENTION=5228676]VR25[/MENTION] said in this his post #1521 ...

...

Pratically if you have installed the beta you have to set che config.tx fiel (is you want) or leave it untouched !

The comand given by a terminal is a procedure that can be used ONLY if you are using the stable version

Please uninstall stable version if you want use beta version

Ciao

Paolo
[Magisk] ale.giordano:
Thanks Paolo!

Can I asking information in micommunity thread?
[Magisk] paolocorpo:
Could be better that you address your request to this thread where developer is present but if you prefer and based on my info I can try to help you on Mi Community where we are together participating

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] ale.giordano:
My English is very bad but I try to explain me.

I would settings for night charge, then slow charge but up to 100%.

I use 1A charger, can you suggest me an appropriate setting?
[Magisk] paolocorpo:
Dear,

usually a lot of people are considering that the best for your battery life is avoid to charge up to 100%

But ... if this is your aim ... I have modified the config.txt file for you (attached here)

You have to download it and substitute to existing one in:

/data/media/mcs_beta

I WANT REPEAT a very important thing:

the stable version and teh beta version cannot live together at same time

If necessary please uninstall the stable and reinstall beta
[Magisk] ale.giordano:
I know that the best use for battery isn't charge it up to 100%, but is necessary for me.

Now I installed last beta version and I will use your config.

I will report my experience in this thread.

Thanks Paolo!
[Magisk] paolocorpo:
Well done!

keep in mind that the module will apply a special strategy between 80 and 100% for witch you will see that the charging will have alternation of 20 sec OFF and 40 sec ON

This is for reduce the stress of your battery but will not avoid the possibility to charge up to 100% as you desire (as I suppose but we have to test)
[Magisk] paolocorpo:
[MENTION=8638790]ale.giordano[/MENTION]

I forgot to set the resumeCapacity

The default value (70) could be too small versus the max capacity that you want (100)

SO i setted it to 90

Please let use the attached new config.txt
[Magisk] ale.giordano:
Thanks for your attention...

I would an information...

In this config the charge will be at 1500mah max tension until 80%. From 80% to 100% alternate on/off charge, which tension will be used in this range?
[Magisk] paolocorpo:
Honestly I don't know

I suppose the same tension

But let wait the response of developer [MENTION=5228676]VR25[/MENTION]

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] ale.giordano:
Hi Paolo!

Probably for this configuration is needed to use a 2A charger, because tonight the battery hasn't been charged up to 100%. Charging from 80% to 100% is top slow.
[Magisk] paolocorpo:
It was my doubt too

I have changed coolDownRatio

It was as I said 20/40 and now it is 10/50

Let try with this new attached config and let me know

Paolo
[Magisk] ale.giordano:
Thank you so much!
[Magisk] paolocorpo:
You are welcome

Of course if we would have in future the intention to change charger with other more aggressive (1,5 or 2 A) ... I kindly suggest to you to set in more soft way the strategy of cooldown capacity (between 80/100 on your personal config)

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] MarkTejo:
Hello everyone ,

I installed latest beta and changed two values max capacity to 90 and cooldowncapacity to 80.

Now my phone isn't charging after 80% even when the device is cool.

Any Help??

Thanks.?
[Magisk] paolocorpo:
Ciao

Have you plugged to an AC charger or what ?

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] MarkTejo:
I don't know whether u are referring to me or not.

But if u then yes I'm using AC Charger(original Samsung charger).
[Magisk] paolocorpo:
Yes I was referring to you

Are you sure that you are not into the special strategy of succession of ON/OFF charging ?
[Magisk] MarkTejo:
No. Please explain me in a simple way.
[Magisk] paolocorpo:
When the capacity has a value between max and cool down (in your case between 90 and 80) and/or the temperature is between max and fair ... The charging process will be NoT continuous

It will be a succession of ON (40 sec) and OFF (20 sec)

So if you observe the device when there is an OFF step ... It looks as the charging is not started but if you look at it for more time (1 minutes is enough) you will face the charging will be alternate as I said

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] davidzam:
Some issues there it charges up to 100% then stops, won't charge until it reaches 80%, starts again, but after a while, the notification of the battery stays in 90 or 95%, doesn't move... Until I desconnet. Once it stayed at 80% for a long time. No changes... Testing now by draining all the battery giving to my device a normal use... To check how many memory this module uses... And energy. Thank you. You can se my setting on previous post.

Enviado desde mi SM-G550T1 mediante Tapatalk

---------- Post added 20-10-2018 at 12:03 AM ---------- Previous post was 19-10-2018 at 11:59 PM ----------

It would be nice to change config to get a bit more agresive chargin process when you have a setting like mine. I bit like the one you mention in here. Waiting for developer answer. [emoji4]

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
The max charging current is not set by default. 1500mAh is just an example. Notice that maxCurrent is commented out.

The module has two charging control mechanisms. The first works by toggling charging ON/OFF, while the second manipulates charging current.

These mechanisms don't work simultaneously. If the primary fails, the secondary takes over.

The values $maxCurrent and $lowCurrent are used only by the secondary control method.

In sum,

Primary -- toggles charging ON/OFF:

a

Alternate -- toggles charging current MAX/LOW.

[MENTION=5056724]paolocorpo[/MENTION]'s suggestion is great for this one. Play with coolDownRatio until you find the best settings. The 10/50 ratio, or even 5/55 should be good.

The next update will have this simplified and closer to a standard.

Your issues seem to be caused by coolDownRatio (discussed above).

And there's a way to disable that, (enable aggressive mode or default charging speed). Simply set coolDownCapacity to 100 (same as maxCapacity).
[Magisk] davidzam:
Hello. Did the changes as you instructed. Device charged ok. But suddenly it won't charge anymore. Any ideas?

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
Could you share your config.txt? Thanks.
[Magisk] davidzam:
Sure.

It worked fine, for a while but then, after stopping to charge at 80% as requested it didn't start again when the charge went below 80%, it reached 40% and nothing, tested with several chargers and no response. Only began charging after a reboot. And it charges when it's off.
[Magisk] MarkTejo:
Yesterday I flashed this and plugged in charging and went to sleep. It was 54% and when I wake up it is 64% overnight it charged only 10%. Pls help.
[Magisk] davidzam:
Yes. Not chargin unless I restart the device... Bummer

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
Interesting and intriguing... ?️

Could you guys post both logs from </data/media/mcs_beta/logs/>? Thanks.
[Magisk] MarkTejo:
Attached
[Magisk] davidzam:
On it. Just to let you know I left the device connected to the charger 73% about 6 hours ago. No changes. Still on 73%

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
Could you guys post screenshots of tge commands <su -c dumpsys battery>, one while charging and another while unplugged? I'm working on updates. Thanks.
[Magisk] davidzam:
There you go.
[Magisk] davidzam:
I guess you will know which is which because I don´t know
[Magisk] davidzam:
Will you know?
[Magisk] davidzam:
Hello. Any updates? Thank you.

Enviado desde mi SM-G550T1 mediante Tapatalk
[Magisk] VR25:
Within a day or two from now...
[Magisk] paolocorpo:
Thanks Developer,

I stay tuned

Paolo
[Magisk] Godecki:
Hi, I've got a problem. I decided to use MCS on my Xperia Z2 Tablet with RROS. The mod is great, but I am not able to setup the mod to work as desired or maybe it is not possible. The problem is, I own the magnetic stand which doubles as a charger and I would like to leave it on the stand when I am not using it. The solution is great, due to the MCS the battery never goes over 80%, nor less than 20% (these are my settings). But, the problem occurs while I am using the tablet. For example, if I'd like to use it while it's connected to the charger, it won't charge unless the battery is 20% or less. The charger doesn't have enough power to charge the tablet while I am intensively using it, so for example that's unfortunate if I have to drain the battery to 20% in order to get it charged. Let's say my tablet has 30% of battery and I am going to use it for some hours. So, I need to charge it up. But I can't, cause the battery is over 20% and it doesn't charge. Has anyone got the solution to this or maybe I am doing something wrong?
[Magisk] paolocorpo:
You can try to modify the cool down ratio to a new one more "aggressive"

For instance let try with 10/50 (10sec pause and 50 sec chargin)

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] Godecki:
I am not using settings depending on charging time but rather depending on battery percentage. Well, I guess the best solution for me would be to run "mcs 70 69" command :)
[Magisk] paolocorpo:
This your last post give me the chance to understand that you are using stable version

I was misunderstanding ... And thinking that you were using the beta version

Ok your proposal is an option

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] Godecki:
Oh, so actually my problem is kind of appropiate? :) Maybe there should be a setting where you specify the charging process for screen on and off? :D
[Magisk] VR25:
ANNOUNCEMENT

My original intention was to release an update which includes a couple of major changes (inc. new features). Unfortunately, I got too busy lately with other projects and life. Couldn't finish the new version.

Instead of pushing regular changes, I decided to finish the big ones and release something more complete. Yes, I'm actually talking about new features, not just fixes. More specifically, the beta builds will have terminal commands too. Things such as enabling/disabling charging on demand and "endurance mode" are a few examples.

Forget about the 2 days deadline. Considering my busy schedule, this may take up to a week to finish.

After the upcoming update, ETAs will no longer be announced. Consequently, users should refrain from asking about that. ETA questions will simply be ignored.

Your 80 20 setting is not optimal, as it allows battery capacity to drop too much.

Lets put it this way: it doesn't matter much how often your battery charges and discharges. What really does matter is how deep the discharges and how high the recharges are.

When you're using your device for extended periods of time, while charging, keeping you battery capacity fluctuating around 40% is the best thing you can do to achieve maximum lifespan.

Constantly going from 80 to 20, then back to 80 is a bad, bad idea!

I would usually aim for a 41-42% loop. If you want to have more power right after disconnecting the charger, go for something like 60-61. Just remember that keeping a li-ion battery capacity around 40% is one of the golden rules for maximum battery lifespan. This applies whether the battery is in use or in open circuit (disconnected from the phone; stored for future use).

In sum, how often battery capacity drops/raises is negligible in contrast to how much it increases/decreases. That's one reason why the default setting has only a 10% difference between max and min capacity values.

P.S., the stable version has the <-k capacity> option (i.e., <mcs -k 42>) the "k" stands for "keep". The whole command means "keep battery capacity at this value" (with a drop/raise tolerance of 1%).
[Magisk] ffuser1:
Pixel 3 xl. Can't install it. Help anyone? I can't get battery life extender to run properly either - it reboots the device. Not sure if the two are related at all. Any other pixel 3 owners want to chime in?

Copying zip to temp directory

- Installing Magic_Charging_Switch-2018.8.8.zip

Archive: /data/user/0/com.topjohnwu.magisk/cache/install.zip

inflating: common/config/macrodroid

inflating: common/config/mcs

inflating: common/config/switches

inflating: common/config/tasker

inflating: common/service.sh

inflating: common/system/xbin/mcs

inflating: module.prop

update-binary: line 198: make_ext4fs: not found

losetup: /data/adb/magisk_merge.img: No such file or directory

Magic Charging Switch (mcs) 2018.8.8

VR25 @ xda-developers

Powered by Magisk (@topjohnwu)

- Creating /data/adb/magisk_merge.img with size 64M

- Mounting /data/adb/magisk_merge.img to /dev/tmp/magisk_img

losetup: /data/adb/magisk_merge.img: No such file or directory

losetup: /data/adb/magisk_merge.img: No such file or directory

losetup: /data/adb/magisk_merge.img: No such file or directory

losetup: /data/adb/magisk_merge.img: No such file or directory

losetup: /data/adb/magisk_merge.img: No such file or directory

losetup: /data/adb/magisk_merge.img: No such file or directory

losetup: /data/adb/magisk_merge.img: No such file or directory

(!) Failed to mount /data/adb/magisk_merge.img

! Installation failed
[Magisk] onliner:
f2fs, that's the problem I think.
[Magisk] guest4711:
[MENTION=3592024]ffuser1[/MENTION] Your ROM does not have the utility for creating ext4fs in the search path ("make_ext4fs: not found"). So the new magisk volume could not be createt...
[Magisk] VR25:
[MENTION=3592024]ffuser1[/MENTION], it's what <guest4711> said.

To bypass this, either install from TWRP or try the latest beta from post #3.
[Magisk] ffuser1:
OK I installed the beta. No problem there. Now it doesn't seem to be working..

$ su

:/ # mcs 80 50

/system/bin/sh: mcs: not found

127|:/ # mcs 80 20

/system/bin/sh: mcs: not found

127|:/ #

I've restarted the phone a bunch of times. Aside from enabling the module in magisk, I'm not supposed to enable anything else am I?
[Magisk] VR25:
Currently, betas have no terminal commands. Having a Terminal emulator is not even a prerequisite. All you have to deal with is </data/media/mcs_beta/config.txt>.

BTW, you should disable or remove the stable version if you didn't do so already.
[Magisk] slayer1991:
For those looking for info, on my Pixel 3 the following switch worked:

/sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/input_suspend

EDIT: the one above actually didn't reenable once battery dropped under the set value.

Installed from TWRP by flashing the zip.

This switch worked instead:

/sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/charge_disable
[Magisk] VR25:
Seen from the XDA Labs app, the logs look like a tongue joke. :p

Please, post the outputs of <su -c dumpsys battery> while unplugged and while charging.

Thanks

I could've sworn that's already in my database. Did you set it up manually?

Thanks
[Magisk] Grimore:
Unplugged :

root@android:/ # dumpsys battery

Current Battery Service state:

AC powered: false

USB powered: false

Wireless powered: false

Max charging current: 0

Max charging voltage: 0

Charge counter: 0

status: 3

health: 2

present: true

level: 79

scale: 100

voltage: 4118

temperature: 333

technology: Li-ion

Charging :

t@android:/ # dumpsys battery

Current Battery Service state:

AC powered: true

USB powered: false

Wireless powered: false

Max charging current: 38000

Max charging voltage: 4200000

Charge counter: 0

status: 2

health: 2

present: true

level: 79

scale: 100

voltage: 4200

temperature: 326

technology: Li-ion

Thanks
[Magisk] slayer1991:
It is, I selected it using mcs -x. Thanks!

Just posted it for other Pixel 3 users' reference, in case they use the Search :)
[Magisk] Sreekantt:
Bro... I think cs debug log file is generated(Honor 6x)- have a look
[Magisk] VR25:
What's the output of cat /sys/devices/platform/huawei_charger/enable_charger?

If it's 1, with the device charging, set it to zero by running echo 0 /sys/devices/platform/huawei_charger/enable_charger. Report whether the battery stops charging.

P.S., you can paste the codes directly on terminal.

EDIT: [MENTION=7042702]sreekantt[/MENTION], I forgot the ">" -- sorry!

echo 0 [b]>[/b]/sys/devices/platform/huawei_charger/enable_charger
[Magisk] CyberZeus1977:
Hi, I'm trying this module on Mako, here it is what happens:

mako:/ # cs -i

/system/xbin/cs[271]: s=/sys/module/pm8921_charger/parameters/disabled: not found

(!) cs: Unsupported device

(i) Gathering debugging data...

/system/xbin/cs[271]: zip: not found

mv: can't rename 'cs_debug.zip': No such file or directory Done

(i) Please upload /sdcard/cs_debug* files to the official XDA thread

mako:/ #

I ran su first.

The weird thing is that if I cat that file, I can see it and its content is 0.

Do you have any suggestion? Thanks!

Inviato dal mio Nexus 6P utilizzando Tapatalk

---------- Post added at 17:07 ---------- Previous post was at 16:43 ----------

I see in your code you use the switch command.

If I enter switch on terminal, it says

sh: switch: not found

Does this help?

Inviato dal mio Nexus 6P utilizzando Tapatalk
[Magisk] Sreekantt:
It shows '1'

When we try to set it '0' with that command 2-it doesn't sop charging. i think it isn't getting applied. When we recheck with 1st command- it still shows '1'. However, i tried to set values to stop charging after using 2nd command.... It gives d same error.
[Magisk] aselvan:
You can do the following to enable or disable or check current status.

Disable

:

# echo 0 >/sys/class/power_supply/battery/charging_enabled

Enable:

# echo 1 >/sys/class/power_supply/battery/charging_enabled

Status:

# cat /sys/class/power_supply/battery/charging_enabled
1
[Magisk] VR25:
# v2017.10.15 (201710150)

- Additional devices support.

- Built-in zip binary to pack debugging data.

- Users can now specify the charging control file for cs to work with. Check the README for additional info.

That's the mystery I'm trying to solve (same issue on Nexus 5). About "switch" -- that's actually a function I created to set the charging control file and its parameters.

Anyway, now users can specify the control file and make debugging a whole lot easier.

Did you run the command as root?
[Magisk] VR25:
# v2017.10.15 (201710150)

- Additional devices support.

- Built-in zip binary to pack debugging data.

- Users can now specify the charging control file for cs to work with. Check the README file or OP for additional info.

That's the mystery I'm trying to solve (same issue on Nexus 5). About "switch" -- that's actually a function I created to set the charging control file and its parameters.

Anyway, now users can specify the control file and make debugging a whole lot easier.

Did you run the command as root?

EDIT: # v2017.10.15-1 (201710151)

- Additional devices support

- Fixed cs_ctrl error.
[Magisk] Sreekantt:
Absolutely bro... Forgot to ? attach d screenshot..doing now
[Magisk] Sreekantt:
oops..yeah ...it stops d charging....how to integrate this within the module
[Magisk] Sreekantt:
now executing cs 80 command gives extra zip warnings... Cs debug also attached after d latest update
[Magisk] VR25:
I did that already -- in v2017.10.15-1.

These aren't warnings at all. If you have the zip this time, it means the binary I just added works! :p

Now I can get even more data.