summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorBernd Zeimetz <bernd@bzed.de>2011-11-14 14:32:25 +0100
committerBernd Zeimetz <bernd@bzed.de>2011-11-14 14:32:25 +0100
commit9d1e0eb4dbdd7300e847f4ba4b6904074da27f24 (patch)
tree569780154e84c918027f4ab2363cc9711a6f15ff /serial.c
parent4888c19690d01ebe4cd0f1fdd4c4acb1794d0cdb (diff)
downloadgpsd-9d1e0eb4dbdd7300e847f4ba4b6904074da27f24.tar.gz
c_ispeed is missing in the termios struct on some architectures.
So set the serial parameters always in case we can't read c_ispeed.
Diffstat (limited to 'serial.c')
-rw-r--r--serial.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/serial.c b/serial.c
index 11a394ce..75f37034 100644
--- a/serial.c
+++ b/serial.c
@@ -593,8 +593,13 @@ void gpsd_close(struct gps_device_t *session)
* them the first time. Economical, and avoids tripping over an
* obscure Linux 2.6 kernel bug that disables threaded
* ioctl(TIOCMWAIT) on a device after tcsetattr() is called.
+ *
+ * Unfortunately the termios struct doesn't have c_ispeed/c_ospeed
+ * on all architectures. Its missing on sparc, mips/mispel and hurd-i386 at least.
*/
+#if defined(_HAVE_STRUCT_TERMIOS_C_ISPEED)
if (session->ttyset_old.c_ispeed != session->ttyset.c_ispeed || (session->ttyset_old.c_cflag & CSTOPB) != (session->ttyset.c_cflag & CSTOPB)) {
+#endif
/*@ ignore @*/
(void)cfsetispeed(&session->ttyset_old,
(speed_t) session->gpsdata.dev.baudrate);
@@ -603,7 +608,9 @@ void gpsd_close(struct gps_device_t *session)
/*@ end @*/
(void)tcsetattr(session->gpsdata.gps_fd, TCSANOW,
&session->ttyset_old);
+#if defined(_HAVE_STRUCT_TERMIOS_C_ISPEED)
}
+#endif
gpsd_report(LOG_SPIN, "close(%d) in gpsd_close(%s)\n",
session->gpsdata.gps_fd, session->gpsdata.dev.path);
(void)close(session->gpsdata.gps_fd);