yashsingh1/xdaforums huggingface dataset:
[Magisk] donjoe0:
OK, some examples:

... should say:

... or whatever defaults are actually being enforced.

Also,

... should say:

Also, thanks for the super-useful app! :) I just switched to a new phone because of too much loss of battery capacity on my older phone and I was thinking it would be nice if the Android system had such a charging-limiting functionality. Just found the module by sheer luck while installing Magisk for something totally different.
[Magisk] underskyzx:
I found the problem it's the enforcing SELinux switching to permissive made everything work
[Magisk] kalawy:
That was one module.. more modules did various strange behaviour.. every disappearing module worked perfectly after removing blex..

If it's relevant .. all those mods also used hardcodded module path in sh files not the $MODDIR

About the charging.. what i meant that the phone already charged to 100 and the blex makes the device think it's just 89 or 90

That used to happen with mcs untill i use "mcs -x " and change the file used for charging indication
[Magisk] batrong2709:
how to remove blex ?
[Magisk] DenyDarko:
Uninstall the module and reboot I guess
[Magisk] justjr:
Bootloops feelings. What does it do with kernel while it tries to 'configure'? Cause, I think this might work different every kernel out there because of that.
[Magisk] NewDayRising:
I'm running Blex on Shamu with no issues. Very useful. I've tried installing it on Flounder, but I'm not having any luck. Low-hanging fruit first – is the Nvidia Tegra K1 SoC compatible with Blex?
[Magisk] underskyzx:
I had an issue that I believe is related to Blex.

After using SELinux permissive everything worked nice til now

Same error happened this time Blex, Magisk4Greenify and ADGuard DNS (not sure the correct name of this one) all stopped working, look how they look now on the screenshot.
[Magisk] underskyzx:
SS
[Magisk] Ali.G:
What is the other feature?
[Magisk] sharp3r:
[MENTION=8570610]MCMotherEffin'[/MENTION]

Thanks for this awesome module but it doesn't work for me!!

I installed the module while charger connected, passed compatibility test reboot but when i ran it it didn't work!!

I'm on helios rom with magisk 15.3

Thanks
[Magisk] Jaymin.0.1910:
It's built into the background process, needed to re-enable charging on some typical devices ( mostly HTC ) without rebooting, if it wasn't there charging will be disabled but not be enabled with hitting down_threshold
[Magisk] Jaymin.0.1910:
Logs are saying that magisk failed to mount system mirrors, therefore no magic mounting will be enabled, please test any other module that use magic mounting and see if they successfully mount!!! also you seem to be using a debug build of magisk, so if no module is able to magic mount, try using the latest stable release
[Magisk] Jaymin.0.1910:
Oops, my bad, don't mind the above one,

system mirror was actually mounted with the second try, but /system/xbin don't seem to be existing, though mcc still has a workaround for this which will install mcc into /system/bin, can you run

tar -czvf /cache/mcc_dump.tar.gz /sbin/.core/img/mcc/.

and upload /cache/mcc_dump.tar.gz here

Thanks
[Magisk] sharp3r:
First of all thank you for your answer. I'm using the latest stable build 15.3 and it turns out a kernel problem, i switched to latest moro kernel and now it's working fine. One thing. Led notification always red. I had to toggle off the daemon and restart to solve it.

Thank you very much!
[Magisk] sharp3r:
Here is the logs your requested but it's with moro kernel. Do you need them with the old one? I mean with helios ketnel
[Magisk] sharp3r:
I thought it's working but it's not!!! I get a positive output but the phone didn't charge at all!! Same value i left i found. Toggling off the daemon and I'm back charging.

Using the enable arg, charging stops... i interrupt the command and still not charging. Turn on and then off the daemon and it's back charging

I'm using the latest version 1.1
[Magisk] helmyhel:
How to get the battery fully charged? Because if 85 battery has stoped charging
[Magisk] Jaymin.0.1910:
Hey, did you either re-install mcc or ran

mcc --reconf

after flashing new kernel ??
[Magisk] Jaymin.0.1910:
Hi, please refer to [mcc --help] or README for available commands to configure it

you will need to use a terminal emulator for this, most custom ROMs come with them, so using that built-in one is advisable, or else using Termux would be my recommendation
[Magisk] ugvpkn:
Can't update to the latest on Nexus 6P

I have a Nexus 6P running ABC Rom. I had version 201801251 with Magisk 15.3; after about a month a updated to Magisk 15.4 and now when I try to update to the latest mcc version it fails with

"Your device don't support these functionalities"

I have attached the install log. Thanks !!
[Magisk] ugvpkn:
mcc.conf

And here is the mcc.conf from /sbin/.core/img/mcc. This older version of mcc works perfectly on my phone (Nexus 6P ABC Rom February Patch Level). Thanks !!
[Magisk] Jaymin.0.1910:
It is a recent change in Magisk Manager, the new version of MM uses pure POSIX environment for flashing zips, which don't support arrays ( installer uses them to reduce code ) and some other stuff the current installer uses, so any version of mcc will not work with MM 5.4.0, I have ported the installer from mksh to POSIX, but I'm also testing some other features, so, I'd push the new version maybe today or tomorrow ( GMT +5:30 )
[Magisk] ugvpkn:
Thanks for the update !! Please take your time.
[Magisk] theman480:
Hello McMotherEffin', first thank you for the amazing module.

My problem is, I Flashed it on magisk , everything seems to be fine.

But when I reach the threshold I set, nothing's happens.

I have attached the screenshot.

Thank you in advance!
[Magisk] Jaymin.0.1910:
Hey, it has been confirmed working on Mi A1 by [MENTION=7330585]CCL108XIV[/MENTION], I will release a build today ( GMT +5:30 ), try that and then if it don't work, just attach /sbin/.core/img/mcc/cache/ and /sbin/.core/img/mcc/mcc.conf
[Magisk] theman480:
Ok, waiting, thank you.
[Magisk] Jaymin.0.1910:
Important Notice

Hi all users,

This is to inform that the Magisk Manager forbids some features that are used by the installer starting from version 5.4.0, so, any version of the module will not install if you are on that version and will also break charging ( until a reboot ), and I somehow had lost both of the OSes from my laptop, thus I ain't able to push the updated version that'd work with the newer Magisk Manager, so please do NOT install mcc unless you have not updated MM

I'm sorry for the inconvenience

The Developer,

MCMotherEffin'
[Magisk] Flax_:
I have excact the same problem.

Everhting besides this works.

I set 80 / 60 and autoshut to off (and 7%).

Samsung Galaxy S7 with latest Superman Rom.

Stock Kernel.
[Magisk] Jayraj Zala:
need charging disable on demand feature !

if it's possible please implement a command to stop charging without any conditions. like with mcs using command

stops charging. i am using this with Automagic/Tasker which first checks battery level if it is below 90% i use

, but if it is above 90% i just want charging to be stopped.

Can i use blex alongside with mcs? I just need that one command (mcs -d) or will it cause issues?
[Magisk] kalawy:
It is related.. uninstalled it for the time being
[Magisk] Jaymin.0.1910:
For charging issues, can you send me your /sbin/.core/img/blex/blex.cfg file ??

Uninstall from Magisk Manager.

It tries to find the sysfs control node in /sys pseudo filesystem, it will not harm in any way since they do not survive reboots :). What do you mean by 'Bootloops feelings' ??

It is compatible with almost any newer arm-based chipset, A15 seems just too old to support blex.

Why do you run those commands in tasker, you need to only run that command once and the blex daemon will keep running in background and do that for you, such one-shot feature can not be implemented due to the complexity of how the daemon and manual methods communicate.

You should not use it alongside mcs, both of these use different approaches which might lead to issues eventually, choose either one.

To everyone seeing modules disappear, that seems to be because of hardlinked BusyBox applets, Magisk internally does not detect hardlinks and leads to such errors when merging images which have hardlinks, the newer release 0.2 uses symlinks instead, so the issue should be fixed.

Best regards and cheers.

Jaymin Suthar.
[Magisk] justjr:
Sorry, I mean I did had bootloop after installing it. Only removing from recovery solved it.

Enviado de meu SM-G900M usando o Tapatalk
[Magisk] Jaymin.0.1910:
Check if you an xbin folder in your /system first, then see if you're able to install any other module that installs an executable (like Terminal Debloater or MagiskHidePropsConfig).

Kindly inform me with the results so I can help fix the problem.

Best regards.
[Magisk] yujinloh:
I've installed it through magisk and tried to configure by the command "blex --configure" but after I plugged in my device and pressed enter it says "error "

I didn't found any logs in both paths mentioned above.

I'm using magisk v17.1.

Advice?
[Magisk] PacoBell:
I don't know if it's just me, but when the Power threshold is triggered my P2XL immediately shuts down (not gracefully, but I can live with that). The problem I'm seeing is that when I plug in the charging cable the battery charging icon displays at full brightness and never progresses to the charging animation or eventually times out and turns off the display. It just keeps that bright icon on the display which will eventually cause burn-in on the AMOLED pixels unless I hold down the power button for a while to force it to reboot. Any way to work around this?
[Magisk] Hellsingoff:
Failed to configure blex
[Magisk] XJonathanX2:
Today I found this module and I find it quite interesting! I already installed it with magisk and have my terminal ready but I don't know which commands I should use to extend my battery life and I'm scared to mess things up. :eek: Can someone help me? :)
[Magisk] NewDayRising:
"It is compatible with almost any newer arm-based chipset, A15 seems just too old to support blex."

Thanks for checking into it. One of the downsides of buying older but rootable/flashable tech.
[Magisk] blue whale:
I was just about to flash the zip on a samsung s2 rooted with los 14, is it too told for blex ?

---------- Post added at 03:30 PM ---------- Previous post was at 03:27 PM ----------

If I install blex without magisk on the phone, then there is noway to remove it?
[Magisk] Jaymin.0.1910:
You can try it always, it wouldn't harm you in any way. As of Exynos 4210, A9 seems to be old though.
[Magisk] blue whale:
Yeah but I want to know how to remove blex if it does not work, and my samsung s2 has no magisk for it
[Magisk] Jaymin.0.1910:
To uninstall blex in system mode,

1) Delete /data/adb/blex folder

2) Delete /system/xbin/blex

3) Delete /system/etc/init.d/99blexd

4) It's gone, reboot and enjoy.

I will soon create an uninstaller once I've gotten time.
[Magisk] gatsuu:
Hello guys,

this version mcc-2.0.MR-201804181-stable-signed.zip is compatible with xiaomi mi8?
[Magisk] NewDayRising:
I think I borked something in the upgrade from 0.1.4 to 0.2. I can set everything up, run it fine, modify the switch, get one charge, then I have to run configure again to get it to charge. I verified both my wireless and wired charge were working without blex. Uninstalled blex and re-installed it multiple times, re-flashed Magisk in case the addon script was wonky after flashing my weekly ROM, and re-flashed Lineage OS. Specs: Nexus 6, Magisk 17.2, blex 0.2, Lineage OS 15.1 (20181009). Running blex --info after configuring for settings gives me:

************************************

Battery Life Extender (blex) CUI

************************************

Battery Information

- Level : 63

- Health: Good

- State : Not charging

Current Settings

- Auto Switch thresholds: 75, 70

- Auto Power threshold : 20

- Auto Switch state : ON

- Auto Power state : ON

Daemon State: Running

Attaching logs; not sure what I'm overlooking.
[Magisk] Jaymin.0.1910:
Please read the docs, I've clearly stated that it works with all modern arm chipsets, so yours is supported.

Can you uninstall it, reboot and re-install in again from recovery ?? After configuring with blex --configure, can you send me /sbin/.core/img/blex/blex.cfg ??
[Magisk] NewDayRising:
Okay, I'm using Magisk. When I uninstall it via Magisk Manager, reboot, and flash it in TWRP, then reboot and run blex --configure, terminal gives me a return of "sh: blex: not found". Is there a step I'm missing? My understanding was that you could either install it through Magisk, but not recovery if using Magisk. I've tried flashing both the signed zip for 0.2 and the .zip file downloaded through Magisk.
[Magisk] Jaymin.0.1910:
Oops, seems to be a Magisk bug, can you send me your Magisk logs and also check contents of /sbin/.core/img/blex ??
[Magisk] NewDayRising:
Okay. Adding the logs + kitchen sink – main and boot for blex, and magisk and magisk_debug. Do you still need the blex.cfg file? Used Magisk to install the 0.2, configured it, confirmed it was charging at original settings, and pulled the logs.
[Magisk] Jaymin.0.1910:
OK, analyzed the logs, blex script was Magic Mounted properly, do you have any bugs with charging now ??
[Magisk] NewDayRising:
Same issue. I can charge multiple times if I don't hit the upper switch limit – 80 right now – but as soon as I hit that and go to charge once my battery level drops below the lower limit – 70 right now – I have to run configure again.
[Magisk] Jaymin.0.1910:
Weird issue, please send me your blex.cfg file in this case :)
[Magisk] NewDayRising:
Attaching it from the current setup, which has no modifications after running blex --configure. Zipped because .cfg isn't an accepted file format; let me know if that's an issue.

Real talk? Your app/mod is useful enough that entering a line or two of text in terminal before a charge isn't a major issue. I'll gladly provide any files you need to troubleshoot it, and would even, if it's possible in Magisk – roll back to 0.1.4 to see if the issue was introduced by the blex update or elsewhere, say the ROM. I'll take a look at the maintainer's commits. The only thing I think could potentially be in the mix is that Elecktroschmock added some fine tuning to the battery after some battery drain issues as of 10/2 nightly of Lineage OS for the Nexus 6/Shamu specifically.
[Magisk] gatsuu:
I got error 1 in twrp when I flash it. (mcc-2.0.MR-201804181-stable-signed.zip)

I have Magisk 17.2 and Magisk Manager installed.
[Magisk] Jaymin.0.1910:
That version you flashed is very old and pretty much abandoned, can you try installing latest version of blex instead ??
[Magisk] gatsuu:
Thank you, I have blex 0.2 now.

I downloaded termux and typed the following command:

but tells me that the blex command was not found
[Magisk] Jaymin.0.1910:
Kindly send me installation and Magisk logs for analyzing.
[Magisk] gatsuu:
I don't find nothing in dev and blex directory
[Magisk] Jaymin.0.1910:
You have to pull blex install logs right after flashing blex. Magisk logs after rebooting will also be helpful.
[Magisk] gatsuu:
This is blex_install.log, recovery.log and magisk log in attachments.
[Magisk] Jaymin.0.1910:
Your recovery has bugs mounting loop devices, try installing from Magisk Manager and see if that works. Send me blex install logs and Magisk logs (after reboot) if the issue occurs again.
[Magisk] gatsuu:
Same problem, command blex not found in Termux.
[Magisk] Jaymin.0.1910:
This time blex is Magic Mounted properly.

Are you running su first ?? Remember that Termux has its own environment which might not recognize blex.
[Magisk] gatsuu:
Thank you very much, with su it works.

Now I have configured, I have to do some other operation to optimize the battery?

Thank you again!
[Magisk] Jaymin.0.1910:
You're welcome,

Here are quick tips regarding optimizing battery,

For best battery life, set Auto Switch thresholds to 50 40 and Auto Power threshold to 10.

For best convenience, force set Auto Switch thresholds to 90 80 and leave Auto Power as is.

For balanced experience, stick with defaults.
[Magisk] gatsuu:
Is it normal for the charge to come off suddenly? Now it has stopped at 78%, it does not charge anymore.

I have stock default
[Magisk] Jaymin.0.1910:
It isn't normal, what are your thresholds ?? Please send me /sbin/.core/img/blex/blex.cfg file.

BTW, there can also be other factors, like I/O current imbalance.
[Magisk] gatsuu:
I solved by restarting the smartphone and configuring blex again (blex --configure), now it loads quietly.

But when I upgrade my rom with only wipe cache and wipe dalvik, do I have to re-install blex again or stay installed and already active?

And when I upgrade magisk to a later version? Do I have to install blex again and configure it?

Whether for magisk updates and for rom updates?
[Magisk] Jaymin.0.1910:
I'm glad you solved it.

You will need to re-configure blex after flashing your ROM since the kernel would have been updated, but upgrading Magisk doesn't require anything though (unless there are major changes to Magisk's module structure).
[Magisk] gatsuu:
You are very kindly, thank you very much.
[Magisk] infixremix:
Hi , I don't consider my self a noob at anything normally but this module has got my tonge in a twist so once do blex --configure what do I do I've toggled autoswitch is there anything else needed ?
[Magisk] davidzam:
I like your module don't get me wrong, but, Like infixremix, I am in the same position. The syntax is to complicated. And I like module's where I do have absolute control. So I need to know the exact commands to get the following configuration:

Stop Charging when battery reach a 100% value

And I DON'T want the smartphone to turn off itself at 20% or 15%, I wan the device to use the complete charge of the battery.

I only need this because I don't want to left the phone receiving electricity when it reaches a 100% charge, that's all. I live in a place where I need to use every bit of energy that my device can offer, and I want to be able to use it, even if the battery reaches a 1%, I want to be able to use the energy savings features of my device ROM. Please, what are the exact commands to achieve this. Thank you.

PS: I just did the update through magisk. So module it's inactive. I want your precise instructions to activate using the setting I described above, awaiting your answer. Thank you.
[Magisk] Evengard:
blex --enforce --update switch 100 #this will stop charging when the phone will reach 100% and slowly discharge until it reaches 90%, then it will charge back to 100%, repeating forever
blex --toggle power OFF # This will allow you to use the battery until it have at least some energy, preventing auto off
[Magisk] Jaymin.0.1910:
I recommend setting up Auto Switch and Auto Power, other than that, nothing needs to be setup.

Firstly, note you can not set thresholds to 0 or 100 since they are boundaries of levels and have some tricky parts of charging.

If you want to disable charging at 99%, you can run the following command:

blex --enforce --update switch 99

If you want your phone to not shut down, please use the following command:

blex --toggle power OFF
[Magisk] infixremix:
I did the auto switch at 99 it charges up but doesn't keep the charge it just stops. This is why I came here and asked. I have to disable module to charge again
[Magisk] Jaymin.0.1910:
If you want to keep charging level constant at 99%, run

blex --enforce --update switch 99 98

This will keep level bounded between 99 and 98, which should be fine I think.
[Magisk] infixremix:
Awesome this will stop overcharging so cheers
[Magisk] LiNe1771:
First cycle was fine (I think, didn't checked) but on 2nd cycle, was just horrible, this module gave me that wakelock, I'm sure that was the module because after removing it all became fine.. What can be causing this on the module? I changed my auto switch thresholds for 80 60, nothing more.. At this moment I'm not using the module because it completely ruined my doze and drained my battery.. Never saw this wakelock in my life..

Enviado do meu SM-G965F através do Tapatalk
[Magisk] nongthaihoang:
Blex is always in top ten most used cpu processes. I don't think that's good.
[Magisk] gatsuu:
Hello [MENTION=8570610]JayminSuthar[/MENTION],

I have the same problem again, in a random way the charge is blocked, usually always around 78-80%.

How can I solve?

# Battery Life Extender
# JayminSuthar @ xda-developers

# Copyright (c) 2018 Jaymin Suthar. All rights reserved.

# This file is a part of "Battery Life Extender (blex)".

# blex is released under the terms of GNU GPL v3 as published
# by the Free Software Foundation, and you hereby are allowed
# to use, modify or redistribute it, either pieces of it or
# entirely under v3 or any later version of the GPL.

# blex is developed in a hope of being useful, but neither
# warranty nor support are provided with it, not even fitness
# for the particular purpose. See the GPLv3 for details.

# A copy of GPLv3 (COPYING) is placed in the root folder of
# blex, see <https://www.gnu.org/licenses/> for more.

auto_switch=true
auto_power=true

thr_disable=80
thr_enable=70
thr_power=20

uevent=/sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/uevent
switch_1=/sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply/battery/input_suspend 0 1
switch_2=dummySwitch

switch_do=default

---------- Post added at 07:00 PM ---------- Previous post was at 06:52 PM ----------

This

don't work for me, why?
[Magisk] mv0hra:
I find my phone vibrating in the middle of the night when left on charge. When I remove it from the charger it stops. Is there a config in blex that might be responsible for this?
[Magisk] vealoth:
Issues with charging after installing module

So i am running stock android pie with magisk, and i installed/configured this module. Now when i try to charge my phone while its off, it tries to boot and gets stuck in the boot animation. I can still power it on and use it but if i want to charge i have to turn it on. Im relatively new to rooting and all this so please bear with me. If theres a log file i need to get i can i just dont know where it is. Here is a list of the commands i ran in terminal.

blex -- configure

blex -- update switch 99

blex -- toggle power off

Can anyone help me with my issue?

Edit: Forgot to mention my phone. I am using an Essential PH-1
[Magisk] mv0hra:
[MENTION=9516827]vealoth[/MENTION], I have test this and can confirm that I too have the same issue.

[MENTION=8570610]JayminSuthar[/MENTION], is there anyway we can see why these 2 issues might be happening?
[Magisk] Hastaloego:
[MENTION=8570610]JayminSuthar[/MENTION]

how can i get a battery use reset once battery level reaches the max threshold like it would at 100% ? without my phone can't tell me the "last time fully charged" and therefore its hard to track app power usage.

also when max threshold is reached, power starts to drain fast cause wakelock chg_wake_lock which prevents the phone from standby mode and keeps it active with screen off.
[Magisk] Jamess27:
Maybe you can see "from unplugged" in the battery monitor app
[Magisk] Jaymin.0.1910:
Guys, IRL I have to prepare for my exams now, I can't lose on my marks. So for about a month or a little more, development will be either abandoned or slow, please understand.

I'm sorry for any inconvenience it might brought to you in meantime. I will be working back on it as soon as exams are finished.
[Magisk] mv0hra:
[MENTION=8570610]JayminSuthar[/MENTION] good luck with your exams! And thanks for the development so far.
[Magisk] vealoth:
Okay, so i have tried reversing the changes i made in terminal, uninstalling/reinstalling your module, nothing fixes my issue. Would returning to a stock image fix it, or would that brick my phone?