yashsingh1/xdaforums huggingface dataset:
[Magisk] mistermojorizin:
waited more than 120 secs and then did this, mcc didn't respond for a few more minutes, but finally got it started. go daemon started. doesn't switch off charging. said reboot. I reboot. daemon again not on. did this procedure again. daemon started, charging not switching off. I don't think I'm getting anywhere.

taimen:/ $ mcc --info
/system/bin/sh: mcc: can't execute: Permission denied
126|taimen:/ $ which mcc
/system/bin/mcc
taimen:/ $ mcc --info
taimen:/ $ mcc --info
taimen:/ $ su
taimen:/ # mcc --info
taimen:/ # INFO: Reconfiguring (low_level)...
- Done
WARNING: A reboot is recommended for now
Battery Information

- Level : 84
- Health: Good
- Status: Charging

Current Settings

- Auto Switch thresholds: 80, 70
- Auto Power threshold : 20
- Auto Switch status: ON
- Auto Power status : ON

Daemon Status: Not running

taimen:/ # mcc --redaemon
taimen:/ # INFO: Reconfiguring (low_level)...
- Done
WARNING: A reboot is recommended for now

taimen:/ # mcc --info
taimen:/ # INFO: Reconfiguring (low_level)...
- Done
WARNING: A reboot is recommended for now
Battery Information

- Level : 85
- Health: Good
- Status: Charging

Current Settings

- Auto Switch thresholds: 80, 70
- Auto Power threshold : 20
- Auto Switch status: ON
- Auto Power status : ON

Daemon Status: Running
[Magisk] nogaff:
Same here. Charging isn't switching off even though the daemon is now running.

Also, running "mcc --switch 85" gives me "FATAL ERROR: 85 does not belong to 20-85" so I have to set it to 84. I guess your -le and -ge in is_belonging() need to be -lt and -gt instead ;)
[Magisk] MArtyChubbs:
I am on P2XL and had to go back to Magisk 16.0 for it to work... Happy now
[Magisk] Jaymin.0.1910:
Hello guys,

For the daemon not running, as [MENTION=4576054]MArtyChubbs[/MENTION] said, there is a problem with the beta Magisk, the beta Magisk does not add Magic Mounted system to the PATH for service.sh boot script, rather it adds the mirrors ones. I have already reported about it to [MENTION=4470081]topjohnwu[/MENTION]. So, I suggest staying with stable Magisk until [MENTION=4470081]topjohnwu[/MENTION] fixes that.

[MENTION=6328144]nogaff[/MENTION], I know about it, I don't want to include 0 and 100 when calling is_bounded(), so I did that. But I will fix that soon.

Also, for the charging not switching OFF issues, can you attach log files from /sbin/.core/img/mcc/log/ directory ??

Regards.

EDIT: The next build will support Magisk betas properly :)
[Magisk] PsyCl0ne:
Hey JayminSuthar,

Appreciate you trying to find out what is going on.

I am not running the beta magisk at least I don't think I am. I have attached the entire mcc log folder to this post.
[Magisk] Jaymin.0.1910:
I can't see the folder attached, please do that so that I can find out the reason.

Regards.
[Magisk] PsyCl0ne:
Did this work? I'm mobile right now and tapatalk, official xda app, and Chrome are all giving me issues trying to attach the zip file...
[Magisk] neekless:
Did you do this when your phone is charging (aka plugged in)? I got this same error when I didn't plug in but after plugging in I didn't get this error anymore.

[MENTION=8570610]JayminSuthar[/MENTION] regarding the above, if seems that every command now reconfigures mcc? So we have to plug in if we want to do any command, even mcc --info. In the old version it only requires plug in once and I could do mcc -i or even mcc -s 80 70 after unplugging. Now if we do anything while unplugged we will get the FATAL ERROR: Failed to reconfigure it message. 100% reproducible.
[Magisk] PsyCl0ne:
Hey needless,

I don't remember but I think I tried both mostly because my phone was almost dead and I really wanted to get the charging control going.

