Automated power on with charging cable plugged: Difference between revisions
No edit summary |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= For Non-Samsung phones = | |||
[https://www.youtube.com/watch?v=Zp9G6A6EFlA Set your Android Phone to Automatically Power on when USB Charger is plugged in] | [https://www.youtube.com/watch?v=Zp9G6A6EFlA Set your Android Phone to Automatically Power on when USB Charger is plugged in] | ||
Because Samsung can't do Fastboot the above method won't work, but it comes down to going to fastboot mode and typing | Because Samsung can't do Fastboot the above method won't work, but it comes down to going to fastboot mode and typing | ||
adb reboot bootloader | |||
fastboot oem off-mode-charge 0 | fastboot oem off-mode-charge 0 | ||
=For Samsung phones= | |||
[https://medium.com/@MrSmokeTooMuch/auto-starting-samsung-android-phone-when-charger-is-plugged-in-7f8b84048a09 Auto-starting Samsung Android phone when charger is plugged in.] | [https://medium.com/@MrSmokeTooMuch/auto-starting-samsung-android-phone-when-charger-is-plugged-in-7f8b84048a09 Auto-starting Samsung Android phone when charger is plugged in.] | ||
Ensure busybox is installed first [https://play.google.com/store/apps/details?id=stericson.busybox&hl=en Busybox by stericson] Note also that if you install to /sbin you will lose it all after reboot, so install to /system/xsbin | Ensure busybox is installed first [https://play.google.com/store/apps/details?id=stericson.busybox&hl=en Busybox by stericson] Note also that if you install to /sbin you will lose it all after reboot, so install to /system/xsbin | ||
adb shell | |||
mount -o rw,remount /system | |||
Note: start in recovery mode (twrp) and mount the system partition here. If the phone is started then you can't perform the /system remount. | Note: start in recovery mode (twrp) and mount the system partition here. If the phone is started then you can't perform the /system remount. | ||
cd /system/bin | cd /system/bin | ||
vi lpm | https://forum.xda-developers.com/galaxy-s7/help/samsung-galaxy-s7-boot-charge-t3680083 | ||
https://android.stackexchange.com/questions/195146/lpm-reboot-samsung-galaxy-s7/206872#206872 | |||
Note the above guy uses 'echo lpm.sh > lpm' commands, which won't work - you have to cat them over! | |||
You can't just copy stuff over /system/bin/lpm presumably due to inode problems. If you do, when you plug in the charger you will only see and empty battery picture. So you need to create the script, and then cat the script over the lpm file | |||
cat lpm > lpm.orig | |||
vi lpm.sh | |||
<pre> | <pre> | ||
Line 28: | Line 38: | ||
if [ $bat_proc -gt 10 ]; then | if [ $bat_proc -gt 10 ]; then | ||
sleep 3 && / | sleep 3 && echo b > /proc/sysrq-trigger | ||
fi | fi | ||
Line 35: | Line 45: | ||
</pre> | </pre> | ||
cat lpm.sh > lpm | |||
chmod 0755 /system/bin/lpm.orig | chmod 0755 /system/bin/lpm.orig | ||
chown root.shell /system/bin/lpm.orig | chown root.shell /system/bin/lpm.orig | ||
exit adb | |||
adb reboot | |||
power off |
Latest revision as of 06:40, 20 September 2019
For Non-Samsung phones
Set your Android Phone to Automatically Power on when USB Charger is plugged in
Because Samsung can't do Fastboot the above method won't work, but it comes down to going to fastboot mode and typing
adb reboot bootloader fastboot oem off-mode-charge 0
For Samsung phones
Auto-starting Samsung Android phone when charger is plugged in.
Ensure busybox is installed first Busybox by stericson Note also that if you install to /sbin you will lose it all after reboot, so install to /system/xsbin
adb shell mount -o rw,remount /system
Note: start in recovery mode (twrp) and mount the system partition here. If the phone is started then you can't perform the /system remount.
cd /system/bin
https://forum.xda-developers.com/galaxy-s7/help/samsung-galaxy-s7-boot-charge-t3680083
https://android.stackexchange.com/questions/195146/lpm-reboot-samsung-galaxy-s7/206872#206872
Note the above guy uses 'echo lpm.sh > lpm' commands, which won't work - you have to cat them over!
You can't just copy stuff over /system/bin/lpm presumably due to inode problems. If you do, when you plug in the charger you will only see and empty battery picture. So you need to create the script, and then cat the script over the lpm file
cat lpm > lpm.orig vi lpm.sh
#!/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 && echo b > /proc/sysrq-trigger fi sleep 5 done
cat lpm.sh > lpm
chmod 0755 /system/bin/lpm.orig chown root.shell /system/bin/lpm.orig
exit adb
adb reboot
power off