yashsingh1/xdaforums huggingface dataset:
[Magisk] Jaymin.0.1910:
We're not competitors, we used to develop together MCS. And the idea "plug in charger to set the mod up" was originally mine. We both did well, but you know, every programmer has their own coding style, we had too, So we split our own methods in two different mods.

BTW, It's not so good for a developer to discourage other developer's work. Please do NOT post further stuff here.

Yo for the feedback, I will fine tune the switching operations.

Appreciate feedback, I'm working on to prevent it. Stay tuned:).

You got a +1 respect from me.:good:

I know of this, and maybe a fix will be on the move.

No, It is. I pushed an update with this fixed.

Maybe I can help you get 2.0.MR working there!!

EDIT: The algorithms for finding control files are same in both the 1.5 and 1.5.MR version. They changed with release 2.0. Try installing 1.5.MR after a reboot and attach installation logs if possible.
[Magisk] Sreekantt:
Great work mate. I can see few happy faces but it fails to work on my device.

MC 2.0 installs fine on my Honor 6X but after a reboot, Charging starts and stops every second when we plugin the charger.

MC 1.5 fails to install on my device.
[Magisk] jemail:
I no longer have any 1.5 zip to test. This is why I am repeatedly asking if someone has the first 1.5 version for download.

I am almost at the point of giving up with mcc, my fault for not keeping a back up of the installation zip. For me 1.5 was stable.

What do you think to having a stable channel and a beta channel? Seems like most of the stuff added on are beta features? Not sure, what do others think? Stable channel supports hardware and beta channel supports new features?
[Magisk] Jaymin.0.1910:
I meant to say could you try the 1.5.MR version attached in the 3rd post ?? That and 1.5 both share the same algorithms and many more. I personally do NOT keep older builds because my computer is also a testing machine just as my phone. Maybe someone here can help:).
[Magisk] jemail:
OK I'll give it a try and let you know how it goes. ?
[Magisk] suyonk:
Guys,can i ask something ? What the function off this app? Actually i'm interested of this app,but i dont know how to use it and what function is? Maybe you can explain to me? Or can this module / app can make my battery live last longer? (CMIIW) thanks :)
[Magisk] Sreekantt:
Yes, it helps battery a lot.

Battery shouldn't be charged more than 80% or discharged less than 40%. This module helps you maintain that for you automatically switching off the charging when it hits 80.

Just install the module in your regular way > Install Terminal emulator app > You have to set commands from here >

type 'su' - This is for getting root access (Don't use inverted commas)

'mcc -s 80 70' - Use this command to set threshold values of charging - Automatically stops charging when it hits 80% and starts charging at 70% which is very useful in car.
[Magisk] pat357:
[MENTION=5445416]jemail[/MENTION]

Just for in case 1.5.1 MR does't work for you, I dig up version the first posted 1.5 for you.

I made some changes to the this original v1.5 before installing it on my phone.

So, this is the original unaltered version, which is not the same as what is running on my phone now.

I'm not even sure that this version is working or not.
[Magisk] jemail:
Many thanks. It's good to have the zip file as I regularly change ROMs.

I am testing mcs at the moment which is working well and I am noticing that my battery is not draining anywhere near as quickly as when using mmc so I think I will stay with mcs for the moment.
[Magisk] DenyDarko:
Hey [MENTION=8570610]JayminSuthar[/MENTION]

I'm using a Magisk snapshot and your module is not shown on Download section.

Maybe due to the following commit?

https://github.com/topjohnwu/MagiskManager/commit/ce2e6b7d3596aa5f56a4a7e2dd24dae829943ce2
[Magisk] Jaymin.0.1910:
Thanks for the heads up.

I couldn't catch up with it due to private life kinda thing.

It seems like the next stable Manager will block Module's with minMagisk 1500 if using Magisk >= 1630, else with template < 1400.

And since mcc is compatible with all of them, I have added both minMagisk and template entries to prevent it.

Again, thanks [MENTION=2641771]DenyDarko[/MENTION].
[Magisk] dizM0nkey:
HTC 10 supported?

Hello,

I have an HTC 10 on stock firmware (but obviously rooted / magisked / etc) and I'm getting a "failed the check" error on checking compatibility. Is there any chance of getting this working on HTC 10?

Thanks,

diznanl
[Magisk] eTaurus:
I wanted to ask the same thing. I'm rooted with Magisk 16.3 on HTC 10, stock Oreo. Same problem.
[Magisk] Jaymin.0.1910:
Hello [MENTION=1907319]diznanl[/MENTION] and [MENTION=4348041]eTaurus[/MENTION],

I have previously experimented with HTC 10, although your device supports disabling charging, it doesn't support enabling the same.

So if I add support for your device, mcc will function properly when the higher limit is hit, but not when the lower. The only option then is to reboot the device.

So, currently, and possibly for future, there is no official HTC 10 support from me.

JayminSuthar.
[Magisk] dizM0nkey:
Thank you, Jaymin... I'll be using mcc on my next device! :good:

diznanl
[Magisk] d8v8n8:
Hi,

Could someone please explain to me the difference between

"Set auto switch up threshold to xx" and "Enable Charging until xx percent"?

Thank you.
[Magisk] DenyDarko:
I'm gonna take a guess here saying that the first is automatic (the whole reason someone uses this module) while the second is an single shot thing.
[Magisk] DenyDarko:
Hey [MENTION=8570610]JayminSuthar[/MENTION],

I've just used updated your module using the latest github changes from your repo.

Something is wrong with the power off thing.

It shuts the device down while I'm with 57% battery.

Wasn't able to check anything else as I had to remove it.
[Magisk] Jaymin.0.1910:
Hello [MENTION=2641771]DenyDarko[/MENTION],

Thanks for the report, I actually am busy due to admissions, so the code wasn't completely checked.:o

I checked it now and found out a little mistake, I appear to have not put the path to mcc.conf.

I will fix that once I have time :)

