By battery insertion I mean current flowing on the battery pins, not the micro USB port.
Description
The phone in question is a Samsung Galaxy Xcover 4, the bootloader is unlocked, and I have root access. Its intended purpose is as a kiosk device that will be sealed inside an external hard plastic enclosure. This means that the power button is unavailable for booting the phone. The phone is powered directly from the wall by means of a custom-made battery eliminator PCB, and I need the micro USB port for host mode UART communication, which means it will never be charged/powered via the micro USB port.
What has been attempted so far
As mentioned, the device is rooted, so I've tried modifying the BOOT partition image and flashing an updated one. The modifications I've been looking at pertains to the program
/init
in the root directory. and its associated
/init.rc
/init.samsungexynos7570.rc
/...
files. For example, I was able to make the phone boot upon receiving charge via the USB port by overwriting the contents of the file
/system/bin/lpm
with the script
#!/system/bin/sh
echo b > /proc/sysrq-trigger
because /system/bin/lpm is referenced in a service specified in the charging section of /init.rc. I was also able to make it boot via USB port charging by removing the existing "on charge" triggers in the init.*.rc files, and simply adding
on property:ro.bootmode=charger:
trigger late-init
For more details about what I did, see this link. But this is not a solution for me because I want to make it boot simply by powering the battery pins, not the micro USB port (which is preoccupied with being in host mode, so it definitely can't be charged).
Further thoughts
However, since modifying the /init.rc file changed its behaviour even while "off" (i.e. it now boots upon micro USB charging as opposed to not), this seems to tell me that the phone is never really completely off when "off", and that the /init program is constantly running as long as there is enough charge on the battery pins (please derail this thought train asap if this is completely wrong). Which would mean the kernel and the /init program should start automatically when there's sufficient charge on the battery pins. So my thinking was to simply add something along the lines of
trigger late-init
or
start <my_service>
(where my_service for example could be the lpm script I mentioned above) in an early init trigger stage, so that it would boot simply by virtue of the /init program running. But so far I've had no luck.
Does anyone know whether something like this would possible? Thanks for your time.