Auto Boot / Start on charge (different devices)

Search This thread

gigi2k4

Member
Mar 10, 2012
5
0
Hello all,

i would like to buy a new (cheap) tablet which i can modify to auto boot / start on charge. I need this for an project. I plan to use this tablet as a mediaplayer in my new bathroom and the buttons of this tablet will not be reachable. Is it possible to modify every device to auto boot on charge or has someone experience with devices not working?

Thx and greetings
gigi
 

ahhl

Senior Member
Jul 23, 2007
1,074
114
Sorry OP
i want to hijack this thread to to compile all successful method for different devices to autoboot when plug in /charging
any one to do this must root their device and use AIK to decompile/recompile boot.image, modify certain file depending on the device

---------- Post added at 05:35 PM ---------- Previous post was at 05:23 PM ----------

]REDMI 6A MTK Device
need to modify kopc_charger file
here
https://forum.xda-developers.com/showpost.php?p=81874791&postcount=158
https://forum.xda-developers.com/showpost.php?p=81880927&postcount=159

---------- Post added at 05:45 PM ---------- Previous post was at 05:35 PM ----------

On I9500 runing linage OS 16
modify the init.rc

on charger
setprop ro.bootmode "normal"
setprop sys.powerctl "reboot"

---------- Post added at 06:03 PM ---------- Previous post was at 05:45 PM ----------

Redmi 4x

modify init.rc

on charger
class_start charger
class_stop charger
on property:sys.boot_from_charger_mode=1
trigger late-init
 
Last edited:
  • Like
Reactions: Nicbobbo6

tonyniu2008

Member
Aug 25, 2021
13
2
HI there, i have installed this Rom to my samsung s8, it is pretty cool, and i am trying to set auto boot on USB power pluggin, but until now, no luck.

Since Android 10, seems the init.rc is regenerated every time when it boots, so unpack/repack of the .img solution seems not working any more. what i am trying next is via magisk module, still in process but no progress.

Is there any other way to do this? any light would be appreciated.
 

hisoka_simp

Member
Mar 4, 2021
40
16
Germany
Moto G
Moto G 2015
HI there, i have installed this Rom to my samsung s8, it is pretty cool, and i am trying to set auto boot on USB power pluggin, but until now, no luck.

Since Android 10, seems the init.rc is regenerated every time when it boots, so unpack/repack of the .img solution seems not working any more. what i am trying next is via magisk module, still in process but no progress.

Is there any other way to do this? any light would be appreciated.
The init.rc is unpacked from the boot partition, you see in / only a copy of init.rc

What other solutions did you try to make it boot instantly?
 

tonyniu2008

Member
Aug 25, 2021
13
2
The init.rc is unpacked from the boot partition, you see in / only a copy of init.rc

What other solutions did you try to make it boot instantly?
I tried to unpack the boot image, and actually the init.rc is missing from the root path, i googled it, as i think it caused by the system version, starting from Android 10, init.rc will be only generated when booting, my system is LineageOS 17.1

when the system finishing booting, i can adb shell to the file, init.rc is there then, i tried to unpack the recovery image, the init.rc is there, i tried to change that and flash to boot, and recovery, no luck, after booting the init.rc still keep the same as before.

I am currently trying the magisk module, but not yet a solution.

As you said the init.rc is copyed from somewhere, do you know where?
 

hisoka_simp

Member
Mar 4, 2021
40
16
Germany
Moto G
Moto G 2015
I tried to unpack the boot image, and actually the init.rc is missing from the root path, i googled it, as i think it caused by the system version, starting from Android 10, init.rc will be only generated when booting, my system is LineageOS 17.1

when the system finishing booting, i can adb shell to the file, init.rc is there then, i tried to unpack the recovery image, the init.rc is there, i tried to change that and flash to boot, and recovery, no luck, after booting the init.rc still keep the same as before.

I am currently trying the magisk module, but not yet a solution.

As you said the init.rc is copyed from somewhere, do you know where?
Can you send me a link (google drive would be nice) to an unmodified version of your boot.img? I'll modify it correctly and send back to you
 

tonyniu2008

Member
Aug 25, 2021
13
2

bearllm

Member
Sep 8, 2021
14
3
Can you send me a link (google drive would be nice) to an unmodified version of your boot.img? I'll modify it correctly and send back to you
The content of ramdisk is extracted from the boot partition every time it starts, so modifying init.rc does not work.

I extracted my boot partition to boot.img, then unpacked it, modified the init.rc inside, repackaged it as boot.img, and finally flashed into the boot partition

After the system started, I saw that the init.rc was modified

But it’s not pungent and has no effect

on charger
class_start charger
setprop sys.powerctl reboot

My device is huawei MediaPad3,maybe your device can work。Try it
 

bearllm

Member
Sep 8, 2021
14
3
I tried to unpack the boot image, and actually the init.rc is missing from the root path, i googled it, as i think it caused by the system version, starting from Android 10, init.rc will be only generated when booting, my system is LineageOS 17.1

when the system finishing booting, i can adb shell to the file, init.rc is there then, i tried to unpack the recovery image, the init.rc is there, i tried to change that and flash to boot, and recovery, no luck, after booting the init.rc still keep the same as before.

I am currently trying the magisk module, but not yet a solution.

As you said the init.rc is copyed from somewhere, do you know where?
The content of ramdisk is extracted from the boot partition every time it starts, so modifying init.rc does not work.

I extracted boot partition to boot.img, then unpacked it, modified the init.rc , repackaged it as boot.img, and finally flashed into the boot partition

After the system started, I saw that the init.rc was modified

But it’s no effect

on charger
class_start charger
setprop sys.powerctl reboot

My device is huawei MediaPad3,maybe your device can work。Try it
 

hisoka_simp

Member
Mar 4, 2021
40
16
Germany
Moto G
Moto G 2015
The content of ramdisk is extracted from the boot partition every time it starts, so modifying init.rc does not work.

I extracted boot partition to boot.img, then unpacked it, modified the init.rc , repackaged it as boot.img, and finally flashed into the boot partition

After the system started, I saw that the init.rc was modified

But it’s no effect

on charger
class_start charger
setprop sys.powerctl reboot

My device is huawei MediaPad3,maybe your device can work。Try it
Hey I recommend you to also try this code which worked for another device I had, hope it works

on charger
setprop ro.bootmode "normal"
setprop sys.powerctl "reboot"
 

bearllm

Member
Sep 8, 2021
14
3
Hey I recommend you to also try this code which worked for another device I had, hope it works

on charger
setprop ro.bootmode "normal"
setprop sys.powerctl "reboot"
Thanks,I tried it last night,It does not work : (

I think Huawei’s program entry is not here

BTW,i use the APP "Tasker",my device can automatically shut down when the usb line is unplugged
 

bearllm

Member
Sep 8, 2021
14
3
Hey I recommend you to also try this code which worked for another device I had, hope it works

on charger
setprop ro.bootmode "normal"
setprop sys.powerctl "reboot"
I think i did it


in the "init.charger.rc"


on charger
chmod 0440 /sys/class/hw_power/battery/isc
chown system system /sys/class/hw_power/battery/isc
trigger cust_parse_action
class_start charger
wait /dev/block/bootdevice/by-name/oeminfo
start oeminfo_nvm
start teecd

change to

on charger
chmod 0440 /sys/class/hw_power/battery/isc
chown system system /sys/class/hw_power/battery/isc
trigger cust_parse_action
class_start charger
setprop ro.bootmode "normal"
setprop sys.powerctl "reboot"
wait /dev/block/bootdevice/by-name/oeminfo
start oeminfo_nvm
start teecd

the new problem is coming

when i flash the repacked into my device,i can't enter developer options

I tried not to make any changes, just package boot.img with the unpacked file, the same situation

but i flash the boot.img from my boot partition,everything is ok
 

hisoka_simp

Member
Mar 4, 2021
40
16
Germany
Moto G
Moto G 2015
You
I think i did it


in the "init.charger.rc"


on charger
chmod 0440 /sys/class/hw_power/battery/isc
chown system system /sys/class/hw_power/battery/isc
trigger cust_parse_action
class_start charger
wait /dev/block/bootdevice/by-name/oeminfo
start oeminfo_nvm
start teecd

change to

on charger
chmod 0440 /sys/class/hw_power/battery/isc
chown system system /sys/class/hw_power/battery/isc
trigger cust_parse_action
class_start charger
setprop ro.bootmode "normal"
setprop sys.powerctl "reboot"
wait /dev/block/bootdevice/by-name/oeminfo
start oeminfo_nvm
start teecd

the new problem is coming

when i flash the repacked into my device,i can't enter developer options

I tried not to make any changes, just package boot.img with the unpacked file, the same situation

but i flash the boot.img from my boot partition,everything is ok
I removed the whole code in the on charger block and pasted just mine so in the block is ONLY those 2 commands.
This maybe results in an error bc charger class is started but not properly shutdown.
Another error could be the file, idk if there is a global init.rc in your boot.img if yes then search in there for on charger bc the global init.rc is called at first and only after that the others so maybe look if there is an on charger block in the unpacked boot img in the init.rc

But I don't know why you can't access the developer options anymore, it would help me to do if you explain a bit more detailed what's going on when you try to open them
 

bearllm

Member
Sep 8, 2021
14
3
You

I removed the whole code in the on charger block and pasted just mine so in the block is ONLY those 2 commands.
This maybe results in an error bc charger class is started but not properly shutdown.
Another error could be the file, idk if there is a global init.rc in your boot.img if yes then search in there for on charger bc the global init.rc is called at first and only after that the others so maybe look if there is an on charger block in the unpacked boot img in the init.rc

But I don't know why you can't access the developer options anymore, it would help me to do if you explain a bit more detailed what's going on when you try to open them
ok

this is my test

step1
I extracted boot.img from the boot partition.

step2
unpack boot.img to the folder “unpacked_img”

step3
repacked the folder “unpacked_img” to the RepackBoot.img (Did not change any files in the folder, just repacked)

step4
flah the RepackBoot.img to the boot partition

i can't access the developer options anymore

but i flash the boot.img(step1) to the boot partition

i can access the developer options again


think you so much
 

hisoka_simp

Member
Mar 4, 2021
40
16
Germany
Moto G
Moto G 2015
ok

this is my test

step1
I extracted boot.img from the boot partition.

step2
unpack boot.img to the folder “unpacked_img”

step3
repacked the folder “unpacked_img” to the RepackBoot.img (Did not change any files in the folder, just repacked)

step4
flah the RepackBoot.img to the boot partition

i can't access the developer options anymore

but i flash the boot.img(step1) to the boot partition

i can access the developer options again


think you so much

ok

this is my test

step1
I extracted boot.img from the boot partition.

step2
unpack boot.img to the folder “unpacked_img”

step3
repacked the folder “unpacked_img” to the RepackBoot.img (Did not change any files in the folder, just repacked)

step4
flah the RepackBoot.img to the boot partition

i can't access the developer options anymore

but i flash the boot.img(step1) to the boot partition

i can access the developer options again


think you so much
Did you try to unlock developer options again? (Tapping build number 10x)
 

hisoka_simp

Member
Mar 4, 2021
40
16
Germany
Moto G
Moto G 2015
I have tried, failed~~~~~~~

and i reset pad to factory settings, do not open the developer options first,flash the RepackBoot.img
unlock developer options after reboot
the situation is still the samet,can't access the developer options


my heart is broken,hahaha
What do you mean exactly you can't access? Is the toast not showing which says you unlocked developer options or do you try to open them and settings crash then?
 

DAVIZINHO

Senior Member
Nov 2, 2009
167
19
hello.
one year ago, i can modify my xiaomi mix2s with xiaomi.eu rom. and the phone boots when the charger is connected. The modification i make power the phone, apears the chargin animation and after a second, the phone reboots and launch android.

The problem is, i must factory reset the phone and now, this not works, and i must do the trick again. but i dont remember what i did!!!!

somebody know how to modify the phone to boot when charger is connected??
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Sorry OP
    i want to hijack this thread to to compile all successful method for different devices to autoboot when plug in /charging
    any one to do this must root their device and use AIK to decompile/recompile boot.image, modify certain file depending on the device

    ---------- Post added at 05:35 PM ---------- Previous post was at 05:23 PM ----------

    ]REDMI 6A MTK Device
    need to modify kopc_charger file
    here
    https://forum.xda-developers.com/showpost.php?p=81874791&postcount=158
    https://forum.xda-developers.com/showpost.php?p=81880927&postcount=159

    ---------- Post added at 05:45 PM ---------- Previous post was at 05:35 PM ----------

    On I9500 runing linage OS 16
    modify the init.rc

    on charger
    setprop ro.bootmode "normal"
    setprop sys.powerctl "reboot"

    ---------- Post added at 06:03 PM ---------- Previous post was at 05:45 PM ----------

    Redmi 4x

    modify init.rc

    on charger
    class_start charger
    class_stop charger
    on property:sys.boot_from_charger_mode=1
    trigger late-init