yashsingh1/xdaforums huggingface dataset:
[Magisk] pat357:
I just installed v1.43.

Install went OK and and the tests were successful.

After rebooting 2x, I tried

# mcc -i
no reference set
failed
# mcc -h
nothing !

The fact that mcc -h did not print anything, gave me a clue about what was wrong.

What I noticed in the MCC main script, was that the mod_dir was NOT replaced by service.h.

As soon as I fixed this by hand, everything was working : references were found, mcc -h printed expected text.

So, there must be a bug in service.sh

Edit 1 :

from services.sh

if ! mcc_main=$(ls /system/xbin/mcc || ls /system/bin/mcc); then exit 1; fi;

# Define functions

log_srv() { log -p $1 -t Magisk "- mcc Service :- $2"; }

is_runningd() {
ps | grep -v ' grep ' | grep ' root ' | grep ' {mcc} ' | grep -q ' --launch-daemon$';
}

# Logger
set -x 2>$srv_log;

({
# Block Main's execution
chmod 0644 $mcc_main;

# Set mod_dir in the Main
sed -i "47s|.*| mod_dir=$mod_dir;|" $mcc_main;

The first line seems to imply that mcc_main=$(ls /system/xbin/mcc || ls /system/bin/mcc)

But for you replacement to work, you need to do the replacement in /magisk/mcc/system/mcc or even better, do it in both files !!

BTW, the way you do the replacement is difficult to maintain if the code in the main mcc changes a lot

sed -i "47s|.*| mod_dir=$mod_dir;|"

disadventages :

the fixed line number 47 will change.

the intendation can also change

There better ways to do this, if interested, just let me know
[Magisk] Jaymin.0.1910:
Thanks for the logs, will update README about it.

BTW, It was not a refs issue, it was an issue with mod_dir not found, I will fix that.:o
[Magisk] Jaymin.0.1910:
Just the mod_dir issue, will be fixed:o

Can you do some testing on how to use Magisk bundled sed, or maybe awk to have the file patched on every boot, cause everything works on my end!!!!
[Magisk] sandaljrpit:
first i lost busybox after i installed v1.4.3 then i install again busybox but still encountered failure.
[Magisk] pat357:
Does , on your phone, the mod_dir get replaced after install +reboot ?

Because you do the replacement in services.sh before setting up Magisk busybox ...

So, it likely that the sed calls another busybox from the environment variable PATH.

In my case I have the systemless Osmosis busybox installed from the Magisk repo.

Do you have another busybox in your PATH at the moment sed is called ?

Any idea why the replacements did work in previous versions, why should it not work now ?
[Magisk] Davin093:
guys.... Lineage 14.1 here.
[Magisk] chuckr2:
Please attach /magisk/mcc/cache/uevent_cache.tmp
[Magisk] Jaymin.0.1910:
Hi, In case you didn't know, /sbin/.core/img/busybox is added to PATH for all boot scripts by Magisk. So you just need to test Magisk bundled BusyBox's sed applet. Also can you check if using "busybox sed" instead of just "sed" works ( symlinking is worst in BusyBox setup ).

Just a BB issue, will be fixed
[Magisk] Davin093:
Thx!! I really wanna use it now
[Magisk] pat357:
1. If you'd patch /sbin/.core/img/mcc/system/xbin/mcc, there would be no need to patch it on every boot.

Once this file is patched, on every reboot, /system/xbin/mcc will get "overlayed/replaced" by the file from above.

Obviously you need to boot again after initial install/reboot , because on first reboot /sbin/.core/img/mcc/system/xbin/mcc is patched and

/system/xbin/mcc is still unchanged. On next reboot the "overlay/replace" will happen and /system/xbin/mcc is replaced by the patched version

from /sbin/.core/img/mcc/system/xbin/mcc.

To overcome the need or another reboot, just patch the 2 files at the same time, this is what I do now.

So, there is no need at all to patch on every reboot.

2. As I mentioned before, this is a simpler and better way to do the patching, and should work with every busybox that had a sed implementation :

In the main mcc :

Write a word (string) that very is unlikely to be used in the code, exactly on the place where you want the replacement to happen.

for example : the string "# THIS_WILL_BE_REPLACED_BY_SERVICE" or "# abacradaba4852" are strings you do not use for normal code.

in service.h

Based on Basic Regular Expressions ((BRE) - should also work for busybox with limited sed implementation

sed -i "s|^\([ ^I][ ^I]*\)[#] abacradaba4852.*$|\1mod_dir=$mod_dir|" $mod_dir/system/xbin/mcc /system/xbin/mcc

Using Extended Regular Expressions (ERE)

sed -ri "s|^(\s+)[#] abacradaba4852.*$|\1mod_dir=$mod_dir|" $mod_dir/system/xbin/mcc /system/xbin/mcc

Note : these should replace with keeping the original indentation if this is at least one character. This is done

to optimize the search process.

If you don't want this limitation, use this:

sed -i "s|^\([ ^I]*\)[#] abacradaba4852.*$|\1mod_dir=$mod_dir|" $mod_dir/system/xbin/mcc /system/xbin/mcc

or

sed -ri "s|^(\s*)[#] abacradaba4852.*$|\1mod_dir=$mod_dir|" $mod_dir/system/xbin/mcc /system/xbin/mcc
[Magisk] Jaymin.0.1910:
Ohh god... How could I not think about it ????? Thanks for the idea [MENTION=4970217]pat357[/MENTION].

Just as what we're doing with mcc.conf, why can't we treat the Main as a conf file and set mod_dir as a prop there!!!!.

A new build will be up with this:laugh:.
[Magisk] Jaymin.0.1910:
Test build for voltage based control

Hi,

Here is a test build for [MENTION=4299075]Estel78[/MENTION] of voltage based controller mcc. Test if this works correctly and which parts have ( maybe ) bugs.:)
[MENTION=8570610]MCMotherEffin'[/MENTION]
[Magisk] Zafrkant:
Hi, firstly I want to thank developer for great contribution :)

I tried to enable charging until 80% with no success.

I'm using Xiaomi Mi 5s, LineageOS 15.1, Magisk 16.0, Stericsons BusyBox 1.28.1.
[Magisk] namhbnam:
1.5 work very good. But i cant set 100 80 or 90 80. Set 80 60 and work.
[Magisk] Jaymin.0.1910:
Are you using the test build ?? The issue you stated is known issue until 1.5.test. Try that build;)

