From f2b4a3f754ce565e5b356ea2fdb5fa80feb04e51 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 3 Sep 2021 18:42:16 -0500 Subject: Use exit and deregister with mts-io when done --- recipes-connectivity/ppp/files/wait_for_reset | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/recipes-connectivity/ppp/files/wait_for_reset b/recipes-connectivity/ppp/files/wait_for_reset index 7e9da95..e77df77 100755 --- a/recipes-connectivity/ppp/files/wait_for_reset +++ b/recipes-connectivity/ppp/files/wait_for_reset @@ -13,7 +13,7 @@ TERM=15 function sleep_reset { # Wait for parent to enter wait. - trap "kill $!;kill $BASHPID" $TERM + trap "exit 0" $TERM while [[ $(ps -h -o wchan -p $PPID) != do_wait ]] ; do usleep 100 ; done ${LOG} Register for SIGUSR2 when radio-reset complete echo "$$" "$USR2" >/sys/devices/platform/mts-io/radio-reset-monitor @@ -29,17 +29,17 @@ function sleep_reset # Wait for radio-reset to complete function wait_for_reset { - # Wait for radio reset/modem discovery - trap ":" $USR2 - in_reset=$(cat /sys/devices/platform/mts-io/radio-udev-discovery) - if ((in_reset == 0)) ; then - sleep_reset & - wait $! - # pgrep is needed to find the sleep process - echo "pgrep -P: $(pgrep -P $!)" - pgrep -P $! | xargs kill - ${LOG} "radio-reset is complete" - - fi - trap "" $USR2 + # Wait for radio reset/modem discovery + trap ":" $USR2 + in_reset=$(cat /sys/devices/platform/mts-io/radio-udev-discovery) + if ((in_reset == 0)) ; then + sleep_reset & + wait $! + # pgrep is needed to find the sleep process + echo "pgrep -P: $(pgrep -P $!)" + pgrep -P $! | xargs kill + ${LOG} "radio-reset is complete" + fi + echo "$$" "0" >/sys/devices/platform/mts-io/radio-reset-monitor + trap "" $USR2 } -- cgit v1.2.3