summaryrefslogtreecommitdiff
path: root/xgps
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-08 21:43:39 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-08 21:43:39 -0400
commit24c44f102c6b6552d3f5924285fbb4aefe41ab69 (patch)
tree3253289c4cd58b0d90553f419ccbfebcedc11043 /xgps
parent55aaab663fe5d9723e4eeccfc273533d0e8c62da (diff)
downloadgpsd-24c44f102c6b6552d3f5924285fbb4aefe41ab69.tar.gz
Implement missing argument parsing so xgps can watch a remote daemon.
Diffstat (limited to 'xgps')
-rwxr-xr-xxgps21
1 files changed, 15 insertions, 6 deletions
diff --git a/xgps b/xgps
index 7f6247f6..5cb0aa58 100755
--- a/xgps
+++ b/xgps
@@ -582,9 +582,10 @@ class Base:
# I/O monitoring and gtk housekeeping
- def watch(self, daemon):
+ def watch(self, daemon, device):
"Set up monitoring of a daemon instance."
self.daemon = daemon
+ self.device = device
gobject.io_add_watch(daemon.sock, gobject.IO_IN, self.handle_response)
gobject.io_add_watch(daemon.sock, gobject.IO_ERR, self.handle_hangup)
gobject.io_add_watch(daemon.sock, gobject.IO_HUP, self.handle_hangup)
@@ -594,6 +595,8 @@ class Base:
if self.daemon.poll() == -1:
self.handle_hangup(source, condition)
if self.daemon.valid & gps.PACKET_SET:
+ if self.device and self.device != self.daemon.data["device"]:
+ return True
self.rawdisplay.set_text(self.daemon.response.strip())
if self.daemon.data["class"] == "SKY":
self.update_skyview(self.daemon.satellites)
@@ -646,18 +649,24 @@ if __name__ == "__main__":
'm':gps.client.deg_ddmm,
's':gps.client.deg_ddmmss}[degreefmt]
- if len(arguments) == 0:
- host = "localhost"
- else:
- host = arguments[0]
+ (host, port, device) = ("localhost", "2947", None)
+ if len(arguments):
+ args = arguments[0].split(":")
+ if len(args) >= 1:
+ host = args[0]
+ if len(args) >= 2:
+ port = args[1]
+ if len(args) >= 3:
+ device = args[2]
base = Base(deg_type=degreefmt)
base.set_units(unit_system)
try:
daemon = gps.gps(host=host,
+ port=port,
mode=gps.WATCH_ENABLE|gps.WATCH_JSON|gps.WATCH_SCALED,
verbose=debug)
- base.watch(daemon)
+ base.watch(daemon, device)
base.main()
except socket.error:
w = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,