yashsingh1/xdaforums huggingface dataset:
[Magisk] CyberZeus1977:
I manually created the folder you mentioned and MagiskManager was able to download the zip.

Inviato dal mio Nexus 6P utilizzando Tapatalk
[Magisk] guest4711:
Glad it worked :svetius:
[Magisk] Sachitoge:
Can you make a Tasker automater profile (or anyone who has knowledge to do that complicated things.. lol i got no skillz).

So when charger is plugged, it runs the terminal emulator and runs the cmd su then cs to run the last ran cmd.

This way we can do somewhat automation.

Only problem is it has to interact with notification and click the "Acquire Wakelock" button to avoid being killed by system (doze, other stuffs/ram etc, u know... Can minimize being killed by other apps/softwares).

Automagic Premium app has the ability to interact with Notifications VERY easily but only problem is I dont know how to make it open an app, type certain cmd doing this in background without showing on the screen (if its even possible).

Either way, I think this can make it flawless instead of keeping the terminal emulator constantly open running in the background.
[Magisk] guanto96:
In nexus 5 if I set the limit to 80, when it reaches 80 it's like it goes (in - /sys/devices/f9923000.i2c/i2c-84/84-006b/power_supply/ac/charging_enabled) from 1 to 0 and immediately to 1 again because, when I go to see the battery stats while it's charging, when it's at 80 there is written that charging has started few seconds before
[Magisk] VR25:
Previous versions had a command for that (cs -c). Later on, I decided to get rid of it and automate the process. Yes, the Readme still states that battery stats are cleared automatically. I forgot to remove that sentence, but I struck it in the OP.

So, why aren't battery stats being cleared? Well, it turns out removing /data/system/batterystats.bin doesn't work, and I'm not aware of any alternate way of "pushing the red button" on Nougat.

Great timing. I started working on that yesterday.

[MENTION=7388797]guanto96[/MENTION], are you sure you're not pressing ENTER before checking battery level in settings? After the target % value is reached, cs asks the user to press the return key (enter) to re-enable charging & exit.
[Magisk] Sreekantt:
showing Unsupported device, broken pipe, charging_enabled: not found

on my Honor 6x running EMUI 5.0 - Nougat

is there anyway i can help ??
[Magisk] Sachitoge:
Write to terminal emulator cs debug

And upload that file to here.

Make sure you write in "su" to give root permission, and then "cs debug".

If it fails, take screenshot and upload to here.

Edit: make sure you zip it.
[Magisk] Sreekantt:
debug command isn't working... Although cs - - i shows info... Screenshots attached
[Magisk] Bortex19:
Nice! :highfive:

Very interesting. I want to see what experts think about it
[Magisk] elvinguitar:
I just noticed right now that we have the same case. Im currently using "mcs 80 20" and when I plugged the charger, the charging icon shows. But the bttery level didn't increase. I had to run "mcs -e 80%" or "mcs -r" for the charging to work.
[Magisk] papuruth:
Not working

Logs attached please see to it.

Edit:

It worked but after removing magisk recovery mode module.

Why is it conflicting with it.

Please see to it.
[Magisk] heithered:
How can i stop/pause mcs so system can charge normally? And enable/resume mcs? I want to use mcs on specific occasions, can i do that?
[Magisk] ktmom:
The help switch in MCS gives you all sorts of info. But that same information is posted in the first post of this thread.

"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
[Magisk] heithered:
I see, i asked because i couldn't understand 100% but i think it's mcs -s, is it?
[Magisk] onliner:
mcs -s
[Magisk] Benni:):
I've written an app for this.

the tile can toggle the state

https://xdaforums.com/moto-z/themes/tool-efficency-mode-battery-mod-info-t3826694
[Magisk] Bortex19:
Thank you for the update! Can you add some examples? I think is the best way to clarify it
[Magisk] paolocorpo:
Dear developer thank you for this effort

After the disconnection of charger I have to repeat the procedure that means:

Connect the charger (of course)

reboot

Give comand by terminal

or the previous comand has been stored in such way ?

Thanks

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
The config file's path is /data/media/mcs_beta/config.txt.

The default config is

# MCS Config
# /data/media/mcs_beta/config.txt
# Current is expressed in Ampere * 1000000
# Temperature is expressed in Celsius * 10

