yashsingh1/xdaforums huggingface dataset:
[Magisk] VR25:
A basic rule of thumb: when running commands on Android, always assume you need root (su). There are exceptions, of course -- but for the most part, low privileges won't get you anywhere.

Anyway, I noticed the "Unsupported device" message there, but things should be different. Run cs as root and we'll see...

These should be working already. Else, please report.
[Magisk] innit:
I've tried already and it doesn't work. unsupported device
[Magisk] guanto96:
Yes I gave root access
[Magisk] frdc0410:
Thanks so much for the new update!! I was finally able to make it work on my s7 edge with the new update however I'm still not seeing anything when entering cs -i. The only response I get is "Battery Info"
[Magisk] Eng.Raman:
Run: cs -i --> show only "Battery Info" without details.

cs debug --> didn't create zips.

Zenfone 2 / stock 6.0.1 / Magisk 14.2
[Magisk] VR25:
# v2017.10.9-1 (201710910)

* Enhanced debugging option (cs debug).

-- It can now gather much better data to hopefully support an even wider range of devices.

-- No need to run it 3 times anymore, unless I ask you to. Simply execute "cs debug" and upload the file /sdcard/cs_debug.zip here.

Will fix the battery info option next.
[Magisk] Eng.Raman:
cs debug --> cp: xread: I/O error
[Magisk] VR25:
I'll be posting debugging builds here for a while, in response to bug/incompatibility reports. These may be pushed very fast one after another. Repository & OP updates will be slower in comparison.

Those facing issues, please keep testing and reporting -- & don't forget "cs debug".

Here's the first...
[Magisk] Eng.Raman:
Same error.
[Magisk] :
But it's consuming 25MB in the background. I saw an increase in charging time. For the first couple of hours, usually 7% percent battery is charged in 10 minutes. But after running the terminal emulator, this has been increased. I always toggle of Google keyboard and run any lite keyboard in the background to decrease the charging time.
[Magisk] guanto96:
Error
[Magisk] S2_fa_007:
With 12.30-1 my Galaxy S5 reboots again when I plug in the charger :(
[Magisk] VR25:
Odd...

Which Magisk version are you using?

ROM?

MagiskHide status? If ON, does disabling it make any difference?

Are you sure the file /data/.xcs doesn't exist? (Yes, I can be a bit stubborn)

Try installing from TWRP, grab recovery and magisk logs from /cache and upload those here.

Manual mode (on demand, pauses cs service): cs -k 90

Auto mode (ran by cs service): cs 90 89

CS never toggles charging in millisecond intervals. That would be overkill.

The set timeouts are:

- ON > if batt_level is greater or equal to 75%: 25 seconds; else: 60 seconds

- OFF > if batt_level is less or equal to 25%: 25 seconds; else: 60 seconds

Working context

Lets say, your settings are 90 (pause) 89 (resume)

- if the battery is charging and its level is currently at 89%, cs checks every 25 seconds until 90% -- then charging is paused.

- if the battery is discharging and its level is currently at 90%, cs checks every 60 seconds until 89% -- then charging is resumed.

If there were no predefined timeouts, then cs would toggle charging too fast -- which could translate to trouble.

So, you're fine with either cs -k 90 or cs 90 89.

Pro tip: cs -k 40 is like the "lithium ion battery immortal mode" -- best for prolonged usage (i.e., navigation). Battery wear is literally null in that % range. External factors such as temperature and pressure must be taken into account as well, though.

Run cs debug to get a log and upload it here.
[Magisk] abuttino:
Cool. Thanks for the reply. In earlier versions it was going haywire.

Sent from my Pixel 2 XL

---------- Post added at 12:54 PM ---------- Previous post was at 12:48 PM ----------

@VR25 it appears that -d and levels still aren't working. It keeps charging

Edit: Nevermind, it did stop charging

Sent from my Pixel 2 XL
[Magisk] S2_fa_007:
Galaxy S5 klte, magisk 15.1 with magisk hide.

I attached the debug log.

Removed module

touched /data/r, b, x

reinstalled module

did cs -r then cs debug
[Magisk] abuttino:
[MENTION=5228676]VR25[/MENTION] when the display goes off, the settings are gone.

I had this issue when I was using Tasker to disable charging before I got this plugin.

I had to set a display off profile to stop charging if the charge was above some level.

Sent from my Pixel 2 XL
[Magisk] VR25:
Thanks. Try the attached build.

Isn't that related to battery optimization? When you say "settings", do you mean persistent (/data/media/cs/config) or temporary (those used on demand -- i.e., cs -k, cs -e/-d)?
[Magisk] abuttino:
90 80 isn't respected at display off.

Sent from my Pixel 2 XL
[Magisk] S2_fa_007:
Thanks, seems to be working, no reboot so far and no permission denied messages at initialisation :)
[Magisk] VR25:
Your device has 2 distinct charging switches -- charging_enabled & battery_charging_enabled -- or even a third one: input_suspend.