Thanks again for the heads-up.

JayminSuthar
[Magisk] pat357:
[MENTION=8570610]JayminSuthar[/MENTION]

I was peeking in your latest code for the upcoming version 2.1 and noticed a few things :

1. It seems you went really back to the basics : no [......] in certain parts, they are all replaced by test ......, no sed commands...

All AWK replaced back to grep....

Is there a specific reason for this ?

2. Be careful with quoting in grep :

test_level__() {
if (! echo $1 | grep -E "^[0-9]+\$" >$NULL); then

Did you test this construction ?

If you quote characters in grep, in case of characters special with a "special" meaning like "^" or "$", they loose their meaning and will be handled as literals.

So, in this case, I think /$ is just a the literal $ instead of the last char of the line.

Also, if you don't have variables or other special things in your search expression, better use single quotes then double quotes.

3. In the Mcc main under "switch" :

I was looking at the following :

if (eval $TEST); then
SWITCHED=;
elif ([ -z "$SWITCHED" ] && eval "$TEST cur"); then
true;
else
SWITCHED=true; return;
fi;

Seems a bit strange, as only the third else has a real action and the second elif has absolutely no action.

I tried to simplify it and came to the following (not sure it's 100% correct):

if ! eval $TEST && ! ( eval $TEST && eval "$TES cur"); then
SWITCHED=true; return;
fi

This can further be simplified by ! ( a . b) = ! a || ! b

I think it should do the same as the above with 2 elifs and an else.

Maybe there will be more tomorrow, I'll see.
[Magisk] Jaymin.0.1910:
[MENTION=4970217]pat357[/MENTION]

Thanks for the report.

1) sed and awk are all removed to avoid the requirement of BusyBox.

2) Yes, this works, single quotes are removed for shell compatibility.

3) The first tests whether kernel changed the state, and unsets the SWITCHED variable, the second tests whether charging current is not what is expected, and is checked only if SWITCHED is unset, and the last means none of the above is true, so set the SWITCHED variable and return. For other than the last one, charging state is toggled by mcc, the last doesn't.
[Magisk] neekless:
Do I need busybox for this to work?
[Magisk] DenyDarko:
No
[Magisk] chuckr2:
It I'm not mistaken, I believe "enable charging" is a one-time exemption that halts the daemon until the percentage is reached. Contrast this to "set charging threshold", which sets a config variable that, once set will persist until changed.

So, if you set the upper charging threshold, the daemon will always stop charging at that upper percent until changed. Whereas enable charging will charge to the specified percentage only once before reverting to charging been the thresholds.
[Magisk] d8v8n8:
Thank you. It's clear for me now.

---------- Post added at 21:09 ---------- Previous post was at 21:07 ----------

That's a very thorough explanation. Thanks mate ;)
[Magisk] mamamume:
To get this module worked I must charge the cell phone to 100% or must be set to nay specific %
[Magisk] svenkerst:
Installation failed on my Honor View 10

Is it something that I did wrong, or is this device not supported?
[Magisk] kiddejig:
It's actually not really clear what the commands exactly do
[Magisk] chuckr2:
I agree, older versions had explanations of each command. Coming from those versions, I understand what they do but I could definitely see how it would be confusing for a new user given the current cut-down version of the new command list printout.
[Magisk] Droid_JD:
Just discovered this module. Love the concept, disappointed it's not working for my pixel XL. I keep getting the, "failed the check" error.

Am I plagued the same way as the HTC 10 and Asus users who previously reported this error?

Thanks for any help!
[Magisk] papoy1019:
You need to find the file that switches charging of your device! Then the dev will support your device for MCC.
[Magisk] Droid_JD:
Battery_charging_enabled
[Magisk] chuckr2:
I have the same issue on my Pixel 2 XL. The detection is kind of spotty on installation. There is a way around it though:

extract the zip

Open the META-INF/com/google/android/update-binary file in a text editor

Find the line that says "sleep 0.1" and change it to "sleep 0.7"

Zip all the files up again, making sure the zip has the same file layout as the original

Install the new zip in Magisk Manager by going to the Modules section, hitting the + button and locating your new zip file

It's a bit of a pain since it has to be done for every new version
[Magisk] Droid_JD:
Thanks. Tried it, no dice.

Now I'm told, "Your device don't support these functionalities."
[Magisk] chuckr2:
Can you attach /cache/uevent_cache.tmp?
[Magisk] Droid_JD:
I don't see that file.

This is all I have in /cache
[Magisk] Jaymin.0.1910:
Nope, You need your device charging only for installation and then it'd work as a daemon in the background.

Saw your logs, can you attach the file /sys/class/power_supply/battery/uevent ??

Hello, thanks for letting me know. I will try to make a detailed explanation of commands.

HTC 10 is officially not supported, Some Asus devices are using Intel CPUs which don't have the ability to toggle charging state on demand.

That's a really older version. Could you try the latest snapshot from my GitHub ??

There is no such file, the path is /dev/mcc_tmp/cached.
[Magisk] svenkerst:
Thanks for replying! Here is a GDrive link to the file you asked for.

https://goo.gl/XSb438
[Magisk] Jaymin.0.1910:
Repo removed. This module will not be available in Magisk Official Repo, and updates will be attached to the thread eventually.
[Magisk] chuckr2:
Whoops, that's where it showed up on my phone. Must be a phone-specific mount. I'll keep that location in mind though.
[Magisk] Droid_JD:
Ok... I'm an idiot.

I can't find the snapshot builds. I'm looking at the git link in the OP. Is that not the right git?
[Magisk] pat357:
I was looking for the latest version from the module (official / test version), but found nothing at the Magisk Module Repo from MCC.

What happened to the official repo at https://github.com/Magisk-Modules-Repo/MC-s-Charging-Controller ?

I always get code 404 (page not found).

Is there a newer version that deals with the ON/OFF switching when target is reached ?

Is it official already ? It seems the code hasn't been changed for some weeks, so it should be ready for release ?

---------- Post added at 05:58 PM ---------- Previous post was at 05:29 PM ----------

I must have missed this post as it answers one of my questions in my previous post. Sorry for the kind of double post.

Why did you do that ? Any particular reason why you removed MCC from the Magisk Official Repo ?

For the people who follow this thread, will miss the easy and handy way from the auto update feature via Magic Manager.

But for most other people, they wont find your great program because most of them just look in the Repo if they need anything.

The possible ways to know about the existence from your excellent module are far more restricted now.

You know also that unknown is equal to unloved ! :D

BTW : I first l noticed your module because it was in the repo and I was looking for something to handle the load levels from my battery.

I think I was the first to come to this thread and so things started.
[Magisk] Jaymin.0.1910:
Please forgive me all the inconvenience. Maybe you have the last sources available ??

I have now migrated to Windows 10 learning C-Sharp and some fun native Windows stuff since now I started college. I'm no longer maintaining this project. The snapshot Repo from GitHub is removed just as the official Repo. I never intended disappoint some fellow I know likes my work.

If you got the answer for the bolded question, I warmly welcome you to continue development. Everything is GPLv3, just grab the code (but never violate the GPL).
[Magisk] Anonymous710:
Hotspot

Hotspot doesn't turn on.

I found a charging controller finally, but can't use it :(

I use mobile hotspot alot.
[Magisk] noukon:
The issue seems to have gone away for some reason.
[Magisk] dizM0nkey:
Just wanted to say thanks for your work on this but it caused a breaking issue for me so I had to uninstall.

Phone: OnePlus 6 on Oreo 8.1 (OxygenOS 5.1.5) running Magisk 16.4.

Issue: I installed the latest version (2018-05-06) in Magisk and rebooted. I set these behaviors via terminal: 'mcc -s 80 30'. The battery would stop charging at 80% and that worked great. It would, however, turn the phone off at around 20% when now charger was plugged in. I would turn the phone back on and a few minutes later, it would randomly turn off again.

If there is a known workaround or fix, would love to continue using and testing!

Thanks!
[Magisk] noukon:
I didn't understand why that was happening as well even if you only use a command like mcc-s 80 30 and you don't set anything about the auto shutdown but there is a command to fix that:

* 'mcc -p 15' --> Set auto shut threshold to 15

The lowest number is 5% (without the percent sign) but I don't know why you can't set it to zero
[Magisk] dizM0nkey:
Thanks, giving this a go.

Side question: do arguments need to be run in a single command? For example, can I run 'mcc -s 80 30' then in another terminal window run 'mcc -p 15'? Or do they need to be run in the same command... (I don't know how this would look but something like this, maybe? 'mcc -s 80 30 -p 15')
[Magisk] noukon:
yes, just run one command after the other and after that you can check your settings with mcc -i
[Magisk] Zohair.ul.hasan:
Installed it 2 days ago and it seemed to be working fine with no issues on my OnePlus 5, until today when it unexpectedly shut down at 50 percent battery and displayed a message "Battery too low, please charge for a while before powering on". Had to charge it for 5 minutes before it hit zero percent.
[Magisk] kurtn:
Non-Magisk operation

Hi [MENTION=8570610]JayminSuthar[/MENTION],

Do we have a chance to install mcc to system without using magisk? My prefered setup ist LineageOS with addonsu.

Kurt
[Magisk] Jaymin.0.1910:
Does your system support init.d scripts??
[Magisk] kurtn:
I think so.
[Magisk] Jaymin.0.1910:
Well, that's nice. Which CPU/chipset are you using??
[Magisk] kurtn:
Various. Maybe I should start bricking with my oldest phones moto e SD 200 arm 32
[Magisk] Jaymin.0.1910:
That's great. There wouldn't be any chances of bricking since all low level changes are recovered with a reboot. To properly support root solutions other than Magisk, I will need to make some changes to many internal paths to support SYSTEM installation. So, if you don't mind, I will PM you when I think the build is ready. Is that good??
[Magisk] neekless:
Are you back to develop this module?
[Magisk] Jaymin.0.1910:
Yep, will be back will a completely reconstructed module (of course, the same concept) since all my college admission things are done. It'd just take a lil more time for me to finalize all my development setups through my new phone.

Regards from Jaymin Suthar.
[Magisk] Jaymin.0.1910:
Update!

I just started working on the next version 'Redefined 1.0' and guess what ? I have just found out some better ways for doing some things with so used traditional ways. All the features from my last beta release from here will be kept implementing all the new redefined algorithms. System installations will be officially supported as well.

Also announcing 'Mod Installer Template' !! A new cool and more controllable way of installing Magisk modules.

Regards from Jaymin Suthar.
[Magisk] MajinkenSword:
Hope this works on a Huawei P20 Pro ?
[Magisk] Jaymin.0.1910:
I have succeeded in gaining control with another Kirin 970 model, so I think it should.
[Magisk] Didgeridoohan:
It's probably because you still have template=1400 in your module.prop that the module isn't showing in the Magisk Downloads. Old modules are filtered out...
[Magisk] nogaff:
Yup, not seeing the module in Magisk Downloads here either, even after clearing repo cache.

Also, tried downloading the module files from GitHub, zipping them up (in the root of the zip) and installing through Magisk Modules, but then I just get the following in the log:

- Copying zip to temp directory
! Installation failed

Edit: Wow, ok, apparently Magisk Manager just doesn't like zip files created in any of the most popular file managers! I tried creating the zip with FX File Explorer, MiXplorer and Solid Explorer and it didn't work with any of them. As a last resort I tried creating the zip with Android's built-in file manager and suddenly the module installs just fine. What the hell?

Anyway, will test the module later.
[Magisk] Jaymin.0.1910:
You're definitely right, but I still wish to provide compatibility for Magisk versions back upto 1400. So, I checked through the Magisk Manager sources and found out that the template entry needs to be before the minMagisk entry to workaround such scenarios. Thanks a lot for your help.

Regards.

That's because Magisk Manager and the GitHub server sources use different methods for determining minMagisk. I previously checked the server sources to know whether the mod is acceptable or not, but the Manager thinks a bit different here. I will fix that soon.

Regards.

Of course, proper talks should go in proper places.

I found the cause, please read the both above quotes for more details.

Regards.

Hello guys, please see the above posts for details.

I honestly appreciate all your feedback, and continuously try to improve mcc. Thanks to all.

Regards from Jaymin Suthar.
[Magisk] PsyCl0ne:
Hey JayminSuthar,

I guess you got the backend sink sorted but on my OP 6 I can't reconfig mcc.

OnePlus6:/data/data/com.termux/files/home # mcc --reconfig

OnePlus6:/data/data/com.termux/files/home # INFO: Reconfiguring (low_level)...

FATAL ERROR: Failed to reconfigure it

Do you have a debug installed into mcc or even a way to provide verbose output?

Im running the latest stock update for my phone with a custom kernel but I doubt that's related.
[Magisk] neekless:
[MENTION=8570610]JayminSuthar[/MENTION] did the redefined update remove the shorter commands (e.g. mcc -s/mcc -p/mcc -rd)? From the readme it seems like only the long forms (mcc --switch/mcc --power) are valid now?
[Magisk] mistermojorizin:
it came up in magisk manager. getting error "FATAL ERROR:invalid arguments"

Here's what I've been trying to do:

taimen:/ $ su
taimen:/ # mcc
sh: mcc: can't execute: Permission denied
126|taimen:/ # mcc
sh: mcc: can't execute: Permission denied
126|taimen:/ # mcc -i
sh: mcc: can't execute: Permission denied
126|taimen:/ # mcc -i
sh: mcc: can't execute: Permission denied
126|taimen:/ # mcc
sh: mcc: can't execute: Permission denied
126|taimen:/ # which mcc
taimen:/ # mcc
taimen:/ #
FATAL ERROR: Invalid arguments

taimen:/ # mcc
taimen:/ #
FATAL ERROR: Invalid arguments

taimen:/ # which mcc
/system/bin/mcc
taimen:/ # exit
taimen:/ $ su
taimen:/ # mcc
taimen:/ #
FATAL ERROR: Invalid arguments

taimen:/ # mcc -i
taimen:/ #
FATAL ERROR: Invalid arguments

taimen:/ # mcc -x
taimen:/ #
FATAL ERROR: Invalid arguments

taimen:/ # mcc -h
taimen:/ #
FATAL ERROR: Invalid arguments

taimen:/ #
taimen:/ # mcc --power
taimen:/ #
FATAL ERROR: Invalid arguments

taimen:/ #
taimen:/ # which mcc
/system/bin/mcc
[Magisk] Jaymin.0.1910:
I'm currently running short on time. I mostly develop at midnight, even when I pushed the first redefined version, it was 2:30 AM here. But I will soon manage some time to write a debug script for mcc.

I hope you understand :)

Regards.

Yep, I removed them cause I thought they were not so intuitive. But anyways, do you miss them ?? If so, kindly let me know.

Regards.

Hello, you need to wait for 120 seconds after booting the device, and I haven't yet implemented the [NO_ARGS] option. I really couldn't think about whether to show the help page or do something else when no arguments are supplied. Can you suggest :)

Regards.
[Magisk] mistermojorizin:
after I waited the 120 secs, i wrote mcc, and I kept getting the permissions error. Once I put in mcc -i, that's when I started getting the "fatal error: invalid arguments" and as you see I did try to use some arguments such as -i , -x ..... on MCS the [NO_ARGS] would just start the service or tell you if it was running, and was needed on first boot to activate the service.

edit: OK, so i did mcs --help and it gave me commands, I used:

taimen:/ # mcc --switch 84 79

taimen:/ # INFO: Auto Switch thresholds have been updated

But it's not working to actually disable the charging.

edit 2: Also tried mcc --disable 1h

it is still not turning off charging.

edit3:

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

- Level : 96
- Health: Good
- Status: Charging

Current Settings

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

Daemon Status: Not running
[Magisk] Jaymin.0.1910:
It shows the daemon was not running, can you try the '--redaemon' option and see if that helps ??

Regards.
[Magisk] nogaff:
I'm getting exactly the same results as [MENTION=4395484]mistermojorizin[/MENTION] on my Pixel 2 so I tried the --redaemon option like you suggested and it's just stuck doing nothing now:

walleye:/ $ mcc --info
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: Not running

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

It's just sitting there after that last warning and isn't returning to the command prompt.

Edit: I closed the terminal and ran "mcc --info" on a new terminal and now it says the daemon is running. I'll test if it switches the charging now.