Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
g4: init: init.qcom.post_boot.sh RIL workaround
Browse files Browse the repository at this point in the history
Enhanced the workaround:

- catch all other states (e.g. UNKNOWN)
- special handler for PIN_REQUIRED:
   sometimes this state is set but no prompt happens.
   a trigger will be set + reset which ensures a RIL restart on every second run.
   handler will wait 30s for user input between each run/test
- increase the number of tries to 20 (10 is too less - especially when 3 are
   happen almost always directly on boot due to the date/time corrections!)
- increase the wait time for RIL initialization from 10 to 30 (makes no sense to
   kill too fast)
- logging

example run:

> RIL restart - try 1 of 20
> restarted RIL daemon as gsm.sim.state was ><
> RIL restart - try 2 of 20
> restarted RIL daemon as gsm.sim.state was ><
> PIN_REQUIRED detected. waiting 30s for user input..
> RIL restart - try 4 of 20
> restarted RIL daemon as gsm.sim.state was >PIN_REQUIRED<
> PIN_REQUIRED detected. waiting 30s for user input..
>
> [USER ENTERS THE PIN]
>
> gsm.sim.state >READY<
> ended

(related issue Suicide-Squirrel/issues_oreo#6 )

Change-Id: I1f6a1aeb2eaff0432a8b0d1082522def1ddcd69a
  • Loading branch information
steadfasterX authored and pavlaras committed Sep 28, 2018
1 parent c5b6134 commit 2bbb863
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions rootdir/etc/init.qcom.post_boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,36 @@ if [ -c /dev/coresight-stm ]; then
fi
fi
fi

# workaround for randomly no SIM on boot (https://github.com/Suicide-Squirrel/issues_oreo/issues/6)
x=1
PRTRIGGER=0
REQRESTART=$(getprop gsm.sim.state)
while [ "$REQRESTART" != "READY" ];do

# PIN_REQUIRED means usually the user get prompted - unfortunately
# sometimes there is no prompt.
# this will restart RIL not on the first but every second run only (which should be safe) and
# let the user enough time to enter the PIN if the prompt appears
if [ "$REQRESTART" == "PIN_REQUIRED" ]&&[ $PRTRIGGER -eq 0 ];then
echo "$0: PIN_REQUIRED detected. waiting 30s for user input.." >> /dev/kmsg && sleep 30
PRTRIGGER=1
else
echo "$0: RIL restart - try $x of 20" >> /dev/kmsg
stop ril-daemon
sleep 2
start ril-daemon
echo "$0: restarted RIL daemon as gsm.sim.state was >$REQRESTART<" >> /dev/kmsg
sleep 20
PRTRIGGER=0
fi
REQRESTART=$(getprop gsm.sim.state)
x=$((x + 1))
if [[ $x -eq 20 ]];then
echo "$0: auto restart RIL daemon aborted.. too many tries!" >> /dev/kmsg
break
fi
done
echo "$0: gsm.sim.state >$REQRESTART<" >> /dev/kmsg
echo "$0: ended" >> /dev/kmsg
# < END workaround

0 comments on commit 2bbb863

Please sign in to comment.