Start by running cs -x, then test whether the issue persists. If it does, run find /sys -type f -name input_suspend 2>/dev/null | grep 'battery/input_suspend'. Alternatively, you can search for "battery/input_suspend" in a debug log file. This shall give you the full path of the third switch, if it exists. Assuming it does, run cs -c /path/to/third/switch and test the "screen OFF issue" once again.
[Magisk] abuttino:
Unfortunately, That didn't fix it

Sent from my Pixel 2 XL
[Magisk] S2_fa_007:
At first the test build was working, but suddenly it stopped charging and I can't get it to charge again.

I attached a log, it's showing discharging, but positive current..

Additionaly if I try cs -d/-e 75% I get a syntax error (made a screenshot).
[Magisk] cantenna:
latest update on magisk repo works great for me on S8+.
[Magisk] junkfactory:
How can I import the generated tasker config into tasker itself? When i try to import i get "failed to import profile data". Anything I am missing?
[Magisk] VR25:
A couple more for you to try:

cs -c /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/step_charging_enabled

cs -c /sys/devices/soc/c1b5000.i2c/i2c-7/7-0008/c1b5000.i2c:qcom,smb138x@8:qcom,smb138x-parallel-slave@1000/power_supply/parallel/charging_enabled

cs -c /sys/devices/soc/c1b5000.i2c/i2c-7/7-0008/c1b5000.i2c:qcom,smb138x@8:qcom,smb138x-parallel-slave@1000/power_supply/parallel/input_suspend

cs -c /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/input_suspend

I'll ease the pain in next releases with a more capable cs -x.

Run cs -x and test again. I'll look at the syntax error.

A "cs %" command will allow you to charge again. If that doesn't work, reboot.

Same as S2_fa_007 -- run cs -x and test again.

You have to disable beginner mode and import the config as a project.
[Magisk] S2_fa_007:
I tried these suggestions before I posted, neither cs -x, cs % nor a reboot changed anything.

The battery symbol shows charging, but it stays and doesn't go up.

In settings and other apps "not charging" is shown :eek:

Edit: Just rebooted with store_mode and now it's loading..
[Magisk] abuttino:
[MENTION=5228676]VR25[/MENTION]

None of those worked the test version you built back around the 22nd for me, was fine. Should I just keep using that?

Sent from my Pixel 2 XL
[Magisk] CyberHawk44:
I using Magisk 15.1, Rom is AOKP 7.1.2 / 2017-12-29 with Prime Kernel 2.1.2

I have try with MagiskHide disable, is the same.

Yes, the file /data/.xcs is real delete^^

And I have it try it in recovery to install, is all the same, ends in a bootloop.
[Magisk] chandr1000:
Newer version still giving reboot on my device (SM-G900H)
[Magisk] NetSoerfer:
Nexus 7 (2013) on LineageOS 14.1-171226-NIGHTLY freezes and reboots when plugging in the charger with Magisk 15.1 and MCS 2017.12.31.

Debug log is attached - I don't know how good it is because I don't know if MCS ever successfully initialised because the device crashes when charging. Let me know if I can do anything else to help.

[edit]by "MCS 2017.12.31" I mean VR25's Magic Charging Switch version 201712310. That's what the debug log is from as well.[/edit]
[Magisk] VR25:
# 2017.12.31 (201712310)]

- General optimizations