Thanks for reaching out.
[Magisk] Jaymin.0.1910:
It seems like there was some internal error, can you try it at around 40-50% battery and charging ON ??

I'm aware of the issue, and I need logs for that. Can you run just 'mcc --info' and attach log folder afterwards ??

It might not work if the phone was almost at the limit, see my quote above.

Regards.

EDIT: [MENTION=6014314]neekless[/MENTION], Please try the attached build.
[Magisk] rcbjr2:
Neekless, were you able to get this to work on your OnePlus 6? I was trying to see if this would work in lieu of the XDA Battery Charge Limit app, which only works sporadically on the OP6. I don't think I entered the commands correct. The first time I got an error stating that MCC didn't exist (I'm using Termux). Then I thought I saw the configuration # mcc -disable 90% some (i.e., adding the # in front) and Termux took this command without objection, but it's not working to stop charging at 90%. It just quickly went up to 90%. Am I entering the commands incorrectly or what? Thanks!
[Magisk] neekless:
I don't have a Oneplus 6 I have a nexus 6p.

What do you mean adding the # in front? Did you type in # yourself? You're supposed to use su.

I haven't tested 1.0.1 yet, but on 1.0 I couldn't get it to stop charging too.

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

I flashed 1.0.1 from the repo and can confirm it doesn't reconfigure all the time anymore, and works when unplugged. However it's still not stopping charging at my set percentage. Will send you the log when I have time.
[Magisk] rcbjr2:
Sorry. Thought I read somewhere that you had OP6. I used to have a Nexus 6P and the XDA app Battery Charge Limit worked great on the 6P. It works intermittently on the OP6. At first I didn't know I needed to use SU but I figured that out. I think the commands stopped charging at all, even below the limit I set. I reverted to Battery Charge Limit and that seemed to fix everything. Anyway, I don't think this works well on an OP6 but I'll keep testing when I get a chance after the next few days of busyness. Thx.
[Magisk] Jaymin.0.1910:
There was a bug that prevented mcc from recognizing control references, please try 1.0.1 which fixes that bug.

This issue existed in the Original version and was fixed then, please send me logs to have a fix for the "Redefined" series.

Please be sure to test it out.

Regards.
[Magisk] Jaymin.0.1910:
Hey, power-off you experienced is not related to whether charging or not, AND I HAVE FOUND OUT WHY it happens and added some code ( the next version ) to prevent this, even though if the same happen again, you should stay away from this module
[Magisk] cheveguerra:
Sure, here it is.

Best Regards
[Magisk] Jaymin.0.1910:
Fixed with the next update... but will be pushed on around 10th of Feb, my brother is getting married BTW
[Magisk] cheveguerra:
Congratulations for your brother!! :good:
[Magisk] Jaymin.0.1910:
Thanks:o
[Magisk] Jaymin.0.1910:
Until then, your device seem to have original Magisk binaries / images / dbs backed up at /data/data/._cwm_restore/data/adb, try to remove that and mcc, I think will work...
[Magisk] tkhquang:
Hi, great module, I have it to stop charging at 80%, but I see that it always stops at 81-83%. I just have no idea if this is normal or not, no complaining at all ?
[Magisk] rayparlour:
On my OP5 Oreo magisk 15.3 installation fails, it tells me to make sure im charging then states checking compatibility and then my phone shuts off
[Magisk] Jaymin.0.1910:
I performs it with accuracy of 10 seconds, but it requires about 7MB of RAM for the entire environment, that might be the issue....

The next version includes a better environment setup, which is likely to improve RAM usage
[Magisk] Jaymin.0.1910:
This issue has been identified and fixed with the next update, but even though your device shuts OFF, you should stay away from the module
[Magisk] sam613:
Hi

I set mcc 85 65, and consider it will not start to charge until battery is below 65%. Is that correct?

However, I plug when battery is 75%, it start to charge.
[Magisk] Jaymin.0.1910:
No, mcc 85 65 means charging will be disabled when level goes 85 and resumed if level is equal to 65, 65 will only work ( as you suppose ) if 85 has been hit or you have manually ran mcc --disable
[Magisk] rms112:
Everything working nice except this. I had MCC 80 70. Battery stopped charging after 80 which is OK. I unplugged charger. After better fell below 70, it automatically showed charging symbol and says battery is charging( charger was unplugged)
[Magisk] Jaymin.0.1910:
Weird, would you mind some debugging about the issue ??
[Magisk] rms112:
And how would I do that? Sorry I am new to magisk so don't really know much. Should I attach magisk logs or logcat?

Edit: magisk log just in case. This is exactly after the "bug" happened.
[Magisk] Jaymin.0.1910:
Hey, I should assist you via PM and try to make the bug go away, this is how I recently fixed a critical bug with never resuming charging with some typical kernels ( mostly HTC ), is it OK ???
[Magisk] rms112:
Of course!
[Magisk] priantomo:
Is it okey if i run this module with amplify?
[Magisk] Jaymin.0.1910:
Haven't tested, but there is nothing that would conflict with Amplify, so it'd be OK
[Magisk] Jaymin.0.1910:
Announcement

Hi all users,

Two new features have been introduced with recent versions

[ --ckservice ]

Daemon will test current

Both of these features are working perfectly on my Le Max 2 and [MENTION=7330585]CCL108XIV[/MENTION]'s HTC One M9, but they are quite hard features to be implemented in a shell script and I'm using a simple trick to make it happen, so if any of y'all users, experience any issues relating these both, please report that here with full details and also provide /sbin/.core/img/mcc/cache/verbose.log if it's the [ --ckservice ] one
[Magisk] neekless:
Will send logs after work.
[Magisk] neekless:
These are my logs after I rebooted my phone and went to terminal and typed mcc --info to verify that the daemon was running. Is this enough? Or do you need logs when the battery level goes beyond the upper limit?
[Magisk] Jaymin.0.1910:
Can you try the --disable option and see if that works ?? Will you mind some debugging ??
[Magisk] .:Addicted:.:
"mcc --switch 85 80" this will charge until 85% n stop until 80% then again in a loop

But what doea "mcc --power 20" does?

[MENTION=8570610]JayminSuthar[/MENTION]

Edit1:. It's running but not stopping battery charging.
[Magisk] neekless:
Tried mcc --disable 10s. Didn't work, charging continued. Logs attached.
[Magisk] Deus.:
Hi,

I would like to report a bug, I set an upper limit for charging to 80% and my phone, a Xiaomi Redmi 4 prime got charged to 100% this morning. The - -info reported that the daemon is running, the switch is ON.
[Magisk] Jaymin.0.1910:
It will power off the device when battery level goes below 20 percents.

[MENTION=6014314]neekless[/MENTION], [MENTION=252677]deus[/MENTION], can you please run --cleanup and then mcc --launch-daemon when the battery level is above 'thr_disable' and then send me logs.

Regards.

EDIT: Found the reason after a heavy debugging on my phone, it will be fixed soon :)
[Magisk] neekless:
Tried 1.0.2 from the repo. Now daemon doesn't run after reboot. --redaemon and --launch-daemon does nothing. Logs attached.
[Magisk] Jaymin.0.1910:
Turns out to be a BusyBox setup issue, can you run

