yashsingh1/xdaforums huggingface dataset:
[Galaxy Tab Q&A, Help & Troubleshooting] akatarmo:
Some time ago I was investigating this matter. True, the ipod file is executed to shutdown the devicer when QuickBoot is On (on MediaTek devices). But if you replace this file with the normal script that is discussed in this thread, then happens what you say: the device reboots instead of shutting down.

I found a solution, not very elegant i think, but effective. I don't know if it will work on your device For mine, a generic chinese tablet based on MTK-6589 chip, found a file that stores information about the status of the tablet in relation to the charger. This file is in this path: /sys/class/power_supply/battery/status and the info it contains can be:

Charging

Not charging

Full

Then I have modified the script. Every x time checks the status battery file and at the moment its state is "Charging" (charger connected) then launches a Reboot. Here is the modified script:

---------------------------------------------------------------------------------------------------------

#!/system/bin/sh

# Infinite loop

While [-1]; do

var=$(cat /sys/class/power_supply/battery/status)

Sleep 1

if [ "$var" == "Charging" ] || [ "$var" == "Full" ]

then

/system/bin/reboot

fi

Done

---------------------------------------------------------------------------------------------------------

If your device has the status file I mentioned above, is very likely that this script will work for you. You can test it and publish here the result.

I have not found on my device any file (as kpoc_charger) that handles the battery animation when QuickBoot is Off. Which path is in yours?

Regards.
[Galaxy Tab Q&A, Help & Troubleshooting] tjoh:
I am searching for a solution since a few weeks. Unfortunately I do not have any of the files mentioned (lpm, playlpm, ipod, kpoc_charger, charge...), which is why I don't know which one would actually be called for displaying the battery animation....

I have a Samsung S4 mini Duos (i9192) with LineageOS 7.1.2.

Does anyone have a hint how to identify the file? (None in /system/bin actually even contains "charg" or "lpm"... in the name). I would be vera grateful, as my power button hardly works to start the phone from being off. Takes lots of trials before it finally will start... Very annoying. (Strangely enough the power button works without issues once the phone is up and running.....)
[Galaxy Tab Q&A, Help & Troubleshooting] chy_vak:
Any luck? Looking to get this done on my Nexus 5
[Galaxy Tab Q&A, Help & Troubleshooting] trugs:
help fo s4 i9505

hello everyone,

sorry for my bad english,

I need help to make my s4 reboot when charger is connected.

I have omega rom v19 android 4.3,

i tried to modify playlpm file in system/bin and also tried with auto boot app, but not working.

Someone know what is the file that manage animation of battery when charger is connected?

I really need your help.

Thanks
[Galaxy Tab Q&A, Help & Troubleshooting] eriksson25:
Same thing for me, Trying to get a S4 mini i9195 to boot on charge but no luck. Have tried rooted stock 4.4.2 and varius custom roms, right now on LinageOS. Anyone have any idees?
[Galaxy Tab Q&A, Help & Troubleshooting] codryn:
I have a Lenovo tablet and I don`t find any files related to battery animation (kpoc_charger, ipod, lpm etc), run fastboot oem off-mode-charge 0 is not working. I have tried to edit status file to put inside your script but the file is not saved, is reverting every time to charged status.

edit: found a rom that had kpoc_charger and ipod file inside /system/bin/ . They had in common charging word and some othres. I copied all my files from /system/bin/ to PC and opened all of them with notepad++. I search those words on my files and I haven`t found any. So there is no file in bin folder that have any relation with charger or battery animation file on Lenovo YT3-850F android 6.0.1. WTF GOOGLE ?
[Galaxy Tab Q&A, Help & Troubleshooting] akatarmo:
No, sorry, you do not have to modify the status file. This is a system file and android is constantly updating it. You must modify the ipod file that is in /system/ bin, as I have specified, to check the status file and turn on your device when the status changes to "Charging", which means that the charger has been plugged in.

But if you can not find the ipod file, then you can not apply this patch

I hope I have explained well, sorry for my bad english, it is not my native language.
[Galaxy Tab Q&A, Help & Troubleshooting] codryn:
I understand thank you for reply.

edit: after some research and I don`t remember how many google pages and searches I found that you can achieve this function using:

1. Enter Fastboot Mode (adb reboot bootloader)

2. Enter Command: fastboot oem off-mode charge 0

3. Enter Command: fastboot reboot

if that is not working for you maybe this one will work:

1. search in /system/bin/ for playlpm, ipod, lpm, kpoc_charger or any other file that have inside some reference to battery animation.

2. edit that file, delete all content inside and add

#!/system/bin/sh

/system/bin/reboot

if that is not working you can try this:

1. Unpack boot.img and edit init.rc.

2. Add following to the end of file:

#Check if chargermode and start autoreboot service.

on property:ro.bootmode=charger

start autoreboot

#autoreboot service which command reboot

service autoreboot /su/bin/su /system/bin/reboot -c reboot now

user root

oneshot

3. re-pack boot.img

None of that worked for me but I had an idea. Why not just create that damn file inside /bin ???

1. unpack boot.img

2. edit > ramdisk > init.target.rc (your file may have a different name then mine but search every file for "on charger" word using notepad++ and when you see that below that line are some "start" services you found it)

3. add start kpoc_charger to "on charger" line	*** "kpoc_charger" can have any name be free to name it ***

4. add after:

service kpoc_charger /system/bin/kpoc_charger

class charge

5. create kpoc_charger file on root/system/bin/ with 755 permissions using any root file managers

6. edit file and add:

#!/system/bin/sh

/system/bin/reboot

Have fun and enjoy this.

edit: tool used to unpack and repack boot.img: https://github.com/osm0sis/Android-Image-Kitchen
[Galaxy Tab Q&A, Help & Troubleshooting] eriksson25:
Thank you for this post! I will have a goo at the last part (since option 1 and 2 dont work for me, tried).

One question. What software do you use to unpack and repack the boot.img?
[Galaxy Tab Q&A, Help & Troubleshooting] codryn:
https://github.com/osm0sis/Android-Image-Kitchen

Just drag&drop boot.img file to unpackimg.bat and is done. After editing just execute repackimg.bat and it will generate a new boot.img. Put that file inside adb folder, enter fastboot mode and flash that *****.
[Galaxy Tab Q&A, Help & Troubleshooting] eriksson25:
Thank you! I have a problem. I get error Android_win_tools\file not recognized as internal or external command. when unpacking.

I dont actualy have a "Android_win_tools\file" How does it look for you?
[Galaxy Tab Q&A, Help & Troubleshooting] codryn:
Try this one: https://xdaforums.com/android/development/tool-cika-carliv-image-kitchen-android-t3013658

I have used both of them without any error. First one is easier to use, second link you have to choose numbers in cmd and takes more time to do that.

Edit: be sure to have .img extension of boot file.
[Galaxy Tab Q&A, Help & Troubleshooting] eriksson25:
Was my misstake. Downloaded directly from Github and then some files where missing. Now found the right file in the XDA thread and it works!
[Galaxy Tab Q&A, Help & Troubleshooting] pieriin:
Please can anyone help me? I have a cubot x10 with a mediatek 6592 running android kitkat 4.4.2.

I tryed to edit ipod file with all the string I’ve found on this topic but with no luck.

I’ve tryed :

#!/system/bin/sh

/system/bin/reboot

#!/system/bin/sh

su

/system/bin/reboot

/system/bin/reboot

I’ve also renamed reboot in ipod but nothing worked.

I’ve edited the ipod file with total commander editor and give the 777 permission, I tried also to edit the file with notepad++ in windows and save it in UNIX format.

I don’t know what else can I do.

I've another cubot phone with jellybean and with ipod edited as above it boot on charge with no problem.

With the original ipod file the battery animation start normally meanwhile with the edited ipod the battery animation don’t start so the file is the right one.

Can anyone suggest me what can I do?
[Galaxy Tab Q&A, Help & Troubleshooting] knjigor:
Hi, I have Lenovo P70-a with Android 5.1 and I'm trying to accomplish this with your script, I have checked all files needed and they are ok (they exist on phone) but when I turn phone off and plugin power cable it just vibrate 2 times, red light for charging isn't on and I have to use vol up + power button to turn it on. Could you assist me with this? For editing I'm using ES File Explorer Note editor as root.
[Galaxy Tab Q&A, Help & Troubleshooting] akatarmo:
I'm sorry I can not help you, this script works on my tablet and I do not have a Lenovo to try :(
[Galaxy Tab Q&A, Help & Troubleshooting] knjigor:
Thanx any way, I have manage to solve it by

1. enter FASTBOOT mode

2. Connect phone to computer via USB

3. Go to adb folder and then press SHIFT+RIGHT CLICK

4. Select command prompt

5. Enter "fastboot oem off-mode-charge 0"
[Galaxy Tab Q&A, Help & Troubleshooting] Rass King:
could anyone send me the folder reboot content (code) from the System/bin/reboot? I made a mistake and replace the code suggested above with that in reboot folder, now I lost the wifi and Bluetooth connection instead of auto reboot on charge. Thanks for your help in advance.
[Galaxy Tab Q&A, Help & Troubleshooting] abhic7:
Hi All

I just did this.

1. For people where the reboot is going to recovery issue. Solution below, code must be EXACTLY in this format. I would advise using ES file explorer as i used this and worked. Avoid using notepad on PC.

#!/system/bin/sh

su

/system/bin/reboot

2. AOSP based roms does not support this.

Their is no charge animation file in the system/bin folder for AOSP roms. I have tried and failed in finding the file

This solution only works for all Samsung TouchWiz roms.

If anyone is able to find the charge animation file for AOSP based rom please let me know.

Good Luck
[Galaxy Tab Q&A, Help & Troubleshooting] edwardenglish:
Hello,

I am eagerly interested in auto booting my device when connecting a charger, too. I use a Xperia Z1 Compact with AICP based on nougat (tried oreo too, no success). This ROM is LOS based so solving the problem could probably mean a solution for all LOS based ROMs.

Basically, none of the guides from the internet helped to do the trick.

There is no lpm file in the system/bin folder, and no chargemon file either.

The fastboot command

fastboot oem off-mode-change 0

was unsuccessful either. It gave me the result "too many links".

I started to search for the files myself and came to the following results:

Within the system folder the .init and .rc files can be found.

I located the file init.msm8974-common.rc (msm8974 could be replaced with your device's name or board chipset) and within that file I found:

charger
chown root system /sys/module/qpnp_charger/parameters/charger_monitor
chown root system /sys/class/power_supply/battery/input_current_max
chown root system /sys/class/power_supply/battery/input_current_trim
chown root system /sys/class/power_supply/battery/voltage_min
chmod 0644 /sys/module/qpnp_charger/parameters/charger_monitor
chmod 0644 /sys/class/power_supply/battery/input_current_max
chmod 0644 /sys/class/power_supply/battery/input_current_trim
chmod 0644 /sys/class/power_supply/battery/voltage_min

and

charger /sbin/healthd -c
class charger
seclabel u:r:healthd:s0

Searching for healthd gave me the idea, that this is the service managing the charger properties and its behavior. Unfortunately its a compiled and unreadable binary file. I wonder if one could alter the healthd file it could be possible to automatically boot the device instead of going to the loading screen.

Maybe my ideas can help solving the issue.
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
I have been researching about this topic for quit some time however, unsuccessful, unfortunately.

It is because some of the issues as I was told

1. You can't change the file at adb level as its a low level file that can only be access at fastboot command.

2. I also was told the manufacturer might not implement that particular command for some reason unknown to us.

3. Different phone have different command instruction.

You can search at xda, "abootool", a tool that can be run to give you all fastboot comand specific for your phone.

Unfortunately, the tool is in python language. That were I got stuck. Tried once but it says missing certain file. This tool can also be found at Github as still being updated.

If you manage to get it run, plz share with me.
[Galaxy Tab Q&A, Help & Troubleshooting] igcek:
Found solution that works on Samsung Galaxy Tab A6

For me the reboot scheme didn't work but what did work was putting into /system/bin/lpm this:

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

Hope it helps someone :)
[Galaxy Tab Q&A, Help & Troubleshooting] W3Fan:
Hello,

None of the proposed solutions worked for me on Samsung Galaxy Tab A 10.1 (T580) with Android 7 (no boot, black screen, boot to Recovery, etc.), but after much testing, I've found another way to make it work.

Extract boot.img from the rooted device and copy to PC (13540000.dwmmc0 -> T580's boot partition):

adb shell "su -c dd if=/dev/block/platform/13540000.dwmmc0/by-name/BOOT of=/sdcard/boot.img"

adb pull /sdcard/boot.img

Download Android Image Kitchen:

https://xdaforums.com/showthread.php?t=2073775

Drag-and-drop boot.img to unpackimg.bat.

Open ramdisk/init.rc

Search for on charger and add at the end (after write /sys/class/power_supply...):

setprop ro.bootmode "normal"

setprop sys.powerctl "reboot"

Save file and repack image (double click on repackimg.bat).

Rename image-new.img to boot.img

Tar boot.img file (you will need tar for Windows):

tar -cf boot.tar boot.img

Download Odin latest version:

https://samsungodin.com/

Open Odin, click on AP, select boot.tar file.

Reboot device to download mode:

adb reboot download

Click Start on Odin.

After reboot, disconnect and power off device. Reconnect the USB cable and wait.
[Galaxy Tab Q&A, Help & Troubleshooting] m4n3k4s:
Nice! Thanks, it works on Samsung J7 2017
[Galaxy Tab Q&A, Help & Troubleshooting] MrNisse:
Hi,

Has anyone got a solutions to work on a Samsung S6 edge - I have tried all of them but my phone keep on booting into recovery mode )-;

Many regards
[Galaxy Tab Q&A, Help & Troubleshooting] igcek:
Have you tried after setting "echo b" thing rebooting from TWRP into system?

I dont know why but it seems it reboots allways to recovery till you reboot to system that worked for me.
[Galaxy Tab Q&A, Help & Troubleshooting] MrNisse:
Hi, igcek

Thank you for your post.

The phone just keeps on booting into recovery mode - first it starts a blue System Update screen and a coupé of seconds later it shows the System Recovery screen and then it waits for my input - Then I choose “Boot to System” ?

Many regards
[Galaxy Tab Q&A, Help & Troubleshooting] igcek:
Do you have TWRP Recovery installled?
[Galaxy Tab Q&A, Help & Troubleshooting] MrNisse:
Yes I have the TWRP recovery installed ?
[Galaxy Tab Q&A, Help & Troubleshooting] oskarosi:
I have a problem that the phone after applying changes in lpm every few connections the charger does not start. It hangs on the battery logo. It only helps turning on the POWER button.

Samsung Galaxy S4 i9506 stock Rom t-mobile PL with root and new kernel from xda-developers.
[Galaxy Tab Q&A, Help & Troubleshooting] dans16:
samsung galaxy ace

Hi, unfortunately, I did not manage to find a simple and reliable solution even from this interesting post.

Can anybody help me with my Samsung Galaxy Ace?

Here are the details:

android 2.3.3 original and rooted

there are not the mentioned files in system/bin (playlpm, lpm, boot etc.)

when turned off and plugged to charger I see the typical green battery icon

Moreover, I have ES file installed. It would be great if it was a matter of finding the right file to edit.

Thank you very much
[Galaxy Tab Q&A, Help & Troubleshooting] Mrakw:
Hello

can anyone help me with Oneplus One - boot on charge??? I would need it for a car... Cant find anythink.

best regards
[Galaxy Tab Q&A, Help & Troubleshooting] bjalek:
Great. It helps on my Samasung galaxy A3(2016) SM-310F

Great. It helps on my Samasung galaxy A3(2016) SM-310F
[Galaxy Tab Q&A, Help & Troubleshooting] MrNisse:
Hi

Now that I can’t get my Samsung S6 edge to autoboot to System but only to Recovery, I was thinking if there exist a recovery image that boots to system after a couple of seconds ?

Many regards
[Galaxy Tab Q&A, Help & Troubleshooting] layne:
My Samsung Galaxy Tab A (T550) only boots automatically to recovery mode. Have people had a work around for that?
[Galaxy Tab Q&A, Help & Troubleshooting] mouragio:
I have searched but couldnt find a conclusive answer...

Do you need a rooted tablet for this to work (Galaxy Tab A6; 2016) ? or can it be edited in a stock ROM?

Thanx in advance.
[Galaxy Tab Q&A, Help & Troubleshooting] spratek:
Thank you very much, on my old SONY Xperia Tipo Dual (ST21i2) nothing else worked, just that. :)

Only the file is as follows: /system/bin/battery_charging
[Galaxy Tab Q&A, Help & Troubleshooting] mouragio:
Hello All,

I edited the lpm file which I had on my stock samsung sm-T580 8.1.0 rom, and worked perfect.

Now, I have switched to a custom rom with android 9 (crdroid): https://xdaforums.com/galaxy-tab-a/development/rom-crdroid-5-0-64bit-20181227-t3883791

In the /system/bin, there is no lpm file unfortunatelly... Anyone an idea which file is responsible for the battery animation?

thanx in advance.
[Galaxy Tab Q&A, Help & Troubleshooting] kenuser:
Hi,

I would like to try your method.

Could you please paste clearly how/where put the code?

Inside init.rc I have:

chown system system /sys/devices/platform/mt6329-battery/Charger_Mode
chown system system /sys/devices/platform/mt6329-battery/Charger_Complete
chown system system /sys/devices/platform/mt6329-fgadc/FG_Reset

and then:

on charger
class_start charger

Thank you
[Galaxy Tab Q&A, Help & Troubleshooting] AlphaAnimal:
Thanks to your instructions, I found the right trail.

I just had to do a little bit differently on my

Wiko U Feel Prime

- Clone -

Yu Yureka Black

.

The file I found the "on charge" line is called init.target.rc

I simply inserted your 2 commands at the end of the command line and that was it. It works great.
[Galaxy Tab Q&A, Help & Troubleshooting] kenuser:
Like that?

on charger
setprop ro.bootmode "normal"
setprop sys.powerctl "reboot"
[Galaxy Tab Q&A, Help & Troubleshooting] AlphaAnimal:
Yeah, except I had a few more lines under "on charger"

on charger
wait /dev/block/bootdevice/by-name/system
mount ext4 /dev/block/bootdevice/by-name/system /system ro barrier=1
load_all_props
trigger load_system_props_action
setprop sys.usb.configfs 0
setprop persist.sys.usb.config mass_storage
start qcom-post-boot
setprop persist.sys.usb.config mass_storage
start hvdcp_opti
[B] setprop ro.bootmode "normal"
setprop sys.powerctl "reboot"[/B]
[Galaxy Tab Q&A, Help & Troubleshooting] kenuser:
For me it's not working.

Hi have only:

on charger
class_start charger

inside the 2 files init.miniOS.rc and init.rc

LG phone, android 4.1.2
[Galaxy Tab Q&A, Help & Troubleshooting] AlphaAnimal:
Okey, but you have extracted the booloader.img, changed the settings and flashed to your phone back?

Because if you only change the file in a Rootexplorer, the changes are deleted after a restart.

For some other Android systems it is only necessary to execute the following command:

fastboot oem off-mode-change 0

I've heard of another method this works but only if you have an lpm file under /system/bin/

You'd just have to change one little thing about it. But I don't know exactly what right now.
[Galaxy Tab Q&A, Help & Troubleshooting] kenuser:
Hi,

yes I extract boot.img, unpack, modify the files by notepad++, repack the image and flash again.

kpoc_charger lpm playlpm chargemon are not present

"fastboot oem off-mode charge 0" cannot send because the phone boot recovery in download mode and not in fastboot mode

ipod is present but change/cancel/rename it have not influence on animation; still display it on charge

I think that is present a separated minisystem for powered off telephone on charge, main boot isn't executed, can you confirm this possibility?
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
i am using linage os, have decompile and recompile boot.img in order to change the init.rc file.

and it works to auto boot when charging.

search xda on "linage os auto boot "on the steps
[Galaxy Tab Q&A, Help & Troubleshooting] AlphaAnimal:
So if you type this in

adb reboot fastboot

Your phone boot into the download mode?

Do you have a chance to test another rom?
[Galaxy Tab Q&A, Help & Troubleshooting] mcgyver83:
Hi, I got a Samsung S5 (SM-g900F).

I have the boot into recovery issue.

I set from twrp terminal console permission as 755 and group shell for the file lpm

I tried many fiel content versions (with sleep 20, with su command as 2nd line, with only 2 lines) but I still allways boot to recovery.

I'm using stock 6.0.1 rom with root.

Any hints?
[Galaxy Tab Q&A, Help & Troubleshooting] Xairoo:
Any idea why my Samsung Tab 4 boots in loop (or what ever, background just flashes on/off after a few seconds)?

I have removed the batteries and modified the lpm file. I can boot the tablet when pressing the power button. But autoboot with plugged in charger doesn't work.

I also own a Samsung Galaxy Tab Pro, the solution above works on that device - also without batteries (as a weather station display, it's amazing but the batteries just blow up after a while always charging... so I removed them successfully).

Btw: Samsung Galaxy Tab Pro without battery?

Just solder a wire on + and - on the battery connector (the one with the 6 cables - 2 black, 2 blue, 2 red) with the flat cable (use a knife or so to remove the isolation - you have to use the thicker lines on the cable, just measure the voltage to know if it's the correct one).

*update*

fixed! I installed the original rom (4.4.2) again, run TWRP and edited the lpm using this guide: medium.com/@MrSmokeTooMuch/auto-starting-samsung-android-phone-when-charger-is-plugged-in-7f8b84048a09

(new user, posting a link is disabled until 10 posts...! o_O but okay.)

#!/system/bin/sh
/system/bin/lpm.orig &
while [ true ]; do
sleep 1
ps | grep lpm.orig && sleep 3 && /system/bin/reboot
done
[Galaxy Tab Q&A, Help & Troubleshooting] igorstasi:
Hey guys, i need some help from a pro, i try to modify the lmp file from my Galaxy Tab Active 2 but when i put the cable in the tablet it shows me for a short time (maybe 1-2 seconds) a circle with a flash and then the background lightning od the screen goes on but nothing more happening until i put the battery out and start it again without cable then it starts normaly. I really need help and would pay for someone who can help me here! thanks alot!
[Galaxy Tab Q&A, Help & Troubleshooting] sertunc:
thank you very much!
[Galaxy Tab Q&A, Help & Troubleshooting] jacky4566:
OMG. Almost 20 hours wasted on this dumb problem and this is the first working solution for me. THANK YOU.

Samsung Tab S2 T-713