summaryrefslogtreecommitdiff
path: root/gpsd.hotplug
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-05-02 17:59:25 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-05-02 17:59:25 +0000
commitfa6d541c5d9faa44637030c49774b7aade75b6ff (patch)
treed69093821cc4d0de45bcd869525ff8323d6a0a93 /gpsd.hotplug
parent40241d4e364ce2d5da809843c683bb09cd69463d (diff)
downloadgpsd-fa6d541c5d9faa44637030c49774b7aade75b6ff.tar.gz
This fixes the remove behavior, but something is screwy about the logging.
Diffstat (limited to 'gpsd.hotplug')
-rwxr-xr-xgpsd.hotplug10
1 files changed, 9 insertions, 1 deletions
diff --git a/gpsd.hotplug b/gpsd.hotplug
index e4d1de16..2523cf91 100755
--- a/gpsd.hotplug
+++ b/gpsd.hotplug
@@ -6,6 +6,7 @@
import sys, os, syslog, glob, socket, stat
CONTROL_SOCKET = "/var/run/gpsd.sock"
+WHEREAMI = "/etc/hotplug/usb/gpsd.hotplug"
def gpsd_control_connect():
"Acquire a connection to the GPSD control socket."
@@ -28,7 +29,7 @@ def gpsd_control_connect():
def gpsd_control(action, argument):
"Pass a command to gpsd; start the daemon if not already running."
- syslog.syslog("gpsd_control begins with action=%s, arg=%s:" % (action, argument))
+ syslog.syslog("gpsd_control begins with action=%s, arg=%s" % (action, argument))
connect = gpsd_control_connect()
if connect:
syslog.syslog("reached a running gpsd")
@@ -72,6 +73,13 @@ def hotplug(action, devpath):
syslog.syslog(tty + " has gone active")
gpsd_control(action, tty)
+
+ remover = os.getenv("REMOVER")
+ #syslog.syslog("REMOVER=%s" % remover)
+ fp = open(remover, "w")
+ fp.write(WHEREAMI + " remove " + tty)
+ fp.close()
+ os.chmod(remover, stat.S_IRUSR|stat.S_IXUSR|stat.S_IRGRP|stat.S_IXGRP)
return
syslog.syslog("gpsd.hotplug ends")
syslog.closelog()