yashsingh1/xdaforums huggingface dataset:
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
Thanks to W3Fan on the solution

for Readmi 6a whether running stock or asop or aex... etc it should work because they use same boot.img

you only need to modify kpoc_charger.rc file. this file located in system/etc/init folder

i use total commander to locate and edit the file.

replace the whole content in kpoc_charger.rc with the following:

on charger

setprop ro.bootmode "normal"

setprop sys.powerctl "reboot"

save the file to location you can locate later. i put in root internal sd.

boot to twrp in recovery.

mount system folder

go to advance / file manager

locate where you put that modified kpoc_charger.rc file and copy to system/etc/init

after copying, ( you still using file manager)

go to system/etc/init, tap kpoc_charger.rc file, tap chmod, type 0644 and done.

power off and connect the USB cable and it will reboot.

i have tested it on asop and aex
[Galaxy Tab Q&A, Help & Troubleshooting] gruniu78:
Android 4.2.2 cyanogenmod - I do not have the files described

Tablet Prestigio
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
for android 4, you have to search beginning of this thread. mine is for android 8
[Galaxy Tab Q&A, Help & Troubleshooting] Toobig:
Sorry ignore, already answered.
[Galaxy Tab Q&A, Help & Troubleshooting] gruniu78:
I install NoMoarPowah! apk

no file from the first post
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
most of the apk only works for samsung device. other brand, you need to tweak the smartphone system. and root is compulsory.
[Galaxy Tab Q&A, Help & Troubleshooting] gruniu78:
I have root.
[Galaxy Tab Q&A, Help & Troubleshooting] moltiluca:
thankssss!!!

Only this solution works with my Lenovo tablet...do you think is also possible to check battery percentage before to reboot the tablet?

With samsung smartphone I already made it working with lpm file, but with Lenovo it seems to be different
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
i am not programmer, untill to date nobody have come up with any solution on how to reboot only if the battery level high.

i however have found out if you depleted your battery juice somehow, you will go into endless reboot. the solution is just let it keep rebooting say for 10minute. then you try to enter into recovery mode, and let the battery recharge in recovery mode state. it seems that the recovery mode uses less power.
[Galaxy Tab Q&A, Help & Troubleshooting] serkos:
At last It works for me.

I think the problem is that we must have stock kernel and stock rom but rooted.only this way works

It work on Samsung Note 3 Samsung tabpro 8.4 SM-T320 and Samsung tab 3 7" SM-T210.

replace the lpm file with this code.

#!/system/bin/sh

/system/bin/reboot
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
i am here to confirm, Huawei mate 7 work with this method

---------- Post added at 09:40 PM ---------- Previous post was at 09:37 PM ----------

but on mate 7, you only need to modify init. rc file. theres no kpoc_charger on mate7. just add

setprop ro.bootmode "normal"

setprop sys.powerctl "reboot"

to the last line of on charger statement in the init.rc file
[Galaxy Tab Q&A, Help & Troubleshooting] Skodasuperbv6:
Can I found someone who can confirm this solution for Lenovo 8504x? Can I get boot.img from this person? I have problem to pack everything back... My email kamil.janiszewski@wp.pl Thanks in advance
[Galaxy Tab Q&A, Help & Troubleshooting] mobileanimal:
How to get Samsung S7 to Auto Boot on Power / Charger Connect - For Real

Wow!! There's so much non working nonsense out there for how to do this.

I have an Exynos S7 running stock Nougat, rooted, with TWRP recovery. I'm using it now for IoT applications in remote regions, and needed it to auto power back up after power loss and subsequent recovery. After a bit of hacking everyone's solutions together, here's what actually does work (for rooted devices only). Also - VERY IMPORTANT. It's weird but I found the phone would not auto boot when connected to an Anker USB wall power supply, but it did when connected to the USB on my computer, and 2 different models of multi-port LEPOWER USB wall chargers.

Create a text file with the below in it with your PC, favorite text editor, or whatever you want, just make sure to use UNIX style end of line (with line feed only, no CR), then put it on your storage somewhere or wherever you want to put it. For the purposes of this, it will be in my internal phone storage.

#!/system/bin/sh
/system/bin/lpm.bak &
sleep 300
su -c "echo 1 > /proc/sys/kernel/sysrq"
echo b > /proc/sysrq-trigger

Get to your shell however you like, then:

su

mount -o rw,remount /system

cd /system/bin

#make backup of lpm file and set permissions

cat lpm > lpm.bak

chmod 755 lpm.bak

chown root:shell lpm.bak

#Replace contents of lpm with your file, while keeping lpm in place (substitute file source as needed)

cat /storage/emulated/0/YourFileHere.txt > lpm

#Validate contents

more /system/bin/lpm

I set the sleep time to 300 seconds to give time for the device to charge before booting, but you can set this as you please. It seems the deal is here that you actually need to run lpm for a period of time so that it doesn't think you want to boot into recovery, so don't set the sleep timer too short. (40 worked for me as well). Also, using /system/bin/reboot for the reboot failed miserably, so don't bother.

Give thanks if this helps!
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
wonderfull

just wondering whether instead of sleep 300, is there any command to check battery level at least say min 3% before reboot otherwise charge the device to min 3% first
[Galaxy Tab Q&A, Help & Troubleshooting] mobileanimal:
Try the below (edit as you see fit and with what works for your situation). I just tested it and it worked for me! Also, I just updated my original post with a note about power supplies. For whatever reason auto boot doesn't work on 2 different Anker power supplies that I have, but it does on other power supplies.

#!/system/bin/sh
su -c "echo 1 > /proc/sys/kernel/sysrq"
/system/bin/lpm.bak &
sleep 20
while [ true ]; do
bat_charge=`cat /sys/class/power_supply/battery/capacity`
if [ $bat_charge -gt 10 ]; then
sleep 5 && echo b > /proc/sysrq-trigger
fi
sleep 5
done
[Galaxy Tab Q&A, Help & Troubleshooting] cj182:
I'm want to resume the Quick Boot function. Because the script above with reboot ignores the Quick Boot function and performs a normal / slow boot.

Pressing manually the power button in the battery charging screen performs a Quick Boot as desired.

Any ideas on how to solve that?

Edit: Android 5.0 with Quick Boot / Fast Boot (Lenovo Tab 2 a7-10f, SoC MT8127)

Found a solution! Imitate the power button press. For my old ipod file renamed as ipod.bkp and event0 as as input device (check yours with adb shell su -- getevent -p), this ipod file works:

#!/system/bin/sh
/system/bin/ipod.bkp &
while [ true ]; do

bat_proc=`cat /sys/class/power_supply/battery/capacity`

if [ $bat_proc -gt 10 ]; then
sleep 1 && su -c '/system/bin/sendevent /dev/input/event0 1 116 1' && su -c '/system/bin/sendevent /dev/input/event0 0 0 0' && sleep 1 && su -c '/system/bin/sendevent /dev/input/event0 1 116 0' && su -c '/system/bin/sendevent /dev/input/event0 0 0 0'
fi

sleep 10
done
[Galaxy Tab Q&A, Help & Troubleshooting] Barabba11:
I've a s5 g900v with Android 6.0.1, I've tried some scripts here but they didn't work for me, maybe I could make some mistakes.. but I'm quite shure.

This for example didn't work, it produces a couple a flashes on the screen and after the charge of battery:

#!/system/bin/sh
echo b > /proc/sysrq-trigger

but this yes, and it can control also the level of the battery, means that if the battery goes to zero (and this is the case for me, as I'm using the phone as videosurveillance it's always connected to electricity, and I needs it auto reboots if battery is drain out after long time blackout) it will wait it reaches 10% before boot. If the battery is too low the CPU needed for boot up will shut it down, recharge, and it will continue to an infinite loop.

#!/system/bin/sh
/system/bin/lpm.orig &
while [ true ]; do
bat_proc=\\\`cat /sys/class/power_supply/battery/capacity\\\`
if [ \\\$bat_proc -gt 10 ]; then
sleep 3 && /system/bin/reboot
fi
sleep 5
done\

You have to rename the lpm file in lpm.orig, create a unix formatted file (end with 0x0A instead of Windows 0x0A+0x0D) with this text and copy it as lpm file. You need also to set attributes:

chmod 0755 /system/bin/lpm

chmod 0755 /system/bin/lpm.orig

chown root.shell /system/bin/lpm

chown root.shell /system/bin/lpm.orig"

EDIT: the level of battery is not considered, I've simulated a drain out and plugged charger, it boots automatically. Well if the charger is original or good one, and the cable is in good conditions it should not be a probem, it should keep the phone on during the boot with high CPU usage and screen on.

I'm using a phone that can't be rooted, so I used safestrap to flash a rom where before I overwrote the file lpm, and I packed rom back

EDIT2: the script about to check the level of battery, before reboot (enought battery to avoid possibile discharge during boot/high cpu consumption), doesn't work, it will boot immediatly. I recomend to use a good charger with a good charging cable to ensure a charge of about or more 1000mAh. You can check this using app Ampere
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
can show steps you mentioned to flash unrooted rom.
[Galaxy Tab Q&A, Help & Troubleshooting] Barabba11:
Here is the thread I wrote with instructions:

https://xdaforums.com/verizon-galaxy-s5/general/how-to-boot-automatically-g900v-cid-11-t4044809

If you aren't root it's impossibile, I mean if your phone can't be rooted because bootloader is locked you will need to find a way, in my case there is a KitKat version for my phone that can be rooted, by that it's possibile to install safestrap, and safestrap it's a TWRP which allor you to flash zip files (which you can modify, voilà!).

---------- Post added at 03:56 PM ---------- Previous post was at 03:55 PM ----------

Here is the thread I wrote with instructions:

https://xdaforums.com/verizon-galaxy-s5/general/how-to-boot-automatically-g900v-cid-11-t4044809

If you aren't root it's impossibile, I mean if your phone can't be rooted because bootloader is locked you will need to find a way, in my case there is a KitKat version for my phone that can be rooted, by that it's possibile to install safestrap, and safestrap it's a TWRP which allor you to flash zip files (which you can modify, voilà!). More simply it's possible to flash in your phone TWRP and with that you maybe can already mount the /system and overwrite+copy files
[Galaxy Tab Q&A, Help & Troubleshooting] Barabba11:
New experience with an S3 Neo, it works with this lines:

#!/system/bin/sh

/system/bin/reboot

The file is playlpm, remember you need to save these lines with an editor that respects the linux standard, the endo of line should be 0x0A only.

Once you got the root permissions you should mount the /system partition in write mode, I used this zip file:

https://xdaforums.com/showpost.php?p=10691125&postcount=7

then I used root file manager app, and overwritten file. YOu beeter make a backup of file playlpm in advance. Remember then to give the execute permissions to new file, or it will not work.

PS: since the root installed SuperSU free edition, and since when I tried to edit a file in /system returned me a SuperSU log entry "you need the pro version for that" I rooted again changing the SuperSU.apk package with the SuperSU pro.apk one (of course I renamed it to have the same filename). I used the full apk which weigt about 5MB instead of the small apk I've found around. Anyway SuperSU pro didn't show me more an icon, so I installed KingRoot too. Only aftr this I discovered the mount.zip file so I can't tell the exact procedure, I just let you know you may do the same too.
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
i am trying to make auto boot redmi 6a on PIE

what i noticed we cannot modify boot.img as the init. rc or kpoc. charger do not exist in the boot.img when i tried to extract them using AIK

so, the only way is to replace or modify the files using twrp file manager within twrp

the files located at

system_root/system/etc/init folder

soi did that and

i have tried to modify init.rc and placing the

on charger

...... { to last line]

setprop ro.bootmode "normal"

setprop sys.powerctrl "reboot“

but it won't reboot when plug-in

then i tried to replace kpoc_charger.rc file with

on charger

setprop ro.bootmode "normal"

setprop sys.powerctrl "reboot“

line only.

it start to boot, but stuck at android logo.

so hopefully some can suggest what else i should do

and when i replaced the file at system_root/system/etc/init folder,

i chmod the file with 0644 within twrp file manager

so... any suggestions
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
ah...... my redmi 6a, suddenly cannot boot, even with pressing power button.

so...

i boot to fastboot, use miflash tool, flash back pie stock rom, then let the phone to boot.

set up everything in the phone, flash OTA update, update system file

then i boot back to fastboot,

flash boot_patch-global-stable-pie.img

flash twrp-3.3.1-redmi6a-wzsx150_b5_pie.img

boot to twrp recovery ( first time boot to twrp recovery need to hold vol + button until twrp logo appear twice)

flash magisk v20.

reboot to recovery

reboot to system

install magisk manager and run it

then boot to twrp recovery

go to advance file manager,

copy the modified kpoc_charger.rc ( see my above post on the content of kpoc_charger.rc)

to /system_root/system/etc/init folder, paste the kpoc_charger.rc there

( you may need to backup stock kpoc_charger.rc incase not successful)

then use file manager to browse to /system_root/system/etc/init folder

click kpoc_charger.rc and chmod 755

that power off the device.

plug -in to power

hoooray...

it booting....

so successful
[Galaxy Tab Q&A, Help & Troubleshooting] fritz.barnes:
I have a Samsung Tab A (SM-T510). I have implented the most common recommendation - replace /system/bin/lpm with a script that calls reboot. It isn't working. Does not seem to have any effect.

I instead added a line "echo ${%0} >> /sdcard/mylog" to the lpm file. The lpm script works (syntax okay, line breaks okay, etc.) if I execute it from adb shell, but if I shut down the device and plug it in, it just shows battery animation and does not write anything to mylog.

Permissions on my modified lpm are identical to the original lpm.

Does this mean that /system/bin/lpm -- although it is present -- is not the file that is being called for our purposes? I don't see any of the other file names that people have mentioned - battery*, charge*, kpoc*.
[Galaxy Tab Q&A, Help & Troubleshooting] fritz.barnes:
I should have mentioned tablet is rooted with Magisk installed, in case that matters. Sure would appreciate some help if anyone has any ideas.
[Galaxy Tab Q&A, Help & Troubleshooting] fritz.barnes:
Tobias Alrøe just pointed out that /sdcard might not be available so early in the boot process, which makes perfect sense.

So if I go back to assuming that lpm is called, I still need to figure out why my replacement script isn't working. Just seems to have no effect at all.

Contents of /system/bin/lpm:

#!/system/bin/sh
su
/system/bin/reboot

Permissions and line breaks are correct.
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
did you checked after boot, the modified lpm file still there. because some time the modified lpm file got replaced back by stock file.
[Galaxy Tab Q&A, Help & Troubleshooting] fritz.barnes:
Thanks. It is still there and unchanged from what I put in it.
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
from my own experience, if something get stuck, it means the comand in tge lpm file is wrong, you have to try different command.

i have successfully auto boot 4 different phone, S4, Mate 7, zenphone6, redmi 6a, they all need to use different command, eventhough i only changing the same file. in my case in init.rc and some by just changing kpoc file.
[Galaxy Tab Q&A, Help & Troubleshooting] tehvariance:
Hi guys, as a followup after trying again tonight it is working!

I came across a different link where someone posted his "one-liner" for doing this:

As mentioned previously, with me using Magisk users have reported "/system" mount not existing.

What it looks like it boils down to at least for me, is that every time I was trying this, I was doing a move/rename of the original /system/bin/lpm, then creating a new /system/bin/lpm (as root/root) and then doing a chmod 0755 and a chown to root/shell. Apparently this method did not work for me even though I was seemingly left with the same file with same permissions, but looks like since this person's one-liner does a copy to backup original /system/bin/lpm and then just overwrites the existing file contents with the simple shell shell script to auto-boot, this works!

I'm not sure if my situation is related to Magisk or what, I'm just not very familiar with Android mounts/partitions/etc. but if anyone is having a problem similar to mine, replacing contents of existing file worked for me.
[Galaxy Tab Q&A, Help & Troubleshooting] doktor29:
hello

i need some help with boot on charge on xiaomi device (mix2s)

what i did so far: its stary when usb connected.

But looking for solution like:

- when battery is lower like 20% it will not boot just charge till 20% and then start.

in xiaomi i dont see lpm, playlpm or kpoc file to edit :/

any help ?
[Galaxy Tab Q&A, Help & Troubleshooting] ivandena:
This "one-liner" script work for me too, thx!!

Is there any way to modify this script to speed up the boot?
[Galaxy Tab Q&A, Help & Troubleshooting] Allexxd:
Hello

can you please explain step by step
[Galaxy Tab Q&A, Help & Troubleshooting] tojnk:
Great solution. Made a few modifications to make it work on a Samsung Galaxy S6 (G920F):

su -c dd if=/dev/block/platform/15570000.ufs/by-name/BOOT of=/sdcard/boot.img

and added a sleep 10 after the last setprop to prevent empty battery boot loops
[Galaxy Tab Q&A, Help & Troubleshooting] Medicina200401:
Hi. I have a Samsun J7 Neo ROOT with magisk and original android PIE.

I don't know anything about programming, but I have modified the contents of the LPM file, using the ROOT explorer app.

Delete all your lpm content and try several of the codes published by you. For example this:

#! / system / bin / sh

its

/ system / bin / reboot

I turn off the cell phone, connect the charger, a circle appears with the lightning and then the screen remains black and does not turn on.

Could someone tell me how can I make it turn on when I connect it to a charger?:)

Thank you

Alexander
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
https://android.stackexchange.com/a/221384
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
redmi 6a, on android 8, global rom stock (converted from china rom) with magisk 20.4

alecxs

thanks for the link. solve my issues on another redmi 6a, on android 8, global rom stock (converted from china rom) with magisk 20.4

in init.rc file replace

the on charger line from

.....

on charger

class_start charger

to

on charger

exec u:r:magisk:s0 -- /system/bin/reboot

the device will boot twice when plug in charger
[Galaxy Tab Q&A, Help & Troubleshooting] sblueeye:
MXIII Auto Power on

Hi,

I have quite an old MXIII TV Box running Android 5.1. It runs a server that I need to keep alive but each power break it shuts down and won't power back on until i manually press the device on button.

Is there any solution out of the above that will automatically power on this device following a power break?

Thanks!
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
you need to root the device in order to modify certain file.

how to root your device? dont know. you need to ask around
[Galaxy Tab Q&A, Help & Troubleshooting] sblueeye:
Assuming I already rooted, which file needs to be modified?
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
usually we search init.rc, some in lpm, some in kpoc_charger file

basically searching for " on charger" line which instruct the system what to do. if you manage to find the "on charger" line any of those file, you need to replace or add command line to reboot.

that instruction are trial and error.

search the whole this thread on what command line to use.

good luck. and share here when you successful
[Galaxy Tab Q&A, Help & Troubleshooting] leahcimx:
Hello all, I've been googling and searching for 2 weeks now trying to figure out how to get my Samsung TabS6 Lite tablet to power on when plugged in. I bought it to install into a dash mounted tablet for my car, and this thread eventually got me there. I wanted to say what I did in case it would help others.

First of all, fastboot oem off-mode-charge 0 did nothing for me. I spent a lot of time trying different PCs/Cables/Drivers etc and though I never found exact confirmation, I suspect Samsung just doesn't allow this functionality in their bootloader.

First I'm using the standard rom except with Magisk having it rooted.

In Magisk I had to go into the settings and let superuser be for "Apps and ADB" and I had to reboot.

Then with ADB on my windows PC I could execute "su" in ADB Shell which let me do the rest of this.

ADB Shell commands

su

mount -o rw,remount /

(i couldn't mount the system directory, but I found a helpful tip somewhere that said mount the root and you can write to the system directory.)

cd system/etc/init

(now i have to create a text file. There's probably a lot better ways to do this, but ultimately I did it this way and could be done all through command prompt in windows, essentially we're creating a .rc file that turns off off mode charging.)

cat > off_mode_charge.rc

(this starts the creation of a text file called "off_mode_charge.rc" I don't think the name of the .rc matters just has to be in the init directory and .rc extension, the next line you'll be typing the lines of the .rc file)

# /system/etc/init/off_mode_charge.rc

(thats the first line, then press enter to do the second line)

on charger

(second line)

setprop sys.powerctl reboot,leaving-off-mode-charging

(third line, with 5 spaces, don't know if the spaces matter thats just how it was formatted when I found it on stack exchange)

Then press Control D to end the file. You should now have an .rc file called off_mode_charge.rc in your init directory and this file essentially tells the system to power on when plugged in. Apparently, all the inits are called at bootloader step. The charge animation still comes up at first, but then it will boot there after.

Finally give that file permissions (don't know if this is necessary but I did it and it worked)

chmod 0755 off_mode_charge.rc

chown root.shell off_mode_charge.rc

Finally set the root system to read only again

mount -o ro,remount /

And that along with a Tasker script to shutdown the tablet when it loses charge has it working for me. I'm just posting this as guest as I'm not a contributor here but I found a lot of this through a combination of

android.stackexchange.com/questions/20021/automatically-power-on-android-when-the-charger-is-connected/221384#221384

and the information posted here.
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
another successful auto reboot for Redmi 4x running stock android 7.1.2 mui11

need to change in init.rc the

on charger

class_start charger

with:

on charger

setprop ro.bootmode "normal"

setprop sys.powerctl "reboot"
[Epic 4G Q&A, Help & Troubleshooting] lviv73:
Anyone know how to change black statusbar color in gingerbread?

I went through frameworks,twframeworks and SystemUI apk's and found nothing.I changed pulldown bar but not statusbar.

Thanx in advance.
[Epic 4G Q&A, Help & Troubleshooting] lviv73:
Anyone????
[Epic 4G Q&A, Help & Troubleshooting] shane6374:
statusbar_background.9 in the systemui.apk
[Epic 4G Q&A, Help & Troubleshooting] lviv73:
Thanx but i already tried theming statusbar_background.9 and it doesn't change statusbar color,im on EG22.

Im starting to think its in .jar or .xml file because i themed all status bar related png's and top statusbar is still black.
[Epic 4G Q&A, Help & Troubleshooting] shane6374:
Ahh, well that was it for EF02. I'm betting framework.jar.