#maxCurrent=1500000 # leave untouched to use device's default.
lowCurrent=500000 # for slow charging
coolDownCapacity=5 # charge slowly when $capacity% >= $maxCapacity% - $coolDownCapacity%
shutdownCapacity=5 # auto-shutdown when $capacity% <= $shutdownCapacity%
maxCapacity=80 # halt charging when $capacity% >= $maxCapacity%
resumeCapacity=70 # resume charging when $capacity% <= $resumeCapacity%
maxTemp=450 # halt charging when $tempC*10 >= $maxTempC*10
fairTemp=400 # charge slowly when $fairTempC*10 >= $tempC*10 < $maxTempC*10
sleep=5 # loop delay in seconds
#log=<path> # verbose

For now, just focus on maxCapacity and resumeCapacity.

There's no terminal executable at this time.

All you have is a txt file with default parameters set. Capacity is another word for battery charge level or state of charge (in percentage).

You're welcome.

It's much simpler than that. Unlike the current MCS stable version from the repo, this one doesn't require any initial setup whatsoever.

It's meant to be installed and forgotten (you know what I mean). So, connecting charger, rebooting, running commands on terminal... none of that applies to this version!

Refer to the previous response for additional info.

---

Notes to All

This MCS doesn't rely on control files such as charging_enabled to stop charging. It takes a totally different and more universal approach. In theory, that should bring compatibility up to the roof. In practice, I'm yet to know from the community, how this holds up.

Charging may not be stopped completely on some devices. In such case, instead of stopping, it'll be so slow (I mean, really supper s-l-o-w) that nobody will even care (hopefully). That's a compatibility trade-off.
[Magisk] paolocorpo:
I am not using the last beta but the last official 2018.8.8

Are you confirming your statement (no reboot is necessary more than the first one) with the 2018.8.8 version too or they are true with the last beta of Sept 29 only ?

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
That's true for both!

New settings are noticed and applied whether you reboot or not.

---

**2018.9.30-beta (201809300)**

- Fixed typos.

- Use nonpersistent lock file (/dev/mcs_beta_tmp/.running).
[Magisk] paolocorpo:
Thanks

I see a new release beta today

Is it necessary to uninstall/deactivate a previous different version before to install this one new ?

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
You only need to uninstall/disable non-beta (regular) version (and similar modules/apps) to avoid conflicts.
[Magisk] paolocorpo:
Thanks

I did

Beside .. .I would like share this your module and procedure with some italian forum (ANDROIDIANI.com and c.mi.com)

Do you prefer that I share only the link to this 3D or do you prefer that I try to introduce myself your module giving them some simple simple informations about it (for instance the procedure for a correct installation and basic setup (stable based) ??
[Magisk] VR25:
INFO

Fast charging is a double-edged sword!

While that allows your battery to charge much faster, it also raises battery voltage and temperature too high and too fast. This stresses the battery more than charging it up to 100% capacity at regular/slow speed.

Fortunately, in addition to halting/slowing down charging at set temperature ranges in order to cool things down, MCS beta allows users to finely control max charging current.

I must warn that this is a potentially dangerous territory, though!

Only change maxCurrent if you understand a thing or two about electricity/electronics.

Tip: setting maxCurrent to 1000000-1500000 or so (1-1.5A) enables USB fast charging. Generally, you can't go wrong with 1A.

DON'T GO NUTS and set maxCurrent too high! While there are current cut-off/limiting mechanisms built into every device, you can't simply say "whatever" and take things for granted.

As long as you give proper credits, you're free and encouraged to share any information about this module, including, but not limited to its documentation and all conversations/reports.

To prevent abuse/fraud, you're NOT allowed to share the zips online. Share a link to this thread instead.
[Magisk] psychoela:
Testing latest beta sin not work,charging slow but not realy slow,ss btry label test from 89% to 100%. [MENTION=5228676]VR25[/MENTION] i have 1 req, can't u make this version cs compatible with magisk 17+. Many thanks dev! :D
[Magisk] VR25:
Wait... which values did you set maxCapacity and resumeCapacity to?

Beware that Ampere doesn't always show the truth.

So, is this the last one which works fine for you?

The stable version is undergoing major changes. Eventually the beta will be merged into it and things should be up to speed again.
[Magisk] psychoela:
I use config as stock, but test charging start battery 89% until 100% with ampere always open n see speed ma drop very slow or not. Yes, this cs version.
[Magisk] VR25:
What was the very minimum mA reading you saw?
[Magisk] psychoela:
470ma, i not wait very long, after 100% battery i unplug my charger. But ma always drop slow n i can see,. Can u tell me minimum ma is supposed for this mcs beta,i will test
[Magisk] paolocorpo:
Dear Developer

I am on Xiaomi Mi A1 device

Android One 8.1.0 with Sept patch

Magisk 17.2

Moun Kernel 6.1

Your module Beta Sept 30 (plus several modules)

This night I connected the charger to device that was 13% charged

This morning after 7 hours I founded it at 100%

Of course I have not any kind of information about temperature and speed used by charger

It is correct ??

I was expecting a lower level of charge ... Based on reading of your setting and strategy

I am available to collect and provide you any log

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] Bortex19:
Same for me, and I had configured a 75% of max charge level

I think I am doing something wrong. Could you write and example of how configure slow charge when Tº reaches 37ºC, stops at 40ºC, resume when it's lower than thaat and stops at 75% resuming at 70%?

If I have that configured and one day I need to charge my smarthphone fast all I have to do is disable the module in Magisk?

Thank you in advance!
[Magisk] VR25:
**2018.10.1-beta (201810010)**

- Extended charging current control for general compatibility and wireless charging support.

- Generate debugging info on install/upgrade (/sdcard/$MODID-debug-$(getprop ro.product.device || getprop ro.build.product).log)."

Those who can't get this version to work, please upload the generated debug log (/sdcard/mcs_beta-debug*.log). Thanks.

[MENTION=6263858]psychoela[/MENTION], [MENTION=5056724]paolocorpo[/MENTION]

[MENTION=8848618]Bortex19[/MENTION]

Set the following:

fairTemp=370

maxTemp=400

maxCapacity=75

resumeCapacity=70

All you have to do is remove /dev/mcs_beta_tmp/.running. Doing so, MCS service stops and changes made by it are reverted to defaults. The advantage of this over disabling the module is that MCS will auto-start again on boot.
[Magisk] Bortex19:
Ooookey, I was changing the values everytime I saw "maxTemp", including within parentheses
[Magisk] paolocorpo:
Thank developer for your update

I have a big doubt

If I use this last beta ... I have to set something or not ?

If yes ... How ??

Using the previous beta version after one night I got 100% ... And this is not what I was expecting ...

This is why I have this doubt:

I have to set something or not ??

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] Bortex19:
Go to the config.txt and when you see X (maxtemp, fairtemp, maxcharge, etc.)= any value; put the value that you want
[Magisk] psychoela:
Thanks dev.this my log.
[Magisk] Bortex19:
Same problem in the morning. 100% of battery
[Magisk] paolocorpo:
Talking about last beta version (or the previous two one) the change of strategy modifying the file config.txt is an option (as written into document)

So ... I would like understand the reason why over the night (around 7 hours starting from 10/15% as initial level of battery) my smartphone has reached 100% using the default configuration.

This happened two times (two nights)

I was expecting 80% because into default config.txt I read:

"maxCapacity=80 # halt charging when $capacity% >= $maxCapacity%"

Using the stable version and the the setting:

mcs 90 (for instance) (using terminal) ...

... I reached 90%

Thanks

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
Thanks!

[MENTION=5056724]paolocorpo[/MENTION], Try today's version. Thanks.

Indeed, that was very useful! If you have an awesomeness switch somewhere in your brain, I bet it's ON. Thank you very much for such a superb report! :highfive:

---

**2018.10.3-beta (201810030)**

- Bug fixes

- Initial re-work on non-amperage based charging control.

As the changelog suggests, I'm merging amperage/current based (beta MCS) and regular charging control (stable MCS) to increase compatibility.

The module is being redesigned, one feature at a time. I'll keep pushing updates frequently, until most of the work is complete.
[Magisk] paolocorpo:
Thanks for update!

Is it necessary to set something in order to achieve the max battery level at 80 (or 90) or it is coming by default setting ?

Edit

I tried the last beta of today without any specific setting ...

I was expecting the default max temp (80) but this was not respcted (I unlinked charger when the battery was 86)

So for me ... It is not running well

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
No, maxCapacity is already set to 80 by default. So, if you're fine with default settings, all you have to do is install the module and reboot.

[MENTION=5056724]paolocorpo[/MENTION], thanks for reporting. I'll mention you when the other charging control method becomes available.
[Magisk] paolocorpo:
I did