Hi,

Have you tried force setting those thresholds ??

You know, mcc is written to deny thresholds if not between 15 - 85 by default, but you can still force set them using the [ -f / --force ] option.

See the help message which has examples for almost every action you could perform with mcc. But be sure to tell me if it misses something:)
[MENTION=8570610]MCMotherEffin'[/MENTION]
[Magisk] Jaymin.0.1910:
And now, the last thang,

grep com.google.android.gms.unstable /sbin/.core/img/.core/hidelist

:)
[Magisk] cheveguerra:
Sure,

grep com.google.android.gms.unstable /sbin/.core/img/.core/hidelist

com.google.android.gms.unstable

Regards
[Magisk] Jaymin.0.1910:
Hey, there seem nothing bad, can you attach output of this please ???

for magisk_bb in $(find /data -type f -name busybox | grep /magisk/busybox$); do
if [ -x "$magisk_bb" ]; then
if ($magisk_bb | grep -q topjohnwu); then
if [ -f "${magisk_bb%/*/*}/magisk.img" ]; then
break
fi
fi
fi
unset magisk_bb
done

for loop_device in /dev/block/loop*; do
if (losetup $loop_device | grep -q ${magisk_bb%/*/*}/magisk.img); then
for mount_point in $(grep "$loop_device " /proc/mounts | awk '{print $2}' | grep -v ^/system); do
if (grep -q com.google.android.gms.unstable $mount_point/.core/hidelist); then
echo $mount_point
fi
unset mount_point
done
fi
done
[Magisk] Ali.G:
How to

question: Can I make it so that at night when I plug in the charger it will get charged to 100% and then stays at his %? If yes what is the code for it:confused:

Thank you
[Magisk] cheveguerra:
Sure, here is the result:

> done

losetup: /dev/block/loop1: No such device or address

losetup: /dev/block/loop2: No such device or address

losetup: /dev/block/loop3: No such device or address

losetup: /dev/block/loop4: No such device or address

losetup: /dev/block/loop5: No such device or address

losetup: /dev/block/loop6: No such device or address

losetup: /dev/block/loop7: No such device or address

a5y17lte:/ #

Regards
[Magisk] ikillyou983:
Not installing on Xiaomi Mi Note 3

Hi your magisk module didn't install on my phone when I tried to flash the module the phone shut down why???
[Magisk] pat357:
Question about updating an existing module install :

I had the module installed and working and got a notify about a newer version available

So, I went to Magisk Manager -> download and picked the updated module and selected "install".

Installation failed because my phone was so called "not compatible/doesn't have ..." :confused:

After removing the existing module and rebooting, I was able to install the updated module.

There must be a more elegant way to update : every time removing the existing module, reboot, install the new module,

reboot again + also setting parameters again seems not optimal. :p

Would it maybe be enough to stop the daemon or something similar before updating ?

I guess what happened is that at the moment I wanted to update, the existing module was still active and "running" and

was actually interfering with the check for compatibility from the new module.

Therefore it would be nice to change the installation from the module to first of all check for an existing install and then somehow

"stop" the relevant existing processes. Also retaining the previously set parameters after an update would be nice.

Maybe something for one of the upcoming releases ? :)

---------- Post added at 12:21 AM ---------- Previous post was at 12:17 AM ----------

You must be charging your battery while installing the module. Did you ?

What was your batt % at that moment ?
[Magisk] Jaymin.0.1910:
I got an idea about this, next update will be addressing this, even though if the SAME happens again, you should stay away from this module
[Magisk] Jaymin.0.1910:
Hi,

Firstly, thanks for your detailed report:svetius:

Killing the existing process is great, ps and parsing the cmdline would let us get the process id and we can then kill that, BUT,

There is already a more convenient way to do this, user can simply run

mcc --enable 120

from terminal and the original process will go to sleep for next 2 minutes and no compatibility check by mcc will take that much time

And relating retaining previously set parameters, mcc already got this feature, please try again, just do flash any same newer build to full uninstall, then any older build, reboot and set parameters, flash any new build and you should see "- Restoring settings..."

BTW, I changed some PATHS related to mcc twice in the near past ( just due to some bad decisions ), this might prevent restoring settings
[Magisk] Jaymin.0.1910:
Hi,

Please flash the attached build and provide /cache/mcc_install.log

Sorry for inconvenience :)
[Magisk] Jaymin.0.1910:
Hi,

Firstly, charging lithium batteries' to 100% on a daily basis will surely get you possibly months of its life off, even though for your case the code would be

mcc --force --reset 99 98

Remember, 100 as a parameter will fall invalid, so use 99 always, you can adjust 98 as your own needs
[Magisk] borsemayur2:
not working anymore on kenzo.doesn't support error.it was installed successfully before on rr rom
[Magisk] Jaymin.0.1910:
Which ROM / Kernel is it failing with ???
[Magisk] pat357:
Question about the shut-off feature :

Suppose I'm running the default parameters, with --shut 20.

The following is hypothetical :

I'm out of town for the whole day and have very intensively used my phone whole day. No access to a charger/power outlet.

I see my phone shutdown, the battery level was probably at 20%., but I 'd like to make just one 2min important call.

So, I just restart my phone to make to so important 2min call.

Will I be able to make the call or would the phone keep turning off because of < 20% batt. level ?

If the latter, how can I start my phone to change the shutof % to a lower level ?

(remember, still no access to charger or power outlet.)

---------- Post added at 07:12 PM ---------- Previous post was at 06:56 PM ----------

I'd strongly suggest to rethink about this, because it will kill your battery in no time !.

You also do not need any program to accomplish this : just keeping your phone connected to the charger the whole time will give you exactly this result.
[Magisk] Jaymin.0.1910:
* This is for all users having the same question,

* When you device has booted, and finally all the Magisk patching is done, late_start service mode will start

* First service.d, and then module service scripts get executed,

mcc

service is started in this time

* After completing basic tasks, service.sh will sleep for 2 minutes and then trigger the actual

mcc

background service

* So, after bootanimation has finished, you get around 70-90 seconds to run

mcc --autoshut

to toggle automatic power-off OFF, and back ON when you're done
[Magisk] Ali.G:
Is it possible to have 2 independent profiles let's say 1 for night charge and 1 for daily use?
[Magisk] Jaymin.0.1910:
Definitely possible, but will require a lot of coding, AND I'm not planning on to add any feature until I get a bug with never resuming charging on some devices fixed up
[Magisk] Ali.G:
Thank you for that I don't have any now how about coding bit if it is to complicated I'll leave it as is
[Magisk] ikillyou983:
Yes my battery is in charging the percentage about 80%
[Magisk] namhbnam:
I misses, 95 is work. But i want change 100, how to do that?

I change mcc.conf and work. Thank you

vince:/ $ su

vince:/ # mcc -f -s 100 85

- A threshold must be in its limits, aborting...

1|vince:/ # mcc -f -s 100

- A threshold must be in its limits, aborting...

1|vince:/ #
[Magisk] Jaymin.0.1910:
Hi,

0 and 100 are set to be denied cause they are the boundaries for the battery capacity, and will render great loss if used, can you set 99 instead ?? I know, editing mcc.conf works, but just a suggestion.
[Magisk] mucomuco:
nvm
[Magisk] Zafrkant:
How to restore default settings, is it 'mcc -rc'?!
[Magisk] pat357:
I suggest you might have to reconsider about setting the limit to 100%, because you'll shorten the lifetime by a serious bit.

If you just want to keep the battery level at 100% at all times, you don't need any software for that !

Just keep your phone on the charger all time will give you exactly this.

---------- Post added at 07:34 PM ---------- Previous post was at 07:29 PM ----------

Try mcc -h for all commands.

To reset to limits to default : mcc -df/ mcc --default
[Magisk] mucomuco:
Hello, first thanks for your work.

I just installed this module from magisk to my Redmi note 3 pro and when I tried to set threshold it gave this error;

u0_a135@kenzo:/ $ mcc -s 80 70

- Failed to detect BusyBox, aborting...

1|u0_a135@kenzo:/ $ su mcc

u0_a135@kenzo:/ # mcc -s 80 70

- Failed to detect BusyBox, aborting...

1|u0_a135@kenzo:/ # find /data -type f -name busybox

/data/adb/magisk/busybox

u0_a135@kenzo:/ #

Can you help me please?
[Magisk] Zafrkant:
You should install Stericsons BusyBox.
[Magisk] MArtyChubbs:
I am able to install module. I can set parameters but mcc -h and mcc -i produces no output.

Charging did not stop at 80 as it was set.

I am on Pixel2XL running DU 12. Any suggestions?
[Magisk] mucomuco:
Thanks for help but I have still problem.

I installed it from play store. MCC -s 60 50 command worked but battery keep charging after 60. And I got this error with -i command;

u0_a135@kenzo:/ $ mcc -s 60 50

- New values saved

u0_a135@kenzo:/ $ mcc -i

- Attention :- No references set

- Re-configuring sysfs references ( requires the battery be charging )...

- Failed to re-configure them, aborting...

1|u0_a135@kenzo:/ $
[Magisk] Jaymin.0.1910:
Hi, this is not a BusyBox issue as mcc uses the Magisk internal BusyBox, its a typo in the service script, can you try the attached build and send /cache/service_failures.log ??

The same as above. Try the attached build and send the logfile.:o
[Magisk] DenyDarko:
Hey guys.

I've noticed the module messes up with my battery stats.

After being in a while on the charger, it shuts down at 20% and I have to remove the module and reset battery stats for it to fix itself.

Anyone else with that behavior?
[Magisk] Jaymin.0.1910:
Resetting batterystats on power-off is reverted from some previous versions, also remember mcc automatically resets battery stats on switching charging OFF. BTW, which version are you using ?? Also, can you help me with some debugging ??
[Magisk] MArtyChubbs:
That version pointed out the BB magisk module was not detected, so i switched to stericson. - h - i switches gave output. Now the daemon is not starting.
[Magisk] ichigo696:
Same to me, daemon not started on 1.5 test (oneplus one, lineage 15.1, magisk 16)
[Magisk] DenyDarko:
I was having the issue with the last version.

I removed it because of that.

Is there any reason it resets battery stats on every off action?

I can sure do some debugging.
[Magisk] Zohair.ul.hasan:
Not working on my OnePlus 5; fails to reconfigure sysfs references. Logs attached. Using version 1.4.3.
[Magisk] Zohair.ul.hasan:
Screenshot:
[Magisk] Zohair.ul.hasan:
Also tried version 1.5 test. Had to install BB again and this time daemon background did not run.
[Magisk] yadhube111:
What are the default setting
[Magisk] xtam:
for me with above test version as with official :

failed no busybox detected so i insalled busybox from magisk 16.0 repository (the one build with ndk)

and works but daemon not running as in post above in image of [MENTION=8806419]Zohair.ul.hasan[/MENTION]
[Magisk] Jaymin.0.1910:
Announcement

Hi all users,

I'm feeling so sorry to announce that this project will not be developed by me for the next two months or more. Firstly, I got to prepare for admission in college, so I do not have time for development and secondly, I have sent my device for repairing, so won't be able to test anything.

If some of you is willing to take charge, just PM me and I'd make you a collaborator on the official repo

Thanks all
[Magisk] MArtyChubbs:
Wish you the best on the admissions thank you
[Magisk] Sudarchikov:
Hi, MCMotherEffin'!

Could you help me with my lovely Asus Z00A? It is incompatible with mcc (( Install log is attached. Thanks in advance
[Magisk] Jaymin.0.1910:
Nope, I'm taking a break to prepare for my college admissions, BTW I just pushed the final version with currently known problems fixed, try that. :)
[Magisk] Sudarchikov:
Good luck with admissions! Get back!

But, final version does not work on my phone (
[Magisk] baabafadil:
Great Job.....wish u luck
[Magisk] sandaljrpit:
Last version ( 1.5 ) , work fine.

Xiaomi MI4 LTE Rom MIUI 9.5.1

Thanks :)
[Magisk] pat357:
Thanks for this final version !

I hope this final is only temporary (= not forever) and you'll be back after the preparation for your college admissions.

BTW : good luck with admissions!

About mcc:

I have done some tests and it seems all is working fine right out of the box for me.

One thing about updating a previous running version :

- First I followed your suggestion about disabling the auto-switch mode (-ts / --auto-switch), but the phone did not start charging.

- After this I used the trick I've always used before ( -e / --enable 4m ); this made the phone start charging and this allowed the test from new version to pass.
[Magisk] DenyDarko:
Why every time I login to xda recently I see someone good leaving his project :(

Wish you the best [MENTION=8570610]MCMotherEffin'[/MENTION], hope we'll see you soon active again as a college student. xD
[Magisk] MArtyChubbs:
Trying to install version 1.5 and it says my phone is not charging and fails during the installation previous versions install fine and recognize that my phone is charging any ideas?
[Magisk] Jaymin.0.1910:
https://mega.nz/#!VCJR0BZR!gEBmP3lNq2YDmcXW-0VMY9Xcdewjk_Ulehtjy7JgnCI
[Magisk] MArtyChubbs:
Works! Thank you sir.
[Magisk] pat357:
There's a typo in the update-binary :

line 117 :

if [[ -f $ref ]]mc; then
[Magisk] Jaymin.0.1910:
Announcement

Hi my dear users,

I'm happy to tell you all that I'm back in development. Although I may not have time at daytime, there is still some spare time for me in the night. I really like the fact that my work has been much appreciated, and really would not wish to disappoint mcc users. So, I thought I must be back in development, and here I come.

MCMotherEffin'

The been back developer
[Magisk] papoy1019:
Welcome Back! Eventhough my Asus Selfie, isn't really compatible.:laugh:
[Magisk] Jaymin.0.1910:
Please forgive me this, but unless your chip manufacturer and OEM implement hardware support for this, mcc can't do nothing:)

Some devices I know not having hardware support are those with Intel x86 CPUs, what is your hardware and kernel ??
[Magisk] papoy1019:
Yeah, that's what i think so. Arm64, and using Firekernel.

Its ok any way, i really find it hard to find the charging switch.
[Magisk] jemail:
Moto G Osprey:

v1.5 - working

v1.5 final - fails to install

v1.5.1 - installs, but daemon will not run. Status demon not running.

Does anyone have v1.5 link for download?

Thanks for continueing development, and good luck with college,I'm sure you will do well.
[Magisk] Jaymin.0.1910:
Can you provide logs ??
[Magisk] jemail:
I currently only have 1.5.1 installed. I will try to get logs to you soon.

I don't see information on how to provide logs. How can I provide logs?
[Magisk] Jaymin.0.1910:
Install mcc, reboot and then provide files listed in the fourth post.
[Magisk] lvbaal:
Hi MCMotherEffin', glad to have you back :)

I don't know if it is worthwile to investigate further if my device (Huawei Mate 10 Pro) can be supported by your tool given your ongoing insight of the last couple of weeks...?

Anyway, I have investigated a bit on my device and maybe have found a switch that could take care of en- and disabling charging while the cable is plugged in:

in /sys/devices/platform/huawei_charger/ there is a file enable_charger with value 0 or 1 when not charging or charging respectively. Unfortunately, when the device is plugged in and I change the value from 1 to 0, the charging indicator in the status line does not change.

Also, in this directory there is a file called driver_override that maybe could be used with respect to you mentioning earlier a driver not supporting the feature? Currently the value in this file reads "(null)".

I truely hope you can get this working for my device...
[Magisk] jemail:
Some of the files mentioned are not present. Here are all the log files I have :

https://mega.nz/#F!xhNzDDYb!jN8Ghsjv_IvZOs_tG7jClg
[Magisk] Jaymin.0.1910:
Driver override is really an impossible task for mcc, but enable_charger gives me a hope for your device, does the directory of that file contain a file named uevent, if so please send me that file, also what are enable_charger files permissions ?? Is any directory upto that directory a symlink ?? Thanks for your feedback regarding HUAWEI's implementation:good::highfive:

Hi, can you try the mcc --re-daemon option which is supposed to launch the daemon. Also I found a little faulty redirection in the post-fs-data script, but that doesn't seem to cause the issues, as all the pre-patching was done properly. And also re-download the module from Magisk Manager, since I just force pushed a change without bumping the version up, the issue might have fixed, if not feel free to ask back.
[Magisk] lvbaal:
Okay, there is hope:)

Permission of enable_charger is 660. No symlinks up to this point (screenshot)

Sending uevent from this directory as well.
[Magisk] MArtyChubbs:
Good news, it works! However, after reboot, I have to restart the daemon: mcc -rd.

Anyone have the same issue?
[Magisk] pat357:
[MENTION=8570610]MCMotherEffin'[/MENTION]

May I suggest a much more efficient way to start the daemon in service.sh ?

A FOR loop is not so well suited for this because the loop is always repeated 5 times.

Suppose the daemon is already running before entering the loop, you'll get 5x the break command.

The loop would still spend 5 x 15s, even if the daemon was already running.

The break command doesn't work as you'd expect.

current code

for i in 1 2 3 4 5; do
if ! is_runningd; then
(no_file_logs=true mcc --launch-daemon &);
else
break;
fi;
sleep 15;
done;

My proposal

let i=1
while ! is_runningd && [[ $i -le 5 ]]; do
(no_file_logs=true mcc --launch-daemon &);
i=$((i+1))
sleep 15;
done;