/sbin/,core/img/mcc/bin/busybox --install /sbin/.core/img/mcc/bin/

from a terminal ??

Regards.
[Magisk] neekless:
This is the output

angler:/ $ su
angler:/ # /sbin/.core/img/mcc/bin/busybox --install /sbin/.core/img/mcc/bin/
sh: /sbin/.core/img/mcc/bin/busybox: not executable: 32-bit ELF file
1|angler:/ #
[Magisk] Jaymin.0.1910:
This shouldn't happen, have you got the correct BusyBox binary, please run

file /sbin/.core/img/mcc/bin/busybox

and post the output.

EDIT: Can you install the BusyBox module by [MENTION=4544860]osm0sis[/MENTION] ??
[Magisk] neekless:
But why? How come the previous versions can work without installing my own busybox? Especially before the redefined version, the charging stops properly at my set limit and I didn't have to install any busybox module.

Edit: I looked through the module zips for the old 2.0 and the redefined 1.0.2. It seems in the old zip you didn't provide busybox binaries but it worked properly. In the new zip you provided your own busybox binaries and it doesn't work. Maybe you are not giving the correct binaries. Why not just use the busybox that comes with magisk just like the old mcc?
[Magisk] Jaymin.0.1910:
BusyBox is required to make mcc clean as possible for those who study the code and speed up execution. I personally wish to use the Magisk provided BusyBox, but the Redefined mcc supports system installations as well which require a BusyBox binary be provided. So, I have provided the BusyBox binaries built by [MENTION=4544860]osm0sis[/MENTION]. And I just want to figure out is it a problem with mcc or a bug with the BusyBox itself. So can you install the BusyBox module by [MENTION=4544860]osm0sis[/MENTION] from Magisk Manager and see if that works correctly ?

