summaryrefslogtreecommitdiff
path: root/gpscat
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-01-12 23:16:31 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-01-12 23:16:31 +0000
commit4464c9213776281393c6d66b3b2030b422870f44 (patch)
treeb42eeca198aef991dc52b0f9e1eeadbd4f3f4b69 /gpscat
parent582c3bddadacba8ee0535bd5b3431748e0444d15 (diff)
downloadgpsd-4464c9213776281393c6d66b3b2030b422870f44.tar.gz
Improve the packet instrumentation slightly.
Diffstat (limited to 'gpscat')
-rwxr-xr-xgpscat10
1 files changed, 8 insertions, 2 deletions
diff --git a/gpscat b/gpscat
index be4f629c..78f6b6b8 100755
--- a/gpscat
+++ b/gpscat
@@ -9,7 +9,7 @@ import gpspacket
NMEA_MAX = 86
# Lowest debug level at which packet getter begins to emit messages, minus one
-BASELEVEL = 5
+BASELEVEL = gpspacket.LOG_IO
def hexdump(str):
dmp = ""
@@ -109,7 +109,13 @@ if __name__ == '__main__':
else:
(type, packet) = getter.get(tty)
length = len(packet)
- if type == gpspacket.BAD_PACKET or length == 0:
+ if type == gpspacket.BAD_PACKET:
+ if debuglevel >= BASELEVEL:
+ sys.stdout.write("gpscat: terminating on bad packet\n")
+ break
+ elif length == 0:
+ if debuglevel >= BASELEVEL:
+ sys.stdout.write("gpscat: terminating on zero-length packet\n")
break
if typeflag:
sys.stdout.write(`type` + " (" + `length` + "): " + hexdump(packet) + "\n")