- `cs -x` -- pick a different charging switch from the database

- `cs -x /path/to/switch` -- manually set the charging switch; refer to the README for additional info

- Updated charging switches database

**Release Note**

- If charging control is inconsistent, run `cs -x` to pick a different switch from the database.

Still wondering what could be behind the issue...

Perhaps Magisk update?

Anyway, you can stick with that version for now, but try the latest build first.

Try the latest repo build (2017.12.31)

First, install it without /data/.xcs. If it still triggers a bootloop, run touch /data/r /data/.xcs and reinstall.

Install the latest cs version, grab a log and I'll be happy to help you. Please, avoid confusion -- refrain from posting about a different module here.
[Magisk] NetSoerfer:
Sorry, that's actually what I meant. By "MCS" I was referring to "Magic Charging Switch". The attached log is from CS 201712310.
[Magisk] Hanataji:
How to full uninstall this? Before uninstall module phone charge to 70%
[Magisk] VR25:
Oh, my bad!

I checked the log -- crash verbose data is missing -- it seems you ran cs debug twice.

Assuming cs is already installed, proceed exactly as follows:

1. Rename or delete /sbin/.core/img/cs/service.sh

2. Run cs, connect the charger to reproduce the error again

3. After booting, run cs debug and upload the new log

The simplest way to uninstall is installing the same build again.

The other way is uninstalling as a regular Magisk module then manually removing /data/media/cs folder.

If your battery is charging to 70% max even after uninstalling, a reboot or two may fix the issue.
[Magisk] CyberHawk44:
Now I have not anymore bootloops :)

I have it install without touch /data/r /data/.xcs and boot normally :)
[Magisk] NetSoerfer:
I did actually run it twice, didn't realize that's a problem.

It's not installed anymore, so I'll install it again, check that /sbin/.core/img/cs/service.sh doesn't exist, and the proceed with 2. and 3.

I'll attach the log to this message.

/edit: done.
[Magisk] m.zielinski:
Samsung A5 (2017) A520F not supported

Samsung A5 2017

A520F Stock Nougat Rom 7.0
[Magisk] Sagittarius199x:
My Xperia Z5 android 7.1.1 support but it do not stop charging
[Magisk] abuttino:
[MENTION=5228676]VR25[/MENTION]

cs -t makes profiles that are not importable to Tasker.

Sent from my Pixel 2 XL
[Magisk] VR25:
Alright, now proceed as follows:

1. Open /sbin/.core/img/cs/config/switches and remove or comment out the entire "# EXPERIMENTAL" block

2. Test whether system still reboots when the charger is connected

You're using an old version. Install the latest build and try again.

Run cs -x and test each available charging switch.

It creates a project, not simply a profile. You have to disable Tasker's beginner mode to be able import the config -- as a project.
[Magisk] abuttino:
That's what I meant. Project

Sent from my Pixel 2 XL
[Magisk] Sagittarius199x:
I have tried but still have same problems
[Magisk] VR25:
I'll have to test that again.

Have you tested with screen ON?

Also, about cs -d -- doesn't it make charging stop?
[Magisk] NetSoerfer:
I did. The Nexus 7 doesn't freeze/reboot anymore, but it gets stuck on "- Waiting for charger..." now. The terminal UI and Android remain responsive though.

I'll attach a new debug log in a minute, Tapatalk doesn't allow attaching .log files to XDA posts

/edit: done.
[Magisk] VR25:
As per the log, battery is currently full -- cs is actually waiting for "charging" status. When battery power drops a bit, test again.
[Magisk] bombername:
Nice work, thankso so far! ?

Is it normal that the system shows "charging" in the settings, when cs reached its level e.g. 85% ?

Regards
[Magisk] NetSoerfer:
Haha, now it's just being difficult :D

It works, shows up as an unsupported device with experimental commented out.
[Magisk] VR25:
Smiles everywhere, or is it just me? ?

It may be normal... or perhaps your device is pumped for the new year.

Anyway, does cs -i show "charging" as well?

If charging doesn't actually stop, try cs -x and test all the available switches.

Lol, for me that's WAY better than forced reboots. Now I'm even closer to the ultimate answer. Will keep you posted.

