summaryrefslogtreecommitdiff
path: root/gpscat
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-12-07 15:46:44 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-12-07 15:46:44 +0000
commit4ff462037f6b660ab44cfef40644ec6899e7ebc6 (patch)
tree413213ceba7d7a82ca4acfbfe7033fe6684e7bc5 /gpscat
parent9ffbd7777a56287e6a7f79c303906da3d95b7bf9 (diff)
downloadgpsd-4ff462037f6b660ab44cfef40644ec6899e7ebc6.tar.gz
Fix a packet-sniffer bug in comment processing. With this, gpscat acquires
some new capabilities.
Diffstat (limited to 'gpscat')
-rwxr-xr-xgpscat11
1 files changed, 10 insertions, 1 deletions
diff --git a/gpscat b/gpscat
index 28f87340..245309d0 100755
--- a/gpscat
+++ b/gpscat
@@ -33,6 +33,7 @@ if __name__ == '__main__':
parity = None
stopbits = None
rawmode = True
+ typeflag = False
for (switch, val) in options:
if switch == '-p':
rawmode = False
@@ -42,6 +43,9 @@ if __name__ == '__main__':
stopbits = int(val[-1])
val = val[:-2]
speed = int(val)
+ elif switch == 't':
+ typeflag = True
+ rawmode = False
elif switch == '-h':
sys.stderr.write("usage: gpscat [-s] serial-port\n")
raise SystemExit, 0
@@ -91,7 +95,12 @@ if __name__ == '__main__':
buf = ""
else:
(type, packet) = getter.get(tty)
- sys.stdout.write(`type` + ": " + hexdump(packet) + "\n")
+ if packet == '':
+ break
+ if typeflag:
+ sys.stdout.write(`type` + ": " + hexdump(packet) + "\n")
+ else:
+ sys.stdout.write(hexdump(packet) + "\n")
except KeyboardInterrupt:
if rawmode:
sys.stdout.write("\n")