diff options
-rw-r--r-- | gpsd.spec.in | 2 | ||||
-rw-r--r-- | gpsd.usermap | 12 | ||||
-rwxr-xr-x | gpsdplug | 27 |
3 files changed, 40 insertions, 1 deletions
diff --git a/gpsd.spec.in b/gpsd.spec.in index 9abed168..b180b6ac 100644 --- a/gpsd.spec.in +++ b/gpsd.spec.in @@ -107,7 +107,7 @@ if [ -d /etc/udev/rules.d/ ]; then rm /etc/udev/rules.d/80-gpsd.rules; fi %changelog * Wed Mar 2 2005 Eric S. Raymond <esr@snark.thyrsus.com> - @VERSION@-1 - New F command allows changing the GPS device after startup time; - this will be useful wuth startup scripts. + this will be useful with hotplug scripts. * Wed Mar 02 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.15-1 - A new packet engine autobauds much more quickly, and now iterates diff --git a/gpsd.usermap b/gpsd.usermap new file mode 100644 index 00000000..8de0847e --- /dev/null +++ b/gpsd.usermap @@ -0,0 +1,12 @@ +# Hotplug device map for GPSD +# +# GPSes don't have their own USB device class. They're serial-over-USB +# devices, so what you see is actually the ID of the serial-over-USB chip. +# Fortunately, just two of these account for over 80% of consumer-grade +# GPS sensors. The gpsdplug script will tell a running gpsd that it should +# look at the device that just went active, because it might be a GPS. +# +# The Prolific Technology 2303 +gpsdplug 0x0003 0x067b 0x2303 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# FTDI 8U232AM +gpsdplug 0x0003 0x0403 0x6001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 diff --git a/gpsdplug b/gpsdplug new file mode 100755 index 00000000..0ae937e1 --- /dev/null +++ b/gpsdplug @@ -0,0 +1,27 @@ +#!/usr/bin/python +# Hotplug script for gpsd +import os, syslog, glob + +syslog.openlog('gpsdplug', 0, syslog.LOG_DAEMON) +syslog.syslog("gpsdplug begins with action: %s" % os.getenv("ACTION")) +devpath = os.getenv("DEVPATH") +if not devpath: + syslog.syslog("No DEVPATH") +else: + #syslog.syslog("DEVPATH = %s" % devpath) + subnodes = glob.glob("/sys" + devpath + "/*") + subnodes = map(os.path.basename, subnodes) + subnodes = filter(lambda s: s.startswith("ttyUSB"), subnodes) + if len(subnodes) == 0: + syslog.syslog("no ttyUSB device under " + devpath) + elif len(subnodes) > 1: + syslog.syslog("too many ttyUSB devices under " + devpath) + else: + tty = subnodes[0] + syslog.syslog(tty + " has gone active") + +syslog.syslog("gpsdplug ends") +syslog.closelog() + + + |