summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2009-12-01 20:18:56 +0000
committerGary E. Miller <gem@rellim.com>2009-12-01 20:18:56 +0000
commit0c4bd78abbe4a195cf183de9918f49a12de51c74 (patch)
tree3d36352c87a9b4fe57cf11fa5d4ccc7c3a9551e1 /serial.c
parent5f2fcfea72b87dc2c03e84f8d7a1b81d378253c2 (diff)
downloadgpsd-0c4bd78abbe4a195cf183de9918f49a12de51c74.tar.gz
When shutting down the serial port keep the last baud rate...
...instead of returning to the original one. That way if an autobaud event or manual speed change occured it is preserved. This speeds up the next gpsd start as the tty should be on the proper speed.
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 647bf30c..1791b851 100644
--- a/serial.c
+++ b/serial.c
@@ -387,6 +387,13 @@ void gpsd_close(struct gps_device_t *session)
}
/* this is the clean way to do it */
session->ttyset_old.c_cflag |= HUPCL;
+ /* keep the most recent baud rate */
+ /*@ ignore @*/
+ (void)cfsetispeed(&session->ttyset_old,
+ (speed_t)session->gpsdata.dev.baudrate);
+ (void)cfsetospeed(&session->ttyset_old,
+ (speed_t)session->gpsdata.dev.baudrate);
+ /*@ end @*/
(void)tcsetattr(session->gpsdata.gps_fd,TCSANOW,&session->ttyset_old);
(void)close(session->gpsdata.gps_fd);
session->gpsdata.gps_fd = -1;