summaryrefslogtreecommitdiff
path: root/gpscat
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-11-20 01:43:46 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-11-20 01:43:46 +0000
commite4cbd2dafe2885a79135e8bb3872a29ca6308e49 (patch)
treea844d9c52519ad6c074791d94e32b90edd3cffc3 /gpscat
parentb7ba730901b37b6766e5f6a6ee1a14df259cee38 (diff)
downloadgpsd-e4cbd2dafe2885a79135e8bb3872a29ca6308e49.tar.gz
Trying to be tricky about which things we hexdumped was a lose.
Addresses Berlios bug #14776: gpsd don't work after python upgrade from 2.5 to 2.6.
Diffstat (limited to 'gpscat')
-rwxr-xr-xgpscat12
1 files changed, 4 insertions, 8 deletions
diff --git a/gpscat b/gpscat
index 78f39914..155abe70 100755
--- a/gpscat
+++ b/gpscat
@@ -11,14 +11,12 @@ NMEA_MAX = 86
# Lowest debug level at which packet getter begins to emit messages, minus one
BASELEVEL = gpspacket.LOG_IO
+highhalf_latch = True
+
def hexdump(str):
dmp = ""
for (i, ch) in enumerate(str):
- if curses.ascii.isprint(ord(ch)):
- dmp += ch
- elif ch == '\r' and i+1 < len(str) and str[i+1] == '\n':
- dmp += ch
- elif ch == '\n' and i-1 >= 0 and str[i-1] == '\r':
+ if curses.ascii.isprint(ord(ch)) or curses.ascii.isspace(ord(ch)):
dmp += ch
else:
dmp += "\\x%02x" % ord(ch)
@@ -104,9 +102,7 @@ if __name__ == '__main__':
if fd == tty and event == select.POLLIN:
if rawmode:
buf += os.read(tty, NMEA_MAX)
- if not buf.endswith("\n"):
- buf = hexdump(buf)
- sys.stdout.write(buf)
+ sys.stdout.write(hexdump(buf))
buf = ""
else:
(length, ptype, packet) = getter.get(tty)