Everyone -- happy new year!
[Magisk] Sagittarius199x:
I tested with screen On and screen Off, but the problem still exists

I tried cs -d it make charging stop
[Magisk] VR25:
Ok, pause service (cs -s) then run in manual mode -- i.e., cs 90 89. Does that make charging stop?
[Magisk] Sreekantt:
Seems like cs service causing battery drain -constantly running on cpu. I'm hardly getting 1 hour of sot with 4 hrs of standby time in between 83% and 43% battery
[Magisk] cantenna:
Really? I camt seembto find it at all under better battery stats?
[Magisk] Sagittarius199x:
Yes, that make charging stop when reach 90%
[Magisk] VR25:
I don't have this issue.

There's really nothing heavy about cs service. If your CPU is constantly being pushed, then there's something going on with Magisk itself. Upload your /data/adb/magisk_debug.log.

Ok, run the following commands:

1) su

2) sed -i 's/(cs service)/cs service/' /sbin/.core/img/cs/service.sh

3) chmod 755 /sbin/.core/img/cs/service.sh

Reboot and test whether cs service controls charging properly.
[Magisk] Sagittarius199x:
I tried but dont work :(
[Magisk] Sreekantt:
Seems like a reboot fixed the issue. However, heres a magisk log if that helps
[Magisk] jfet:
latest cs module seems to working on open beta 3 of oneplus5.

after a error " can't create .. " i decided to create "cs" folder in path: /data/media and now cs service working fine :)

[IMG="1screen"]https://image.prntscr.com/image/y8Jz6iQ_RYOUApIkLxxkEg.jpg[/IMG]

[IMG="2screen"]https://image.prntscr.com/image/bH7ap_EQQrGJgFfogPM2Kw.jpg[/IMG]
[Magisk] bombername:
Wat do you think?

Is 0 or 1 for yes?
[Magisk] locuturus:
My Pixel C appears to be unsupported, attaching the debug file. Happy New Year!
[Magisk] chandr1000:
cs service cause charging process to be longer.

disabling it will solve this problem.
[Magisk] VR25:
1, but in regards to the switch you're currently using. If one is set to zero and the other to 1 -- 1 wins.

As per the debug data provided, you're using an old version. Recent builds have a new log format. Please update and test again.

Hmmm...

REPORT

It seems on some devices, recent Magisk versions, namely 15+ have trouble keeping cs service running. Would be great if someone could test that. I don't have the issue nor a way to reproduce it. Just note that you may or may not be able to directly downgrade Magisk. Uninstalling with the official Magisk uninstaller, then reinstaling is the best way to go. Keep in mind though -- you must backup magisk.img before proceeding; template 1500 is not backwards copatible with Magisk versions older than 15 (cs won't install).
[Magisk] underskyzx:
No UI?
[Magisk] guest4711:
See post#1: The ui -if needed- is the unix shell. There is no GUI.
[Magisk] xtam:
[MENTION=5228676]VR25[/MENTION]

phone from my signature, magixsk 15.2 newest available CS, i have higher limits- 80 lower=70 but today my phone was loaded to 90. why?

attached debug log.
[Magisk] VR25:
Read the third post above yours. I'm investigating the issue further and looking for a solution. Stay tuned.
[Magisk] locuturus:
Hmm, I grabbed an old zip file next to the new log file. My mistake.
[Magisk] abuttino:
[MENTION=5228676]VR25[/MENTION]

That Tasker issue was user error. I forgot the percentages after it.

Sent from my Pixel 2 XL
[Magisk] piptron:
Cant seem to make the latest build work , how can I upload an attachment in desktop mode? tried google and said there is a "Manage attachments" below the message box but there isn't. Please help thanks :)
[Magisk] alextytan:
freezing

happy new year everyone,

my leeco le1s x500 freezes when i plug in the charger, after installing the last module.

unplugging, rebooting, cs -x replugging, freezing again.
[Magisk] dbGHOST:
Was using Tasker to set the limit before, but somehow stopped working last month. (Not sure after which update, but it charged over limit)

Grabbed 12.31 and it says unsupported. I attach the log and could you please take a look?
[Magisk] aryanking01:
Hello

