tomicooler/htcdesire200autoboot

How to use your script on my htc M8 phone?

Closed this issue · 4 comments

Hi tomicooler,
I am trying to make my phone power on automatically when connected with USB. My phone is HTC M8 rather than your HTC Desire 200.
I find ./init.power.rc contains zchgd keyword, and find some similar code like you have posted.
service zchgd_offmode /system/bin/zchgd -pseudooffmode -autostop -poffmodewarn user root group root graphics disabled

this file only contains zchgd_offmode, no zchgd_onmode, then the problem is:

  1. the zchgd I copy from system/bin contains many gibberish( see my attached zchgd_m8. I can't figure out the real intent of these code.
  2. I paste the code from your zchgd file to my zchgd directly, but it doesn't work.
    Could you please give me some tips about this? Thanks very much!!
    m8_power.zip

Hi lyyiangang,

I need to ask some questions to figure out your case, so:

1, Does your phone have charging animation when it is turned off?
2, Do you have Fast boot option enabled in the settings?
3, When your phone is turned on, use adb shell. What happens when you start your original /usr/bin/zchgd service, does the charging animation shows in your phone?
4, What happens if you start my zchgd service, like this? "/usr/bin/zchgdtomi -pseudooffmode"? It should restart the phone.

I think you have to modify my script a bit to make it work, so your service gets more parameter. (3)

service zchgd_offmode /system/bin/zchgd -pseudooffmode -autostop -poffmodewarn

My fake service has a check for exactly 1 parameter, so please change this line:

if [ "$#" -eq 1 ]; then
---->
if [ "$#" -eq 3 ]; then

So this is my first tip, if you have any more question, feel free to ask!

thanks for your reply. My answers are as follows for your questions.
1, Does your phone have charging animation when it is turned off?
yes, it has. The charging animation appear only when it's power off, and no charging animation when
it's turned on.
2, Do you have Fast boot option enabled in the settings?
yes, the fast bool option is enabled.
3, When your phone is turned on, use adb shell. What happens when you start your original /usr/bin/zchgd service, does the charging animation shows in your phone?
The charging animation will appear when I use my original zchgd service.
4, What happens if you start my zchgd service, like this? "/usr/bin/zchgdtomi -pseudooffmode"? It should restart the phone.
I replace my zchgd with yours. and then use zchgd -pseudooffmode, I get the following info by using
adb logcat command.

E:\sdk\platform-tools>adb logcat -s zchgdwrapper
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
V/zchgdwrapper(19658): Starting fake zchgd service; args='-pseudooffmode -autost
op -poffmodewarn'
V/zchgdwrapper(19659): PseudoOffMode service
V/zchgdwrapper(19673): Checking battery charging enabled; enabled='1'
V/zchgdwrapper(19674): Going to magic-reboot

After my several tries. I succeed to automatically reboot my phone when it's power off.
I want it could reboot quickly and change the fist sleep time number to 10, but it doesn't work any more for this number. then how can I make the phone reboot as soon as possible when it's connected USB port?
Thanks

It seems

I'm glad it worked for you, I would try to do the following:

  • line 10: sleep 60 -> sleep 1
  • remove line 13 and 21 (if, fi)
  • line 19: replace sleep 120 with sleep 1 or 5 or 10 ~ try different values

I don't know if it will work, but let's hope it will be faster :)

thanks for your reply, I will try this approach latter.