[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gpsd-commit-watch
Subject:    [Gpsd-commit-watch] r1845 - trunk
From:       esr () sheep ! berlios ! de (Eric S !  Raymond at BerliOS)
Date:       2005-02-26 23:40:53
Message-ID: 200502262340.j1QNer66022159 () sheep ! berlios ! de
[Download RAW message or body]

Author: esr
Date: 2005-02-27 00:40:27 +0100 (Sun, 27 Feb 2005)
New Revision: 1845

Modified:
   trunk/INSTALL
   trunk/configure.ac
   trunk/drivers.c
   trunk/gpsd.h
   trunk/serial.c
Log:
Turns out reliable sync isn't good enough for some SiRF chips. you really
need the timeout.


Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL	2005-02-26 23:09:28 UTC (rev 1844)
+++ trunk/INSTALL	2005-02-26 23:40:27 UTC (rev 1845)
@@ -32,12 +32,6 @@
 xgps.ad and xgpsspeed.ad to your home directory or to the system-wide X
 app-defaults directory.
 
-On older Linux kernels (2.4.5 or earlier) the O_SYNC flag of open(2) 
-may not be reliable.  If you're building for an old kernel, configure 
-with --enable-unreliable-sync.  This will tell gpsd to use timeouts 
-after sends to the GPS rather than relying on write(2) to block until
-it completes.
-
 4. Determine whether you need a non-NMEA driver.  Usually you will not,
 but there are unusual exceptions.  Consult the hardware page at
 

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2005-02-26 23:09:28 UTC (rev 1844)
+++ trunk/configure.ac	2005-02-26 23:40:27 UTC (rev 1845)
@@ -171,18 +171,6 @@
   AC_MSG_RESULT([no])
 fi
 
-dnl is sync unreliable?
-AC_ARG_ENABLE(unreliable_sync,
-  AC_HELP_STRING([--enable-unreliable-sync],
-                 [enable unreliable_sync support]),
-  [ac_unreliable_sync=$enableval], [ac_unreliable_sync=no])
-AC_MSG_CHECKING([O_SYNC open of tty isn't reliable])
-if test x"$ac_unreliable_sync" = "xyes"; then
-    AC_MSG_RESULT([yes])
-	AC_DEFINE([UNRELIABLE_SYNC], 1, [O_SYNC open of tty isn't reliable])
-else
-  AC_MSG_RESULT([no])
-fi
 AC_OUTPUT(Makefile gpsd.spec)
 
 dnl Output the configuration summary
@@ -197,7 +185,6 @@
 echo "Logfile                 : $ac_logfile"
 echo "Enable shared libraries : $enable_shared"
 echo "Profiling               : $ac_profiling"
-echo "Unreliable sync         : $ac_unreliable_sync"
 echo "------------------------------------------"
 echo "Configure finished, type 'make' to build."
 

Modified: trunk/drivers.c
===================================================================
--- trunk/drivers.c	2005-02-26 23:09:28 UTC (rev 1844)
+++ trunk/drivers.c	2005-02-26 23:40:27 UTC (rev 1845)
@@ -109,9 +109,16 @@
 {
     if (nmea_send(session->gNMEAdata.gps_fd, "$PSRF100,1,%d,8,1,0", speed) < 0)
 	return 0;
-#ifdef UNRELIABLE_SYNC
-    gpsd_drain(session->gNMEAdata.gps_fd);
-#endif /* UNRELIABLE_SYNC */
+    tcdrain(session->gNMEAdata.gps_fd);
+    /* 
+     * 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);
     return 1;
 }
 

Modified: trunk/gpsd.h
===================================================================
--- trunk/gpsd.h	2005-02-26 23:09:28 UTC (rev 1844)
+++ trunk/gpsd.h	2005-02-26 23:40:27 UTC (rev 1845)
@@ -147,7 +147,6 @@
 extern int gpsd_set_speed(struct gps_session_t *session, 
 			  unsigned int speed, unsigned int stopbits);
 extern int gpsd_get_speed(struct termios *);
-extern void gpsd_drain(int ttyfd);
 extern void gpsd_close(struct gps_session_t *context);
 extern void gpsd_binary_fix_dump(struct gps_session_t *session, char *buf);
 extern void gpsd_binary_satellite_dump(struct gps_session_t *session, char *buf);

Modified: trunk/serial.c
===================================================================
--- trunk/serial.c	2005-02-26 23:09:28 UTC (rev 1844)
+++ trunk/serial.c	2005-02-26 23:40:27 UTC (rev 1845)
@@ -61,7 +61,8 @@
     if (speed!=cfgetispeed(&session->ttyset) || stopbits!=session->gNMEAdata.stopbits) {
 	cfsetispeed(&session->ttyset, (speed_t)rate);
 	cfsetospeed(&session->ttyset, (speed_t)rate);
-	session->ttyset.c_cflag |= (CSIZE & (stopbits==2 ? CS7 : CS8)) | CREAD | CLOCAL;
+	session->ttyset.c_cflag &=~ CSIZE;
+	session->ttyset.c_cflag |= (CSIZE & (stopbits==2 ? CS7 : CS8));
 	if (tcsetattr(session->gNMEAdata.gps_fd, TCSANOW, &session->ttyset) != 0)
 	    return 0;
 	tcflush(session->gNMEAdata.gps_fd, TCIOFLUSH);
@@ -98,6 +99,7 @@
 	 * in the presence of flow control.  Thus, turn off CRTSCTS.
 	 */
 	session->ttyset.c_cflag &= ~(PARENB | CRTSCTS);
+	session->ttyset.c_cflag |= CREAD | CLOCAL;
 	session->ttyset.c_iflag = session->ttyset.c_oflag = session->ttyset.c_lflag = (tcflag_t) 0;
 	session->ttyset.c_oflag = (ONLCR);
 
@@ -123,22 +125,6 @@
     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) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic