yashsingh1/xdaforums huggingface dataset:
[Magisk] Jaymin.0.1910:
Write 0, and 1 alternatively to /sys/devices/soc.0/qpnp-linear-charger-8/power_supply/battery/charging_enabled file and see if that stops / starts charging, be sure report the result

But what is the issue ?? I mean, what issue happens ??
[Magisk] papoy1019:
What is the best app to do this? I used root explorer but it will not save the changes.

Observation: i tried to edit some files in under system folder to see if there is something wrong with root explorer. It can. But when i edit files in under sys folder, it cant!
[Magisk] holofractal:
Hey man, great work on the app, and I'd love to use it, but it doesn't work on my HTC 10. Log is attached. Charging stops, but doesn't restart.

Running lineageos 14.1, Tabp0le's eas kernel.
[Magisk] Davin093:
Auto shutdown is not working. U asked me to send you those files.
[Magisk] Jaymin.0.1910:
OK, Got it, but no daemon related activities are actually logged, it they were, the device would become laggy, so can you force shut threshold to any closer threshold to current level and then run

mcc --launch-daemon

and see if that works, if that does not, kill the process by closing terminal window and then provide logs:)

Will analyze your logs, BTW I'm currently re-writing the module in C language, so might take me longer

I personally use ES File Explorer, that mostly works on my device
[Magisk] pat357:
You can use a Terminal app for this :

su
echo 0 > /sys/devices/soc.0/qpnp-linear-charger-8/power_supply/battery/charging_enabled

wait for about 15 seconds, and see if battery is starting loading or discharging

echo 1 > /sys/devices/soc.0/qpnp-linear-charger-8/power_supply/battery/charging_enabled

wait for about 15 seconds, and see if battery is starting loading or discharging

echo 0 > /sys/devices/soc.0/qpnp-linear-charger-8/power_supply/battery/charging_enabled

wait for about 15 seconds, and see if battery is starting loading or discharging

echo 1 > /sys/devices/soc.0/qpnp-linear-charger-8/power_supply/battery/charging_enabled

wait for about 15 seconds, and see if battery is starting loading or discharging

For the other issue with Root Explorer : make sure it has root access and if you're using separate text-editor, make sure this one has root access too !

Better use the build-in editor in Root Explorer.
[Magisk] papoy1019:
Thank you! But nothing happens. It does not discharge nor recharge.
[Magisk] RSDamasceno:
Hey, buddy.

In the last version it appears "failed to detect Magisk mount point, aborting ..." when I type mmc -i in the terminal.

(Verbose log does not exist & 0 B for mcc_err.log)

If you need some other log, just say ...;)

Device Moto G 2014

Android 7.1.2

Magisk 16
[Magisk] DenyDarko:
[MENTION=8570610]MCMotherEffin'[/MENTION]

Same here.
[Magisk] Jaymin.0.1910:
Try again after rebooting

Hi, found the faulty part, will push an update in half an hour

Same as above
[Magisk] pat357:
[MENTION=356675]McM[/MENTION]otherEffin

1. In service.sh :

I'd replace the code for changing the mod_dir in mcc like this :

# Set mod_dir in the Main
busybox sed -i "s|^mod_dir=.*|mod_dir=$mod_dir;|g" $(find $mod_dir/system/{x,}bin -type f -name mcc);

2. In mcc :

# Test service failures
....
elif ! busybox >/dev/null || test ! -x $(which awk || echo /it_is_nothing); then
echo -e "- Failed to detect BusyBox, aborting...\n"; exit 1;

Nice creation, with a lot of creativity ! But how does the "echo /it_is_nothing" make any sense ?

3. gonna look further for 3, 4 ,5 :)
[Magisk] vrushank__:
Will this module work on one plus 3t which is running on latest open beta build?
[Magisk] MoHed:
Working here

Yes. Provided you root with Magisk.
[Magisk] vrushank__:
Not working on my one plus 3t

It says ' failed to detect magisk mount point'

Can I get the solution plz
[Magisk] Jaymin.0.1910:
Number 1 got fixed, for 2, 'echo /it_is_nothing' is just to make sure the test command does not report false positives

I have fixed the issue, but did not increase the version code as it was just a missing '/system' string, so just re-download from Magisk Manager and it will be fixed
[Magisk] Hastaloego:
doesnt work on op5 running codename phoenix, compatibility test passed but wont stop charging when limit is reached, always goes to 100%
[Magisk] pat357:
I just updated MCC to v1.4 via Magisk Manager (download & install).

Upon initiating the "mcc -i" command, I got "Failed to detect Magisk mount point, aborting..."

The $mod_dir was properly replaced in mcc : mod_dir=/sbin/.core/img/mcc (which is correct, I guess).

So, the test if [ ! -f "$config" ]; then must be TRUE somehow; I checked the mcc.conf is in the $mod_dir and it *is* there.

I have to look further what goes wrong here ....

Note : previous versions have always worked for me. MMC v1.3 works almost perfect.
[Magisk] papoy1019:
Still the same! There is no effect! I guess, its really incompatible to my device.

Thank you still!
[Magisk] aricandra56:
https://drive.google.com/file/d/1jRSX_UxOtJYg0hKPa9s1BKkEDintD4HP/view?usp=drivesdk

Is my Phone Doesn't support this mcc?

sorry for my bad english
[Magisk] chuckr2:
The newest version crashes my Pixel 2 XL, and the previous version installs, but only when the device is *not* charging (and, of course, it fails to set the switch). I managed to get the previous version working by doing a search manually for the required uevent file and charging switch and adding them to the config manually.

Something about the new install script searching logic crashes my phone though. I modified the setup script to hard-code the switch location and got it to install. I'm going to try some debugging, though I imagine that it's going to be difficult when it does a hard poweroff; it probably won't sync the logfile to disk before it crashes.

EDIT: Just been doing the installer's actions one-by-one manually to find out where it crashes. Turns out, what does it is the set_ship_mode file. This file is located at /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/set_ship_mode, and defaults to 0. When the value is changed, the notification LED comes on followed by a poweroff a few seconds later. Perhaps you can add a specific exclusion for this file in your setup script? I've attached a patch. I put it in a case statement to make it easy in the future to exclude device-specific files if necessary. Pushing a PR to Magisk-Modules-Repo on Github.
[Magisk] Jaymin.0.1910:
Which version ?? Did any previous version work ??

Can you see logs ?? or just upload them here for me!!!

I am feeling sorry, but I can't hack into what OEMs implement:)

I can't access the file!!!

The previous version installed because it was a bug which reported false positives and got fixed in this version ( read the Release note ), Can you send the modified setup script :o?? And for the power-offs, I actually know what causes them, and had a workaround for that in the control file testing logic, but after some experimenting with Samsung devices ( which were the only devices at that time to report this issue ) I reduced the workaround to save some code, and you are right, you won't get any logs for this
[Magisk] aricandra56:
https://drive.google.com/file/d/1jRSX_UxOtJYg0hKPa9s1BKkEDintD4HP/view?usp=drivesdk

sorry, i'm forget

now you can access

---------- Post added at 08:24 AM ---------- Previous post was at 08:23 AM ----------

https://drive.google.com/file/d/1jRSX_UxOtJYg0hKPa9s1BKkEDintD4HP/view?usp=drivesdk

Now you can access the file

---------- Post added at 08:25 AM ---------- Previous post was at 08:24 AM ----------

https://drive.google.com/file/d/1jRSX_UxOtJYg0hKPa9s1BKkEDintD4HP/view?usp=drivesdk

Now you can access the file
[Magisk] Jaymin.0.1910:
Was the device charging while installing ?? If it was, send me your /sys/devices/platform/battery/power_supply/battery/uevent file while the device is charging
[Magisk] aricandra56:
After i'm installing again, my phone rebooted and when i'm checking magisk module, it's none (i mean not installed).

What happen?

---------- Post added at 09:19 AM ---------- Previous post was at 09:15 AM ----------

https://drive.google.com/file/d/17he20ung0ZO1WxfhyigbFTe43f6xzy8A/view?usp=drivesdk

i hope this is work for my device

thanks for reply.
[Magisk] chuckr2:
I, too, was having a problem with the charge not stopping at the correct percent, but I think it narrowed it down in the code. Since there was no sign of error, I started rebuilding the mcc script in the shell. Ultimately, I found that the shell was giving me this error:

awk: cmd. line:1: Unexpected end of string

Turns out, this line in write_switch() seems to be causing an issue:

value=$(get_prop switch_$i | awk \{ print \$$1 \});

After changing it to this, instead, it runs properly and the charging stops (tested with a zip rebuilt and re-install):

value=$(get_prop switch_$i | awk "{ print \$$1 }");

NOTE: This is unrelated to the above. My switches were set properly/manually so a faulty switch wasn't what caused the battery to not stop charging.

I also found that it finds the wrong switches during the install script, but I can't for the life of me figure out a good resolution. For example, for me the only switch the setup script found was parallel_disable -- which doesn't even effect charging. It doesn't pick up input_suspend and charge_disable which are the two switches that should be set. However, a mcc -rc fixed the issue partially, as it only picks up the charge_disable switch (which works perfectly fine on its own, it just doesn't remove the lightning bolt from the battery icon). It seems like the phone is just kind of slow in changing the uevent file. Changing the delay to a whole second when doing an initial install picks up the correct values consistently, but nothing 0.6 seconds or under seemed reliable (I didn't try anything 0.7-0.9 seconds, as it didn't seem meaningful). Perhaps the small delay in the set_prop call in the -rc code is what helps it find the one switch (of two on this phone).

Perhaps using a whole second delay in the searching process would be the ideal resolution, just add a note to the installer/-rc code informing the user that it could take a little time.
[Magisk] RSDamasceno:
Device Moto G 2014 XT1068

Android 7.1.2.

LineageOS

Magisk 16

EDIT: I figured it out.

I installed the snapshot version of magisk and the module installed normally.
[Magisk] aricandra56:
You need to install on boot mode and charging you phone
[Magisk] pippoaacc:
Oneplus One here, Android 8.1 Unofficial Lineage 15.1, 1.2.1 installs but then shuts down every time the daemon runs, 1.3 and 1.4 install correctly but then I get

130|A0001:/ # mcc -i

- Failed to detect Magisk mount point, aborting...

1|A0001:/ #

Even after a reboot
[Magisk] RSDamasceno:
I installed the latest version available in the repository and continue with the "failed to detect Magisk mount point, aborting ..." problem when I type "mcc -I" or "mcc".

(Verbose log does not exist & 0 B for mcc_err.log)

Attached logs.
[Magisk] Jaymin.0.1910:
The uevent does not seem having valid entry, does re-downloading & flashing work ??

Thanks, you helped me a lot, I lost my device some days ago, so this build was not tested practically, was analyzed theoretically, and I missed the bug, thanks a lot:laugh::D

:good::highfive:

Re-download it and flash, it has been fixed, but not pushed as an update, but re-downloading will reflect the fixed build

See the above
[Magisk] pippoaacc:
Unfortunately re-downloading doesn't change. Still failing to detect mount point
[Magisk] Jaymin.0.1910:
Upload logs
[Magisk] pippoaacc:
Thank you! So, no verbose log, and err log is empty, here-s what I have!
[Magisk] aricandra56:
When i flash it again, my phone reboot before it says done.

And when i'm checking Magisk Module, it's none (i mean it's not installed).

Also i'm doing charge with my phone when flashing.

But, i'll try again. Thx for reply
[Magisk] pat357:
I still can't make v1.4 to work.

First issue was that I got stuck with this :

if [ ! -f "$config" ]; then
echo -e "- Failed to detect Magisk mount point, aborting...\n"; exit 1;

Always gave me "Failed to detect Magisk mount point, aborting"

Did not find out why this test failed.

After I replaced this test, I could at least start !

I set my parameters 85 75 and shut, I believe was on 10.

When charging, it went straight to 100% and totally ignored my limits. I rebooted serveral times to see any difference, but it kept on ignoring the limits.

I went back to 1.3 and everything seems fine, except that there is no "uevent_cache.tmp" in /magisk/mcc/cache/ ...

The switch is setup fine and switching charging ON/OFF works.

Here are the logs from v1.4 :

Does this have to do with putting mcc in /system/bin instead of /system/xbin ?

My phone (SM-G955F S8+) won't even boot when I would do that.

Or are you talking about spontaneous reboots during normal use ? That happened to me too.
[Magisk] chuckr2:
No, it was in issue that crashed the phone (Pixel 2 XL) during the initial install script when it was searching for switches. The issue only showed up in the current version. The older version didn't install properly (but it would finish the install... sometimes), but I got it up and running by setting the switches and uevent file manually.

Most of the issues from the new version seem to be due to MC's code refactoring. Not that it's a bad thing; the new code looks more robust.
[Magisk] Jaymin.0.1910:
OK, I will fix the issue in the next Maintenance Release:o

Installation logs would be nice

Hi, the switch not being written issue has been fixed, thanks to [MENTION=8690403]chuckr2[/MENTION], and for mod_dir not getting set, can you send me stock mcc Main script after it has been modified by the service script:)

The newer version forces all control files to be writable by mcc, which results in unhandled situation and causes reboots, will be fixed
[Magisk] Estebanium:
Hi guys, for now it seems to be working at my S7 Edge. I only noticed that the charging animation will not stop of I disconnect the cable of my phone. I could live with it, but my battery app still thinks that the phone is charging. So the statistics are wrong. Furthermore I set the down threshold to 80, but the phone is only charging to 70. Any ideas to my issues. Thank you.
[Magisk] Jaymin.0.1910:
The first one can't be fixed due to Samsung's implementaion

For the second, what is your up_threshold ??

The developer
[Magisk] chuckr2:
So, after testing the new code (with the modification to skip my set_ship_mode file due to the crash issue), I was still having an issue with my phone not shutting down at the shut_threshold. I traced this problem to the fact that my phone does not have the `poweroff' command, nor does busybox supply it. However, for my phone, changing the shutdown code from `poweroff' to `reboot -p' works as expected.
[Magisk] Jaymin.0.1910:
Does /data/adb/magisk/busybox poweroff work as expected ??
[Magisk] Didgeridoohan:
There's no poweroff applet in the internal busybox, is there? At least in the current release with busybox v1.28.1. I believe the Magisk Manager uses /system/bin/reboot.
[Magisk] Jaymin.0.1910:
Oh!!! Thanks for pointing it out, it used to be in 1.27.2 version, but been removed by [MENTION=4470081]topjohnwu[/MENTION]

If you don't mind, can you run

setprop sys.powerctl shutdown

and see if that powers the device OFF ??
[Magisk] Didgeridoohan:
Yeah, that powers it down.

And I just saw that I had not finished with the last message before posting... :D There was supposed to be a "and the same with the reboot applet" in there as well. Note to self: don't try to do five things at the same time... :laugh:
[Magisk] Jaymin.0.1910:
Thanks, helpful as always, fella:highfive:
[Magisk] Didgeridoohan:
No worries... Out of curiosity, is that a standard Android prop? I noticed using "reboot" works nice as well.
[Magisk] Jaymin.0.1910:
Yes, that is what BusyBox poweroff actually does ( under the hood ). I saw that in osmosis' BusyBox source, but should be for all Unix systems

I omitted "reboot" because on some devices, with the -p flag, it doesn't actually power the device OFF, but freezes it, which is unwanted
[Magisk] chuckr2:
[removed]
[Magisk] pat357:
[MENTION=8570610]MCMotherEffin'[/MENTION]

I got v1.4 finally working, at least more or less.

I have my limits set at 85 75 and -p 8.

What happens : initially it keeps charging to 86% (yes $level +1) and then stops charging.

When the battery level is at 84?/85%, it starts charging for a very brief moment again till 86% and then stops again.

This keeps on repeating and every time it starts charging, my display turn on, and is preventing the phone from going in to deep sleep.

This way it seems that my 2nd level is also ignored.

Any idea why this happens with 1.4 and not with 1.3 ?

Something I don't understand to well why you use :

if $(auto_switch); then
if [[ $(batt_level) -le $(up_threshold) ]]; then
if is_charging; then
if [[ $no_ckcurrent || $(get_prop POWER_SUPPLY_CURRENT_NOW $(uevent_f)) -le 0 ]]; then
no_ckcurrent=true;
else
switch_ OFF;
fi;
fi;
if ! is_charging; then switch_ ON; fi;

With this if [[ $(batt_level) -le $(up_threshold) ]]; then it will continue charging until $(batt_level) +1

Another way to see it : why would you still enable charging if $(batt_level) -eq $(up_threshold) ?

Seems a bit illogical to me.

If you would like to stop charging at $(up_threshold) then you should use

if [[ $(batt_level) -lt $(up_threshold) ]]; then

PS : With v1.3 I never had this problem, it loaded till 85 and then stopped till 75. On 75 it loaded to 85... you know, the way it should work.
[Magisk] Estebanium:
Thanks for the quick reply. That's a pity that Samsung did that. I set my threshold to 80/75 and it is working now, maybe it needs to restart the phone or something like that.
[Magisk] pat357:
[MENTION=8570610]MCMotherEffin'[/MENTION]

I think I fixed v1.41 for my phone :

This seems to solve the issue I wrote about in my previous message.

I replaced this part by the part below :

## auto switch
if $(auto_switch); then
if [[ $(batt_level) -le $(up_threshold) ]]; then
if is_charging; then
if [[ $no_ckcurrent || $(get_prop POWER_SUPPLY_CURRENT_NOW $(uevent_f)) -le 0 ]]; then
no_ckcurrent=true;
else
switch_ OFF;
fi;
fi;
if ! is_charging; then switch_ ON; fi;
elif [[ $(batt_level) -ge $(down_threshold) ]]; then
if is_charging; then switch_ OFF; unset no_ckcurrent; fi;
fi;
fi;

by this code :

## automatic switching
if $(auto_switch); then
if [[ $(batt_level) -ge $(up_threshold) ]]; then
if is_charging; then switch_ OFF; unset no_ckcurrent; fi;
elif [[ $(batt_level) -le $(down_threshold) ]]; then
if is_charging; then
if [[ ! $no_ckcurrent && $(get_prop POWER_SUPPLY_CURRENT_NOW $(uevent_f)) -gt 0 ]]; then
switch_ OFF;
else
no_ckcurrent=true;
fi;
fi;
if ! is_charging; then switch_ ON; fi;
fi;
fi;

The original code :

if [[ $(batt_level) -le $(up_threshold) ]]; then
.......
if ! is_charging; then switch_ ON; fi;

This is the part that keeps enable charging whenever the battery level drop back to $(up_threshold) or lower.

It charges to $((up_threshold + 1)) stops charging but restarts charging as soon as battery level has dropped to $(up_threshold).

This way the $(down_threshold) never comes in the game !

I don't understand how this can properly work on any phone !
[Magisk] Jaymin.0.1910:
OK, You're right, I will sync that to the sources
[Magisk] DerMetzgermeister:
I'm getting this error in the terminal using any mcc command:

mido:/ # mcc --info

sh: mcc: can't execute: Permission denied

126|mido:/ #

:( What could have caused it?
[Magisk] Jaymin.0.1910:
mcc service blocks its execution while setting environment, wait a lil after booting, then upload service logs
[Magisk] pat357:
Same thing here :

/magisk/mcc/system/xbin/mcc has 0755 as it should be.

/system/xbin/mcc has 0644

This becomes this way after every reboot ; really a bit annoying ...

Remember that these files can have different permissions and even different content.

Changes in /magisk/mcc/system/xbin/mcc will only go to /system/xbin/mcc on reboot ; this is when Magisk "overlays/merges" the first one to the second.

After this, you can edit /magisk/mcc/system/xbin/mcc , without modifying /system/xbin/mcc .

(in this links you can replace /magisk/ by /sbin/.core/img/)

I do not see the need to block /magisk/mcc/system/xbin/mcc , as it is never directly used are called.

If you need to block anything, it would be/system/xbin/mcc, because this is the one that is used and called.

This 0644 for /system/xbin/mcc causes that the daemon can not start after rebooting.

Edit :

I also seem to miss the 120sec delay to start the daemon. This way you don't have any time to disable autoshut after restarting from autoshut.

Edit2:

A to consider workaround for this is set up busybox much earlier, like in post-fs-data or similar.

Did you maybe consider this already ? Similar to the Osmosis busybox which is always the first to thing to setup after magisk itself.
[Magisk] sandaljrpit:
currently I still use v1.3, but when the update there is a description of the failure ( failed ).

Thanks :)
[Magisk] pat357:
I got exactly the same error on my first attempt.

Your existing install is likely interfering with the compatibility tests from the new version.

Try again, but first type the following in the terminal (remember to plugin your phone)

su
mcc -e 5m

Leave the Terminal open and go to Magisk Manager and install.

Now it should install OK, but you'll get stuck when you type "mcc -i"

you be stuck with this message :

# mcc --info
sh: mcc: can't execute: Permission denied
[Magisk] Jaymin.0.1910:
Hi,

bind mounted files can not have different modes, nor different content, and all the changes to one file are reflected immediately on another is what I know from my experimentation with Debian 9.3, Linux kernel 4.9.82-1+deb9u3, if with Android it's different, please provide me a little insight on this and I will fix the issue ( of course, crediting you ).

I have added back 120s delay

Yep, I though about that, but as long as I'm not messing with SEPolicies and Magic Mounts and similar, I would recommend using late start service mode for boot scripts, and post fs data mode.
[Magisk] Jaymin.0.1910:
Fixed it.

Hi, I just found a good way that makes "mcc -e 5m" unnecessary.
[Magisk] nogaff:
Pixel 2

Been a bit busy so I haven't kept up with all the releases, but the last one I tried (1.3 I think?) was crashing my device during module installation and triggering a reboot, while 1.4.2 is giving me the same "Permission denied" error that others have already reported.

Let me know if you want some more logs or anything like that.
[Magisk] Jaymin.0.1910:
OK, So let me check..........

........... hmm... found the reason to be Magic Bind Mounts aren't identical to normal bind mounts:confused:. A fix will be up in an hour.:)
[Magisk] Jaymin.0.1910:
Everything got fixed with version 1.4.3, download from MM or 3rd post
[Magisk] nogaff:
Pixel 2

Now getting a "Failed to detect BusyBox, aborting..." error on 1.4.3 :D

Edit:

walleye:/ # find /data -type f -name busybox
/data/adb/magisk/busybox
/data/data/nextapp.fx/app_Exec/busybox
/data/data/com.keramidas.TitaniumBackup/files/busybox
[Magisk] Jaymin.0.1910:
Hi,

Can you attach service logs ??
[Magisk] RSDamasceno:
Hey dude?

I needed to change my phone, my old Moto G 2 came to an end and I bought a G 5S Plus...

I instantly unlocked the bootloader and installed the ROM Experience. I'm happy, after all... Lol.

This time I came to bring a new bug report, as seen in the screenshot.

The values ​​are configured without errors, but the load does not stop at the defined limit. I typed "mcc -i" and got notices "no reference set" and "failed to re-configure them".

(I noticed that you removed the location of the log files from the original post and description in the repository. Are you going to change anything about that?)

--------

Moto G5S Plus - XT1802

Magisk 16.2 (snapshot)

Pixel Experience 8.1.0

BusyBox 1.28.1 (YDS)
[Magisk] nogaff:
Pixel 2

Attached. Hope it's the right file.