From c6c4cbf9d12a143ed69cfa76b41a3979b9640856 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 24 Oct 2017 18:20:33 -0500 Subject: Hang in gpsd_ubx_fixed during boot, non-existent gpsd.hotplug.wrapper message in udev rules --- recipes-navigation/gpsd/gpsd/gpsd.rules | 3 ++- recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh | 29 ++++++++++++++++++-------- recipes-navigation/gpsd/gpsd_3.16.bb | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd.rules b/recipes-navigation/gpsd/gpsd/gpsd.rules index 4817222..dc90ad6 100644 --- a/recipes-navigation/gpsd/gpsd/gpsd.rules +++ b/recipes-navigation/gpsd/gpsd/gpsd.rules @@ -42,7 +42,8 @@ ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", SYMLINK="gps%n", RUN+="/lib/ude # u-blox 4 ATTR{idVendor}=="1546", ATTR{idProduct}=="01a4", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -ACTION=="remove", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# mLinux does not come with gpsd.hotplug.wrapper +# ACTION=="remove", RUN+="/lib/udev/gpsd.hotplug.wrapper" KERNEL=="ttyXRUSB2", SYMLINK+="gps0" KERNEL=="pps0", OWNER="root", GROUP="tty", MODE="0660", SYMLINK+="gpspps0" diff --git a/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh b/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh index 9fd3f7f..c975942 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh +++ b/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh @@ -29,25 +29,35 @@ if ! [[ -x /usr/bin/gpsmon ]] ; then exit 0 fi - +ppid=$$ +# echo gpsd_ubx_fixed parent $$ >>/tmp/gpsdlog.${ppid} +# Restrict future kill to our process group. During boot, +# this is the entire rc complex, but not any daemons. +pgid=$(ps -o pgrp -p $ppid --no-heading) # Terminate gpsmon after 10 seconds if it is our child ( sleep 10 - ppid=$$ - # echo "looking for shell ${ppid}" - gpsmonpid=$(ps -o pid,ppid,comm -e | egrep "[[:space:]]${ppid}[[:space:]]+gpsmon$" | sed -r 's/^[[:space:]]*([0-9]*)[[:space:]]+.*/\1/') - # echo sleeper TERM found pid $gpsmonpid + # echo in child pgid $pgid >>"/tmp/gpsdlog.${ppid}" + # ps -o pid,pgid,args -e >>"/tmp/log1.${ppid}" + # Kill a gpsmon -a in our process group. Hopefully this is our + # parents gpsmon -a. + gpsmonpid=$(ps -o pid,pgid,args -e | egrep "[[:space:]]${pgid}[[:space:]]+gpsmon[[:space:]]-a$" | sed -r 's/^[[:space:]]*([0-9]*)[[:space:]]+.*/\1/') + # echo sleeper TERM found pid $gpsmonpid >>"/tmp/gpsdlog.${ppid}" if ((${#gpsmonpid})) ; then - logger -p user.info "terminating gpscat(${gpsmonpid}) with SIGTERM" + logger -p user.info "terminating gpsmon(${gpsmonpid}) with SIGTERM" + # echo "terminating gpsmon(${gpsmonpid}) with SIGTERM" kill ${gpsmonpid} else exit 0 fi sleep 2 - gpsmonpid=$(ps -o pid,ppid,comm -e | egrep "[[:space:]]${ppid}[[:space:]]+gpsmon$" | sed -r 's/^[[:space:]]*([0-9]*)[[:space:]]+.*/\1/') - # echo sleeper KILL found pid $gpsmonpid + # echo "SIGKILL next" >>"/tmp/gpsdlog.${ppid}" + # ps -o pid,pgid,comm -e >>"/tmp/log2.${ppid}" + gpsmonpid=$(ps -o pid,pgid,args -e | egrep "[[:space:]]${pgid}[[:space:]]+gpsmon[[:space:]]-a$" | sed -r 's/^[[:space:]]*([0-9]*)[[:space:]]+.*/\1/') + # echo sleeper KILL found pid $gpsmonpid >>"/tmp/gpsdlog.${ppid}" + # Kill with SIGKILL, in case SIGTERM fails. if ((${#gpsmonpid})) ; then - logger -p user.info "terminating gpscat(${gpsmonpid}) with SIGKILL" + logger -p user.info "terminating gpsmon(${gpsmonpid}) with SIGKILL" kill -9 ${gpsmonpid} fi ) & @@ -83,6 +93,7 @@ stuff="$(gpsmon -a 2>&1 | { fi })" +# echo Past GPSMON in gpsd_ubx_fixed pid $$ if ((${#stuff} == 0)) ; then logger -p user.err No data from GPS exit 1 diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index a2c4dbe..95f7ab5 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -4,7 +4,7 @@ LICENSE = "BSD" LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800" DEPENDS = "dbus dbus-glib ncurses python libusb1 chrpath-replacement-native pps-tools" PROVIDES = "virtual/gpsd" -PR="m3" +PR="m4" EXTRANATIVEPATH += "chrpath-native" -- cgit v1.2.3