diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-03-08 06:29:39 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-03-08 06:29:39 +0000 |
commit | ebd128f2dc6143056e270ab604195f08bef77adc (patch) | |
tree | 04ab9b5b15390e3a2d6ba5937e005f7f423fdd92 /gpsd.hotplug | |
parent | 4d1df35bbac5258733b6f86e9276fd6ff9429380 (diff) | |
download | gpsd-ebd128f2dc6143056e270ab604195f08bef77adc.tar.gz |
Launch completely from the hotpug script.
Diffstat (limited to 'gpsd.hotplug')
-rwxr-xr-x | gpsd.hotplug | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gpsd.hotplug b/gpsd.hotplug index c1be0676..b9b4e810 100755 --- a/gpsd.hotplug +++ b/gpsd.hotplug @@ -31,6 +31,7 @@ def gpsd_connect(): syslog.syslog("gpsd is not running or is unreachable") return None else: + syslog.syslog("found gpsd.") return sockfile def wake_up_gpsd(devpath): @@ -47,6 +48,13 @@ def wake_up_gpsd(devpath): else: tty = "/dev/" + subnodes[0] syslog.syslog(tty + " has gone active") + # Cope with a race condition + i = 0 + while not os.path.exists(tty): + syslog.syslog("but " + tty + " does not actually exist (" + `i` +")") + time.sleep(1) + i += 1 + syslog.syslog(tty + "created") # Next get a connection to gpsd; start one if not already running connect = gpsd_connect() @@ -54,7 +62,7 @@ def wake_up_gpsd(devpath): syslog.syslog("reached a running gpsd") else: syslog.syslog("attempting to launch gpsd") - os.system("/etc/init.d/gpsd start") + os.system("gpsd") connect = gpsd_connect() if not connect: return |