summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-02-23 08:48:40 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-02-23 08:48:40 +0000
commiteb57c4a4537bcf6e9055ecfa32272cea1c388760 (patch)
tree3867b16ed9c632b3378c89b25a3c9c2b148d4e21 /serial.c
parentc741a5c443aee09dc1e08200d0d9a519ab65f35a (diff)
downloadgpsd-eb57c4a4537bcf6e9055ecfa32272cea1c388760.tar.gz
Factor out sync after write.
Diffstat (limited to 'serial.c')
-rw-r--r--serial.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/serial.c b/serial.c
index b9f41105..8b19a6e4 100644
--- a/serial.c
+++ b/serial.c
@@ -122,6 +122,22 @@ int gpsd_open(int device_speed, int stopbits, struct gps_session_t *session)
return session->gNMEAdata.gps_fd;
}
+#ifdef UNRELIABLE_SYNC
+void gpsd_drain(int ttyfd)
+{
+ tcdrain(ttyfd);
+ /*
+ * This definitely fails below 40 milliseconds on a BU-303b.
+ * 50ms is also verified by Chris Kuethe on
+ * Pharos iGPS360 + GSW 2.3.1ES + prolific
+ * Rayming TN-200 + GSW 2.3.1 + ftdi
+ * Rayming TN-200 + GSW 2.3.2 + ftdi
+ * so it looks pretty solid.
+ */
+ usleep(50000);
+}
+#endif /* UNRELIABLE_SYNC */
+
void gpsd_close(struct gps_session_t *session)
{
if (session->gNMEAdata.gps_fd != -1) {