Please let refer to my previous edited post

Inviato dal mio Mi A1 utilizzando Tapatalk

---------- Post added at 02:19 PM ---------- Previous post was at 02:11 PM ----------

Ok

Do you suggest to uninstall beta and reinstall stable and wait next beta or you have intention to fix in few hours ??

EDIT

I unistalled last beta and installed last stable

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] psychoela:
[MENTION=5228676]VR25[/MENTION], latest beta work for me for first charging, but after my battery drop 70% less, n i charging again but not work, charging up 100%. thanks
[Magisk] VR25:
Thread has been updated. Check out the first 3 posts for details. Download zips from post #3.

**2018.10.5-beta (201810050)**
- <chmod +w ctrl_file> before echoing value to it.
- Enhanced logic and efficiency.
- Removed PATH modification entry (unnecessary).
- Set PWD to </sys/class/power_supply/>.
- Two charging control mechanisms: <charger ON/OFF switch> (primary) and <current_max control> (secondary, fallback)
- Updated documentation

A stable release will be around the corner sooner if reports on this version point to non-deal-breaking issues.

Here's one of the most significant details of this version (from post #2):

Thanks for all the support. Specials to all testers and donators. :)

EDIT

Other Important/Interesting Details

The secondary/fallback charging control mechanism is able to reduce charging rate as it controls charging current.

The primary, on the other hand, instead of slowing down charging at "fair" temperatures (and/or at $maxCapacity% - $coolDownCapacity%), it toggles charging ON/OFF as per $coolDownRatio (in minutes) until battery is cooler (and/or $maxCapacity% is reached).

For instance, the default ratio is 2/1. That means, when battery temperature is between $fairTemp°C and $maxTemp°C, (and/or $capacity% is between maxCapacity% - $coolDownCapacity% and %maxCapacity%), charging is restricted to every 2 minutes for 1 minute until battery cools down below $fairTemp°C and/or $maxCapacity% is reached.

Why not just limit temperature?

The additional max capacity difference slowdown phase allows battery voltage to drop to a less stressful threshold. It mimics slow charging. Li-ion batteries hate hugging and kissing high voltages for too long. They get anxious, depressed, stressed out and eventually start crying ?.
[Magisk] paolocorpo:
Dear developer here my first two trials with last beta version of your module used with default setting by me

1. I connected to the official home charger with around 50% of level

It charged up to 79% and after stopped

The charging happened fast

2. I connected to the USB port of my Ford Sync3 infotainment system with around 75% of level

This level remained constant for 1,5 hours

During this period I observed the two icons of battery

The icon of battery on device was showing the flash for all 1,5 hours

The icon of battery on screen of infotainment system was filled for 75% and not showing the flash but after first around 30min it changed in blank icon (= as for fully empty) and without flash; in occasion of a switch off it came back to the normal icon filled for 75% and without flash

I honestly don't know if the battery has been charged or not ...

The app ampere shows this (unfortunately I am not able to attach the screenshot ... I don't know why)

View attachment 4612263

Based on information coming from app Ampere I would say that the battery was discharging but my personal feeling is that the battery has been maintained at some level

In fact I was listening Spotify for 1,5 hours ... I cannot believe that the battery has been not interested in a small/medium drainage

Is this the right approach based on default setting ?

Which is your feedback ?

Thanks

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
Attachment

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] Jayraj Zala:
Can i use mcs alongside with blex (by Jaymin suthar)?
[Magisk] VR25:
What do you mean by that?

Did charging stop when battery capacity reached $maxCapacity%?

1) You were charging via USB, which is way slower than an AC charger.

2) Spotify was playing songs the whole time. I assume mobile data was ON too?

3) I also assume $coolDownRatio wasn't changed (default 2/1).

The Verdict

As per Ampere's reports, charging was being controlled as expected.

Why didn't battery capacity go over 75%? Considering the slow charging (USB) and Spotify draining power, plus coolDownRatio set to 2/1, roughly the same amount of power was being used and restored. Hence, capacity stayed the same.

What You Can Try Next

Set coolDownRatio=1/1 or 1,5/1.

FAQ: What is coolDownRatio for?