I am having a little trouble here. Whenever I try anything. It says cs must run as root. I have attached the screenshot. And also, what is the default value of battery percentage for which it disables charging?

Thanks:)
[Magisk] aryanking01:
Hello

I have a little problem here. It is showing me that cs must run as root. Please help. Thanks:)
[Magisk] S2_fa_007:
Please don't post twice, there's an edit button :)

The su command isn't found on your device, if you're sure magisk is correctly installed and other apps can run as root, try "/sbin/su".

Best regards

Sent by OnePlus 5 with Tapatalk
[Magisk] JackieMe:
I have to run cs -d or my phone won't get charged, it that normal.

I installed the module from magisk repo. I rebooted, opened a terminal and ran:

```

su -

cs 96 80

```

hoping that phone will get charged at 80% lower and stop at 96%. But when phone is at, say 15% and I plugged in but charge won' start. I have to open a terminal and run

```

su -

cs -d

```

But is it meant to stop cs from working?

After that I ran cs -i and I got this(see pic attaced).

I am using OnePlus 3T, Oxygen OS 5.0.1, Android 8.0.0.
[Magisk] AlexBurnout77:
How's the update for Magisk 15 going?
[Magisk] VR25:
For Those Who Can't Wait...

- Backwards compatible with Magisk versions older than 15, suporting template v4+

- Extended (loops) verbose -- toggle: `cs -v`

- Minor optimizations

- Updated charging switches database -- hang/reboot upon charger connection possibly fixed

Notes on Magisk v15+

- For some, still unknown reason, Magisk daemon fails to run cs (or keep it running) on some devices.

- Battery drain is also a concern -- currently collecting more data for a verdict.

- If you're downgrading Magisk, remove ALL traces of it -- by that, I mean /data/adb/* before instaling cs.

- If you have an app that can run scripts on boot, you could try "(cs service) &".
[Magisk] locuturus:
My last post was about Pixel C, but this one is about the Nexus 10. Unsupported device etc, log is attached.
[Magisk] aryanking01:
Thanks. It worked. And I am sorry I thought that the first post failed to upload. Farewell!
[Magisk] VR25:
That should be easy to fix. As for the Pixel C, unfortunately there's not much hope. I found no control file for it. I'm afraid a custom kernel with proper support for that is needed. The same applies to many of the incompatible devices. [MENTION=2056205]NetSoerfer[/MENTION], Nexus 7 is one of those.

Back to the Nexus 10, if you don't want to wait for the next build, set UEVENT=/sys/devices/platform/s3c2440-i2c.2/i2c-2/2-0006/power_supply/smb347-battery/uevent and SWITCH=/sys/devices/virtual/power_supply/manta-battery/charge_enabled in /data/media/cs/config.
[Magisk] Robula:
Thank you for this mod, its great having more power to control when and how much my battery is charged. I am however experiencing quite a significant issue that may be related to this module.

I have witnessed extreme battery drain whilst using this so I decided to install WLD to find out why. The only thing I did with this module is run `cs 60 40` as SU and then rebooted.

Some information first:

- Nexus 6P (angler)

- Stock Oreo 8.1.0 OPM1.171019.011

- ElementalX 6.01 Kernel

- Magisk 15.2

- Magic CS 2017.12.31

I've attached a screenshot with the WLD Kernel page. Any help and suggestions would be great.

Many rhanks! ?✌️
[Magisk] piptron:
Please support my device
[Magisk] Arav Singh:
In my moto m... When i run command cs after su it says cs must run as root but my device is already rooted
[Magisk] :
Can anyone running this on a Pixel 2 XL 8.1 confirm if they have it working for them?
[Magisk] Sreekantt:
Latest build not supported bro on Honor 6x ...here is the log
[Magisk] VR25:
A week has passed since the last release preview. Been quite busy.

If everything goes smoothly today, I'll push another preview -- or even a stable release tonight (GMT +1). It'll bring more fixes, extended device support & compatibility with all Magisk versions.

Speaking of Magisk, 15.3 may have the script execution fix needed to properly run cs.
[Magisk] aztec.empire:
Device not supported

Hello, my device is not supported. I'm using a huawei p8 lite with DotOs as daily driver. Don't know how to upload the log file :crying: I don't se any option for attachments. Help please!!!

https://mega.nz/#!ZVFHSQxJ!Srch81mnfLb6RiqgNrxuxleV0AnR58ev6s0MhM2f9DU
[Magisk] AlexBurnout77:
I wish you happy coding!
[Magisk] piptron:
[MENTION=225651]op[/MENTION] Thanks for this wonderful module but my device is still unsupported. Using latest magisk and your latest update.
[Magisk] Arav Singh:
How to fix this...?it shows same error again and again...

https://drive.google.com/file/d/1_JTYihR0ZTXmexJK-fmorxEV0Q7ORtWL/view?usp=drivesdk
[Magisk] twist3d0n3:
Had high cpu usage (30-40%) with cs running, had to remove it I'm afraid..
[Magisk] VR25:
You're welcome. I'll soon finish analysing your debugging data.

Is that the latest build (2018.1.13)?

As previously stated, I'm afraid Magisk v15+ may be the actual culprit. Will have to test more and see.
[Magisk] twist3d0n3:
Ah ok, must've missed you saying that. Thanks for plugging. On man, really appreciated!
[Magisk] faztmob:
Magisk 15.3 error run cs
[Magisk] Arav Singh:
Yess
[Magisk] VR25:
Have you tried Magisk v14.6 or even 14.0 yet?

What kind of error is that? Please specify.

Ok, could you tell me the output of the following commands?...

whoami

id

id -u

id -n

id -un
[Magisk] Arav Singh:
Ok, could you tell me the output of the following commands?...

whoami

id

id -u

id -n

id -un[/QUOTE]Output ss attached:- https://drive.google.com/file/d/11A8z5qTHFh5_hXkF4fDuJCgOTuoAYB2z/view?usp=drivesdk
[Magisk] SquirrelCmD:
Hi, thanks for that module, worked well on an older firmware, after update, it doesn't work anymore...

Regards
[Magisk] faztmob:
Error like this.
[Magisk] NetSoerfer:
Okay, that's a shame. I have attached a new log anyway, hope dies last [emoji4]

What exactly would a kernel have to provide? Are there any such kernels out there that you know of?

Gesendet von meinem Nexus 7 mit Tapatalk
[Magisk] Arav Singh:
Same error i got... When i run command cs (after su)[emoji22]
[Magisk] alextytan:
not working

attaching log. with magisk v.15.3 and manager 5.5.5
[Magisk] VR25:
Those facing "cs must run as root" issue, try the attached zip.

Warning: run touch /data/r before installing -- or else, cs will self-uninstall, as this is the same version you have installed.

[MENTION=2056205]NetSoerfer[/MENTION], I think I've read somewhere about such a kernel (or at least a potential solution). Will provide the link to the thread soon.
[Magisk] Arav Singh:
Tried runing touch /data/r then installed cs_test.zip still got same error "cs must run as root"
[Magisk] psychoela:
Ar you using O? [MENTION=5228676]VR25[/MENTION] i have same issue with oreo,and working perfect with N same device :silly:
[Magisk] Arav Singh:
Nope im using N
[Magisk] VR25:
Try the new zip.

Running touch /data/r prior to installing is no longer necessary.
[Magisk] Arav Singh:
This time i got unsupported device error...

Here is the log https://drive.google.com/file/d/1RdEs0dAosi28zsoEJVktLuKLBiYYPDrF/view?usp=drivesdk
[Magisk] faztmob:
"cs must run as root" fixed with this zip file.

Thanks.

Before install zip file, I am running touch /data/r, is it no problem?

RR final build official.
[Magisk] puhu:
On my device support but i dont understand completely how to use this module. Just i did command in terminal emulator "cs 90 80" then using now but what it will give me? Can you help me for understand? [MENTION=5228676]VR25[/MENTION]

MI 5 cihazımdan Tapatalk kullanılarak gönderildi
[Magisk] S2_fa_007:
Your device will charge if it's under (or at) 80% until 90%.

Sent by OnePlus 5 with Tapatalk