summaryrefslogtreecommitdiff
path: root/gpscat
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2017-07-01 15:35:41 -0700
committerGary E. Miller <gem@rellim.com>2017-07-01 15:35:41 -0700
commite60ecd383e1c24e9a7e9a4328fb3ac2bb019ab27 (patch)
tree06d4f36f956207652080ba99e4c8ec26f193b679 /gpscat
parente3147dce9df8799422191c6f3aea1efff048068a (diff)
downloadgpsd-e60ecd383e1c24e9a7e9a4328fb3ac2bb019ab27.tar.gz
gpscat: pep8 fixes
Diffstat (limited to 'gpscat')
-rwxr-xr-xgpscat27
1 files changed, 18 insertions, 9 deletions
diff --git a/gpscat b/gpscat
index f649e108..6576a50e 100755
--- a/gpscat
+++ b/gpscat
@@ -10,8 +10,14 @@
# Preserve this property!
from __future__ import absolute_import, print_function, division
-import os, sys, termios, socket, select, getopt, curses.ascii
+import curses.ascii
+import getopt
import gps.packet as sniffer
+import os
+import select
+import socket
+import sys
+import termios
# The spec says 82, but some receivers (TN-200, GSW 2.3.2) output 86 characters
# the Skyrtaq S2525F8 emits 100 chars
@@ -41,7 +47,8 @@ def reporter(errlevel, msg):
def printusage():
- sys.stderr.write("usage: gpscat [-s speed] [-p] [-t] [-D debuglevel] serial-port\n")
+ sys.stderr.write("usage: gpscat [-s speed] [-p] [-t] [-D debuglevel] "
+ "serial-port\n")
if __name__ == '__main__':
buf = bytes()
@@ -80,14 +87,16 @@ if __name__ == '__main__':
raise SystemExit(1)
if "rfcomm" in arguments[0]: # Bluetooth special case
- s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
+ s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM,
+ socket.BTPROTO_RFCOMM)
s.connect((arguments[0], 1))
tty = s.fileno()
else: # Ordinary device
tty = os.open(arguments[0], os.O_RDWR)
- if speed != None:
- (iflag, oflag, cflag, lflag, ispeed, ospeed, cc) = termios.tcgetattr(tty)
+ if speed is not None:
+ (iflag, oflag, cflag, lflag, ispeed, ospeed, cc) = \
+ termios.tcgetattr(tty)
try:
ispeed = ospeed = eval("termios.B%d" % speed)
except AttributeError:
@@ -109,7 +118,7 @@ if __name__ == '__main__':
cflag |= termios.PARENB
cflag &= ~termios.PARODD
termios.tcsetattr(tty, termios.TCSANOW,
- [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
+ [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
buf = bytes()
if not rawmode:
@@ -129,7 +138,9 @@ if __name__ == '__main__':
if length == 0:
break
if typeflag:
- sys.stdout.write(repr(ptype) + " (" + repr(length) + "@" + repr(counter-length) + "): " + hexdump(packet))
+ sys.stdout.write(repr(ptype) + " (" + repr(length)
+ + "@" + repr(counter-length) + "): "
+ + hexdump(packet))
sys.stdout.write("\n")
else:
sys.stdout.write(hexdump(packet) + "\n")
@@ -141,5 +152,3 @@ if __name__ == '__main__':
# Local variables:
# mode: python
# end:
-
-