FORUMS

Samsung Galaxy S7 boot on charge

3 posts
Thanks Meter: 1
 
By ais81and, Junior Member on 27th September 2017, 10:25 AM
Post Reply Email Thread
The desired behavior is to boot the device (Samsung Galazy S7 with Android 7) when plugged on a power source. The solutions discussed in forums are summarized bellow:
  1. Change the battery charging animation with a shell script which executes the reboot command
  2. Use fastboot oem command (fastboot oem off-mode-charge enable/disable or similar command which is oem depended)
  3. Modify the boot image by overriding the on charger event(s) so to "continue" booting or force the device to reboot

I started with the first solution: I replaced the /system/bin/lpm file with
Code:
#!/system/bin/sh
/system/bin/reboot
or using su
Code:
#!/system/bin/sh
su
/system/bin/reboot
The result of the approach was not successful. The device when plugged on a power source displays an empty battery image while the most important is the recovery of the original lpm file DOES not recover the original functionality (i.e. the phone still displays an empty battery image and the only way to boot it is using the combination of the recovery buttons)

The second solution was not applicable to the Samsung Galaxy S7 since the fastboot does not exist.

The third solution did not produce also the desired behavior. I got the boot image using dd and unpacked it using the unpackimg tool. I modified the file init.rc by changing the on charger event to:
Code:
on charger
    class_start charger
    class_stop charger
    trigger late-init
or
Code:
on charger
    class_start charger
    class_stop charger
    start boot-on-charge

service boot-on-charge /system/bin/reboot
    class charger
    user root
    oneshot
or
Code:
on charger
    class_start charger
    setprop sys.boot_from_charger_mode 1
I also tried modifying some of the other init files which include the on charger event using the above approach without any success.

Has anyone tried the above solutions (or a different approach) on Samsung Galaxy S7 successfully?
The Following User Says Thank You to ais81and For This Useful Post: [ View ] Gift ais81and Ad-Free
16th October 2017, 10:27 AM |#2  
OP Junior Member
Thanks Meter: 1
 
More
So far, the only solution which works reliably is hacking the USB port of the Samsung device: If a resistor of about 304 KOhm (just slightly above 300KOhm) is connected between the ID pint and the Ground, the device boots in Download mode. After that, using the Odin or Heimdall tool the device can be rebooted normally. Although this is not the desired (I needed a software and more generic solution which could work with devices from other manufacturers) solution it is a workaround which is tested with S7, S5 and Note 4 and works!
18th January 2018, 07:11 PM |#3  
Junior Member
Thanks Meter: 2
 
More
lpm inode position
If a new lpm file with exactly the same content, permissions, ownership and modification time is created, then renamed, as lpm, it doesn't work.

Therefore, I think the inode position of the file is significant.

cat the contents of your script over the original lpm file, retaining it's inode position, then it appears to work.
16th April 2018, 07:09 AM |#4  
Junior Member
Thanks Meter: 0
 
More
Thanks floor51
Thank you very much floor51.

I work and surfing google about 3 month.
I have samsung galaxy note 4 and move lpm to lpm_org and cat lpm, but not work... did not boot when plug in.
Today, I read your content, and test.
Just #cat > lpm without #mv lpm lpm_org
Then It works !!!!! my phone boot when plug in.
Thanks very very much. ^^;;;
Bye.

Quote:
Originally Posted by floor51

If a new lpm file with exactly the same content, permissions, ownership and modification time is created, then renamed, as lpm, it doesn't work.

Therefore, I think the inode position of the file is significant.

cat the contents of your script over the original lpm file, retaining it's inode position, then it appears to work.

19th April 2018, 09:16 AM |#5  
OP Junior Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by cybodime

Thank you very much floor51.

I work and surfing google about 3 month.
I have samsung galaxy note 4 and move lpm to lpm_org and cat lpm, but not work... did not boot when plug in.
Today, I read your content, and test.
Just #cat > lpm without #mv lpm lpm_org
Then It works !!!!! my phone boot when plug in.
Thanks very very much. ^^;;;
Bye.

Thanks @cybodime for verifying the solution of @floor51. I didn't try the solution by myself since I am working on Samsung Galasy S8 now.

Best regards
21st April 2018, 10:44 PM |#6  
Junior Member
Thanks Meter: 1
 
More
Thanks for all suggestions, but I have run out of luck and ideas.
I have tried this on several ROM's on my Samsung Galaxy S7 Edge, latest a nice build from here: https://wccftech.com/install-fast-li...y-s7-edge-rom/
All modifications of the /system/bin/lpm file, including the "cat >" results in a boot into recovery mode.
Any suggestions are highly appreciated!
5th September 2018, 10:35 AM |#7  
Junior Member
Thanks Meter: 0
 
More
Samsung J2 Pro
Did anyone find a solution for this.

I am getting the same issue - the phone reboots into recovery mode.
5th September 2018, 10:49 AM |#8  
Junior Member
Thanks Meter: 1
 
More
Sorry, nothing. I sort of gave up and will pick this up at a later stage..
15th November 2018, 05:48 PM |#9  
Junior Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by AussieRoss

Did anyone find a solution for this.

I am getting the same issue - the phone reboots into recovery mode.

I have now build a ROM with Lineage 14.1 that boots up on charge power (USB).
Seems to be working fine on my S7 Edge
23rd January 2019, 03:06 PM |#10  
Junior Member
Thanks Meter: 4
 
More
Solution for anyone who's interested.

https://android.stackexchange.com/qu.../206872#206872

Code:
#!/system/bin/sh

# Script to reboot the system as soon as the charger is inserted
# https://android.googlesource.com/kernel/common/+/android-trusty-3.10/Documentation/sysrq.txt

# Enable kernel commands.
su -c "echo 1 > /proc/sys/kernel/sysrq"

# Send an immediate reboot request.
echo b > /proc/sysrq-trigger
Backup and cat this script over the original lpm file and plugging in the charger will cause the phone to reboot to the system after a short delay.

Code:
echo /system/bin/lpm > /system/bin/lpm.bak
echo /sdcard/reboot_on_charge.sh > /system/bin/lpm
The Following User Says Thank You to Sollace For This Useful Post: [ View ] Gift Sollace Ad-Free
22nd February 2019, 09:36 AM |#11  
Member
Flag Utrecht
Thanks Meter: 0
 
More
Quote:
Originally Posted by lrbj

I have now build a ROM with Lineage 14.1 that boots up on charge power (USB).
Seems to be working fine on my S7 Edge

Hi, How did you manage to change it? I now have a rom based on lineage.. so I would try and change the things you did to get it accomplished. did you change the battery animation file? or something else?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes