summaryrefslogtreecommitdiff
path: root/gpscat
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2016-12-26 20:33:57 -0800
committerFred Wright <fw@fwright.net>2016-12-26 20:41:11 -0800
commit328cf5039c058b4d26fb5b2e15ea982b889653f6 (patch)
tree8bf3dc4e8ba312e93379097d1f765b46fd8958ea /gpscat
parent5f0a605a1a4f987ef7ab21279d9d6dfd30c949ea (diff)
downloadgpsd-328cf5039c058b4d26fb5b2e15ea982b889653f6.tar.gz
Fixes gpscat to avoid the possibly missing select.poll().
Although poll() is generally preferred to select() in C code, in Python, select.poll is considered OS-dependent, and is missing in some Python versions, notably in some OSX cases. Since gpscat is not a performance-critical application, simply using the older but more portable select.select is preferable to some fancier scheme using different methods on different OSes. TESTED: Ran gpscat on OSX with all supported Python versions.
Diffstat (limited to 'gpscat')
-rwxr-xr-xgpscat7
1 files changed, 2 insertions, 5 deletions
diff --git a/gpscat b/gpscat
index 0d8505e5..f649e108 100755
--- a/gpscat
+++ b/gpscat
@@ -111,17 +111,14 @@ if __name__ == '__main__':
termios.tcsetattr(tty, termios.TCSANOW,
[iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
- poller = select.poll()
- poller.register(tty, select.POLLIN)
-
buf = bytes()
if not rawmode:
getter = sniffer.new()
sniffer.register_report(reporter)
seqno = 0
while True:
- (fd, event) = poller.poll()[0]
- if fd == tty and event == select.POLLIN:
+ rlist, wlist, xlist = select.select([tty], [], [])
+ if rlist == [tty]:
if rawmode:
buf += os.read(tty, NMEA_MAX)
sys.stdout.write(hexdump(buf))