Regards.
[Magisk] neekless:
Installed the busybox module. Not working.

angler:/ $ su
angler:/ # mcc --info
angler:/ # Battery Information

- Level : 42
- Health: Good
- Status: Charging

Current Settings

- Auto Switch thresholds: 80, 70
- Auto Power threshold : 20
- Auto Switch status : ON
- Auto Power status : ON

Daemon Status: Not running

mcc --redaemon
angler:/ # mcc --launch-daemon
angler:/ # mcc --info
angler:/ # Battery Information

- Level : 42
- Health: Good
- Status: Charging

Current Settings

- Auto Switch thresholds: 80, 70
- Auto Power threshold : 20
- Auto Switch status : ON
- Auto Power status : ON

Daemon Status: Not running

Edit: I think I will just go back to the old 2.0 version since that works well for me and I don't have to install any extra modules. Good luck with the redefine.
[Magisk] Jaymin.0.1910:
Can you execute busybox from the Terminal ?

EDIT: Found one more small bug.
[Magisk] ToXiTe:
Beautiful! Always wanted such functionality in smartphones.
[Magisk] karim-ps:
Great solution. Any plans to make an accompanying app, it would be perfect.

Thank you
[Magisk] Jaymin.0.1910:
I planned about it previously, but this heavy college work is taking away all my free time.

Regards.
[Magisk] McGrady:
Hi,

I think this is exactly the function I've been looking for for a few days!

Unfortunately the installation doesn't work on my Xiaomi Mi Mix 2S. Runs on xiaomi.eu - Rom. Here's the log:

Can you help me?
[Magisk] Jaymin.0.1910:
Sure, did you flash from recovery or Magisk Manager ?? Which recovery do you have ??
[Magisk] McGrady:
I want to install it with Magisk. See the Screenrecording at attachment
[Magisk] Jaymin.0.1910:
Fixed with the next release :o
[Magisk] MrMagicPotato:
It doesn't install on my Pixel 2 XL.

I'm on 8.1 July Stable.

I'll attach the log from the magisk installer.

As it shows in the image that I also attached, there's only an "Installation Failed" message with no specifications on the error.

Thanks for the support [MENTION=8570610]JayminSuthar[/MENTION] :fingers-crossed:
[Magisk] Jaymin.0.1910:
Fix pushed to the Magisk Repo, update though the Manager or recovery.
[Magisk] Fun_GKC:
It still fails to install. Tried using the Manager and recovery
[Magisk] Jaymin.0.1910:
Weird, can you try from recovery and provide logs ?? Both recovery logs and /dev/mcc_install.log.

Everyone else facing the bug, please provide me recovery logs after occurring failure. I can't reproduce the issue as I don't (currently) have a device to test.
[Magisk] Fun_GKC:
There you go, tks.
[Magisk] Jaymin.0.1910:
Hey, thanks for the logs. Turns out to be a freaking unzip error. I had pushed a fix for that.

