diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2004-09-10 17:12:20 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2004-09-10 17:12:20 +0000 |
commit | 966d1c2adc8a041134e44247bd37aeb52e9c88a9 (patch) | |
tree | 91a5d0841ab67e5ee300d82af0b6e72026256d1c | |
parent | 2f127814ff887dd85b3ed510150da4cdf497beeb (diff) | |
download | gpsd-966d1c2adc8a041134e44247bd37aeb52e9c88a9.tar.gz |
Don't try to set tty parameters if the open fails.
-rwxr-xr-x | gpsd.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -251,7 +251,9 @@ class gpsd(gps.gpsdata): close = __del__ def activate(self): - self.ttyfp = open(self.device, "rw"); + self.ttyfp = open(self.device, "rw") + if self.ttyfp = None: + return None self.normal = termios.tcgetattr(self.ttyfp.fileno()) self.raw = termios.tcgetattr(self.ttyfp.fileno()) self.raw[0] = 0 # iflag @@ -263,6 +265,7 @@ class gpsd(gps.gpsdata): self.raw[4] = self.raw[5] = eval("termios.B" + `self.bps`) termios.tcsetattr(self.ttyfp.fileno(), termios.TCSANOW, self.raw) self.online = True; + return self.ttyfp def deactivate(self): if hasattr(self, 'normal'): |