When battery temperature is between $fairTemp°C and $maxTemp°C AND/OR capacity reaches $maxCapacity% minus $coolDownCapacity%, coolDownRatio (in minutes) is used to toggle charging ON/OFF in order to bring battery temperature and/or voltage down to less stressful thresholds. The first number dictates how often charging is allowed in the aforementioned conditions (every x minutes). The second states how long battery should be allowed to charge.

For instance, a coolDownRatio of 2/1 means battery will be allowed to charge every two minutes for a minute, until temperature drops below $fairTemp°C or $maxCapacity% is reached.

Since USB charges significantly slower than an AC charger and your were using the device while charging, the ratio of discharge/recharge should've been 1 or lower. Perhaps I should set 1/1 as default...

Hmm, no... :confused:

Why would you want to do that?
[Magisk] Ridsever:
Hi, I've just installed latest stable version of mcs and received something like this (see attachment)

Could someone help me with this?
[Magisk] paolocorpo:
I mean that charging stopped when the battery capacity reached 79% versus $maxCapacity% that I know to be 80%

When your module is disabled the USB is able to charge despite data is ON and Spotify is running

Yes , $coolDownRatio wasn't changed (default 2/1)

OK I will do and I will report here my feeling ;)

Really interesting strategy ... but I want give to you the result of others trials that I did this morning before your reply :)

Yesterday night I connected my device to home original charger; the capacity level was around 25%

I saw the icon of battery with flash so I thinked that all was OK

But ... this morning ... after around 7 hours ... I founded the level at 25% !!

As for picture the level was maintaned more or less constant

I reconnected the device to the home charger and Ampere confirmed that no charging was running

Half hour later (the capacity dropped down from 25 to 22) I started a small journey by car

I connected the device to the USB port of my car and Ampere was confirming that no charging was running

So I noted that the file running was absent !!

So I rebooted the device and I noted that the file running appeared into folder !!

I connected the device to same USB port of my car and ... charging started allowing to increase capacity level from 22 to 57% in one hour (GPS, data and Spotify running as usual)

When I arrived to home I checked the mcs_beta folder into dev folder and ... It disapperead again !!

I am not an expert but I think that the deletion of running file must be analyzed

I have not understood the root cause but for sure if now I don't perform a reboot ... very probably a new charging cannot be performed (as very probably happened yesterday night)

Waiting your reply ...

Paolo
[Magisk] VR25:
[MENTION=5056724]paolocorpo[/MENTION], nice report! Thank you. :)

I also noticed that MCS service stops randomly. That's why /dev/mcs_beta/running is removed.

A new version is almost ready. It'll automatically generate diagnostic info to track down issues. Additional devices support and more will come along.
[Magisk] paolocorpo:
Very well

As required I edited the ratio from 2/1 to 1/1

I rebooted in order to recreate running file and I am now ready for the next trial/report waiting your next release

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] paolocorpo:
I have a question

Using last beta (generally speaking ... Using beta) ... Is there a way to temporary stop the mcs service ??

I personally faced that deleting running the charging is unallowed but I won't this ...

I want know how temporary come back to charging without any kind of control

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] VR25:
A new build is up. As usual, download the update from post #3.

**2018.10.6-beta (201810060)**
- Always enable charging before service stops.
- Auto-recreate <modData/>.
- Auto-restart service after errors.
- Added log watchdog to automatically zero-out the log file when its size exceeds <maxLogSizeM>.
- Redirect stdout & stderr to </dev/mcs*/mcs*.log> if verbose is disabled.
- Run main() only after system has fully booted.
- Set default coolDownRatio=1/1 to make sure battery charges via USB while device is in use.
- Set default sleep=10 (loop delay)
- Updated documentation
- Zenfone 2/Zoon and more devices supported.

Previous versions had a minor problem with that. Now, if you remove /dev/mcs*/running, the charging switch state is restored to default (ON).

Note that you should remove the lock file as root. Running <su -c rm /dev/mcs*/running> should do it. Thanks.

---

P.S., I'm yet to figure out what causes MCS service to stop randomly. This version has a workaround, though. Whenever service stops/crashes, it automatically restarts itself shortly afterwards (like a Phoenix). The new diagnostics engine will help me find out why it crashes every now and then. Thanks.
[Magisk] paolocorpo:
Dear developer,

Please check the file of last beta version because it create a message error when it is loaded as module by Magisk Manager

Thanks

Paolo

EDIT

I fixed and installed last version

Inviato dal mio Mi A1 utilizzando Tapatalk