diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2006-12-07 15:46:44 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2006-12-07 15:46:44 +0000 |
commit | 4ff462037f6b660ab44cfef40644ec6899e7ebc6 (patch) | |
tree | 413213ceba7d7a82ca4acfbfe7033fe6684e7bc5 /gpscat | |
parent | 9ffbd7777a56287e6a7f79c303906da3d95b7bf9 (diff) | |
download | gpsd-4ff462037f6b660ab44cfef40644ec6899e7ebc6.tar.gz |
Fix a packet-sniffer bug in comment processing. With this, gpscat acquires
some new capabilities.
Diffstat (limited to 'gpscat')
-rwxr-xr-x | gpscat | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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") |