gpsd hotplug wrapper

Chris Rouch chris.rouch at
Fri Jan 14 09:37:32 UTC 2011

I have a usb to serial adapter on my PC. From time to time I attach a
Garmin etrex GPS to it and transfer data using gpsbabel. This all
works well and has done for years.

F14 (and probably older versions) includes gpsd. Possibly this works
better - I've not tried it. I use KDE and kde depends on it, so it has
to stay. Unfortunately gpsd comes with /lib/udev/gpsd.hotplug.wrapper.
This is a shell script which includes this:

wait_for_file() {
    [ -e "$1" ] && return 0
    local count=0
    while sleep 1; do
        count=$(( $count + 1 ))
         [ -e "$1" ] && return 0
        if [ $count -gt 60 ]; then
            return 1

# wait for /usr & /var to be mounted
wait_for_file /usr/bin/python && \
wait_for_file /var/run && \
  exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"

This script as executed by the udev startup process on every boot. Of
course it always fails, but only after a 60 second delay.

Maybe there are occasions when /usr/bin/python or /var/run will appear
during the execution of this script, but I can't think of any - and it
certainly isn't the case at boot time.

My system is switched off when it's not being used, so I tend to
notice any boot delays.

I think I should raise a bug for this, but I'm not certain what to
suggest for a solution. I think replacing the last part as follows
should work:

[ -e "/usr/bin/python" ] &&
[ -e "/var/run" ] &&
  exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"

Alternatively gpsd could be split up into the libraries (needed by
kde) and the udev stuff (only needed if you plug in a gps).




More information about the users mailing list