summaryrefslogtreecommitdiff
path: root/gpsctl.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-02-14 10:33:09 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-02-14 10:33:09 +0000
commit95f1aa5605ffe362d0b1a01e1079941bdf7a9416 (patch)
tree67920f036650201dd58c9df3788e8aa9c699d6d6 /gpsctl.c
parent69bb5fa047ace51cb6c53328a4b021881f87f38f (diff)
downloadgpsd-95f1aa5605ffe362d0b1a01e1079941bdf7a9416.tar.gz
sirfmon now switches speed using the driver method.
The trick was to insert the right tcdrain() and delay combination before changing the tty parameters,. otherwise the control message gets trashed in the UART buffer when the baud rate change comes down. Put a similar delay after the gpsctl call. Probably not needed, but it can't hurt...
Diffstat (limited to 'gpsctl.c')
-rw-r--r--gpsctl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gpsctl.c b/gpsctl.c
index b5b0cfcc..6ff16988 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -443,8 +443,15 @@ int main(int argc, char **argv)
session.device_type->type_name);
status = 1;
}
- else if (!session.device_type->speed_switcher(&session,
+ else if (session.device_type->speed_switcher(&session,
(speed_t)atoi(speed))) {
+ /*
+ * See the comment attached to the 'B' command in gpsd.
+ * Probably not needed here, but it can't hurt.
+ */
+ (void)tcdrain(session.gpsdata.gps_fd);
+ (void)usleep(50000);
+ } else {
gpsd_report(LOG_ERROR, "speed change failed.\n");
status = 1;
}