summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2018-03-20 19:07:57 -0500
committerJohn Klug <john.klug@multitech.com>2018-03-20 19:07:57 -0500
commitee9cb2d8781df73a32439cdad946da5ad3ef200e (patch)
tree3d5c101d29033be842f0e475db622d74f3de12fa
parent700a62cccd6f24ba7cbe14fe751e356d25e7afba (diff)
downloadmeta-mlinux-ee9cb2d8781df73a32439cdad946da5ad3ef200e.tar.gz
meta-mlinux-ee9cb2d8781df73a32439cdad946da5ad3ef200e.tar.bz2
meta-mlinux-ee9cb2d8781df73a32439cdad946da5ad3ef200e.zip
pgrep does not work during boot causing gpsd_ubx_* commands to hang.
-rwxr-xr-xrecipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh5
-rwxr-xr-xrecipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh5
2 files changed, 8 insertions, 2 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh b/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh
index 6c9c126..a1b59cf 100755
--- a/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh
+++ b/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh
@@ -59,7 +59,10 @@ fi
ps -fjp $ppid | LG -p user.error
fi
- gpsmonpid=$(pgrep -lg $pgid | egrep '[[:space:]]gpsmon$' | sed 's/[[:space:]].*//')
+ # pgrep does not work during boot.
+ pgrpmemb=$(ps --no-heading -o pgid,pid,comm -e | grep '^ *'"${pgid}"' *' | sed -r 's/^ *[0-9]+ *//')
+ gpsmonpid=$(echo "${pgrpmemb}" | egrep '[[:space:]]gpsmon$' | sed 's/[[:space:]].*//')
+
((DEBUG)) && LG -p user.info "$pgid is pgid $gpsmonpid is gpsmonpid"
# Find the gpsmonpid that is our grandchild
((didkill=0))
diff --git a/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh b/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh
index f74e7b0..15dc9c7 100755
--- a/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh
+++ b/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh
@@ -38,7 +38,10 @@ fi
ps -fjp $ppid | LG -p user.error
fi
- gpsmonpid=$(pgrep -lg $pgid | egrep '[[:space:]]gpsmon$' | sed 's/[[:space:]].*//')
+ # pgrep does not work during boot.
+ pgrpmemb=$(ps --no-heading -o pgid,pid,comm -e | grep '^ *'"${pgid}"' *' | sed -r 's/^ *[0-9]+ *//')
+ gpsmonpid=$(echo "${pgrpmemb}" | egrep '[[:space:]]gpsmon$' | sed 's/[[:space:]].*//')
+
((DEBUG)) && LG -p user.info "$pgid is pgid $gpsmonpid is gpsmonpid"
# Find the gpsmonpid that is our grandchild
((didkill=0))