Best regards.
[Magisk] Fun_GKC:
Run into the same problem again.
[Magisk] Jaymin.0.1910:
There was some merge conflicts in the git setup, please redownload the zip and try again. The version name should now be 1.1.2 instead of 1.1.1.MR.
[Magisk] ToXiTe:
There seems to be some problem with initialization of the module. The root directory of mcc folder has only blank files.

Attached Magisk log.
[Magisk] Jaymin.0.1910:
Can you also please attach mcc_install.log ?? That's the log which show how the install went.

Best regards.

EDIT: It seems like a bug with Magisk failing to merge images when more than one images are present. Can you provide aforementioned logs ??
[Magisk] ToXiTe:
Attached install log.
[Magisk] Jaymin.0.1910:
The Magisk.img is not getting mounted read-write properly or is full. Can you try to resize that image in recovery mode (run resize2fs /data/adb/magisk.img {NEW_SIZE}M ?? Also check whether you're able to create and write to a file in /sbin/.core/img folder (using a file explorer).
[Magisk] ToXiTe:
I resized it to 128M in recovery but it still becomes 64M when I boot.

I tried copying the files manually before but they only copy as 0 bytes. Copying through terminal gives No space error. I installed another module from Magisk and it got installed perfectly. I even installed v1.0.2 of this module and it too got installed perfectly. Note that only the files in root of mcc directory are 0 bytes but the files in it's subdirectories are normal. Even copying the files to it's subdirectories work normally.
[Magisk] Jaymin.0.1910:
Hmm...:confused: In that case, what are the permissions and context of mcc directory ??
[Magisk] ToXiTe:
Permissions are 0755. I have attached the log from the installation of 1.0.2 after modifying the installer script to output log. Maybe you can compare it with the previous log of v1.1.3.
[Magisk] Jaymin.0.1910:
I checked out the logs, the only thing that matters is BusyBox breaking

cp

. Can you run the attached script and send me /cache/mcc_debug.log file ??

Thanks.
[Magisk] freeza:
Anyone get this working on a kirin 970 powered device?
[Magisk] McGrady:
Hello,

install with magisk-app now no problem. See the log

View attachment mcc_install.log

But i cant config..Think it's me. :o

After i Restart my Phone i go to terminal emulator and set "su" and that "mcc --config" or "mcc --help" but the System says "Error: Internal error occured, please report."

i forget any command?
[Magisk] Jaymin.0.1910:
It was previously (the old version of it) reported as working with Kirin 970.

Please check whether BusyBox is correctly installed in mcc_dir/bin folder. If no applets but BusyBox exists, run the following command to install it. You will also have to start the mcc daemon manually using [--ckdaemon].

EDIT: I think I found the culprit. Can you try the attached build ??

Best regards.
[Magisk] ToXiTe:
Attached log. Note that I deleted bin folder before running the script as it was trying to print the content of all those applets and exponentially increasing in size.
[Magisk] Jaymin.0.1910:
I think I figured it out. Please test the build from the previous post of mine :)
[Magisk] papoy1019:
Still the same "Internal Error Occured. Please Report" :(
[Magisk] Jaymin.0.1910:
I'm investigating this, currently I've reverted the install method to the one from last working build. Something is broken with the new method.

Those are hardlinks, they wouldn't take any space. I didn't symlink applets due to some issues with them. But let me test symlinks again. Thanks for your investigation :good:

EDIT: Guys, please try following builds and tell me whether which or none of them work for you.
[Magisk] ToXiTe:
They are actually taking 54.5MB of space. After deleting them I was able to copy and replace the files from the zip too.

mcc-sym.zip is installing properly but the symlinks are all blank and mcc is not found in terminal. The other zip has the old problem.
[Magisk] Jaymin.0.1910:
mcc is not found :confused: Can you provide install logs for mcc-sym.zip and also, are busybox and mcc script placed correctly in magisk.img ??
[Magisk] ToXiTe:
BusyBox and mcc are scripts are there in proper places. It's that this installation breaks the Magisk's mirroring function altogether, i.e. every module is broken. Also the symlinks point to the original directory in /dev which no longer exists hence they are blank.

EDIT: Turns out the broken mirror fuctionality is because of "sleep" in post-fs-data.sh file. You should keep it in service.sh as before.

I ran the busybox install command manually after moving the parts from post-fs-data.sh to service.sh. It is working now.
[Magisk] Jaymin.0.1910:
I fixed the broken symlinks. Did everything else work well ?? I mean, were you able to call mcc from a terminal ??

EDIT: If you move "sleep" to service.sh, can you use hardlinks for BusyBox ??
[Magisk] ToXiTe:
Yeah, mcc works after moving those parts. But I think there is a problem with the testing condition in config because although it properly switches charging off and on while it is running the config, it still continues to scan for uevent and switch paths and then fails. Attached the log after running config. Actual switch path is /sys/class/power_supply/battery/input_suspend.

Hardlinks basically eat up all the space, that causes a separate issue altogether which is different from the one caused by "sleep". The reason it showed up after switching from hardlink to sysmlink because post-fs-data.sh file used to be blank before due to lack of space.
[Magisk] Jaymin.0.1910:
Hardlinks shouldn't eat up any space, they are just a reference to the original busybox binary. Can you try removing symlinks and hardlinking applets and see if mcc works ?? I will soon analyze your logs and get back to you.

EDIT: The issue with the configurator is caused by "sed" in busybox, which didn't edit mcc.conf to fail the config.

EDIT2: Can you please attach the Magisk internal BusyBox ?? I currently don't have a device to extract that from:(
[Magisk] ToXiTe:
Hmm, the hardlinks are working now without taking space.

Attached BusyBox.
[Magisk] Pipodi93:
Is the "internal error" problem fixed? Because I've just installed this from Magisk repo but I still have that problem.

EDIT: I have an update on Magisk, but it seems that it's not installing that update. As you can see from the screenshots below, Magisk sees that there's an update, I install it, but when the phone boots up, the update is still there.

In the other screen, the module informations are not shown correctly.
[Magisk] ToXiTe:
You need to do clean install to fix Internal error. Delete old module, restart and then install.

EDIT: This update doesn't seem to be the one with the fix. You have to wait.
[Magisk] Pipodi93:
Ok, I'll wait then!
[Magisk] Jaymin.0.1910:
Development update!

Hello guys,

I am aware of some bugs like the 'internal error', etc... All bugs are fixed (huge thanks to [MENTION=6339129]ToXiTe[/MENTION]) in my local copy and also the beta branch of the GitHub Repo. It's just that, I am currently taking a little effort to redefine (again) it to have a modular designation, so that further updates to the project can be easily implemented without any refactor, redefine, etc... And yeah, I'm in the college 1st year, so currently running busy over excitement for the fresher's party :cowboy:. So, it might be late, but it surely will make to the official repo once I'm done all the testing (and [MENTION=6339129]ToXiTe[/MENTION] has been a great help for me). I recommend using an older version until the newer build is released, I hope y'all understand.

Best regards,

Jaymin.

EDIT: I just rewrote a minor portion of blex (Name changed: Battery Life Extender (blex)). It was fun how I could implement a modular interface just to ease out the pain of merging. I'm really happy at what state is the project right now, and all because of your support! Thank you, guys :)
[Magisk] stewie-droid:
Which zip should we used that fixed the issue?

I tried latest	mcc-Redefined 1.1.3-201808101-stable-signed.zip and got boot loop. had to remove the package from magisk.

Also i couldn't find mcc under /data/adb as there was no mcc folder. couldn't execute mmc --config either under root either as under /data/adb/mcc is not found.

Thoughts?
[Magisk] Jaymin.0.1910:
As you have Magisk, you don't need to see /data/adb/mcc. That location is used only when installing in system mode (actually modifying system). The latest zip released is buggy, so please do not use use that, check for 2 or 3 previous releases (they worked nice). I have fixed all the bugs, but due to a major refactor/reconstruction of the project as 'Battery Life Extender (blex)', I couldn't release that, but the first release is just a couple of days away I guess :D

Best regards.