summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-03-29 11:41:51 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-03-29 11:41:51 -0400
commit4814bafc93367cd1858f4a89813c3f3cfaf6b847 (patch)
treeb23b3199fc0f4b072fa58d3eac9709964e927270
parenta0ce32af15add094f888efb3f1b8ee33d7baa990 (diff)
downloadgpsd-4814bafc93367cd1858f4a89813c3f3cfaf6b847.tar.gz
Squeeze out some more code in the fixed-port-speed case.
-rwxr-xr-xdevtools/sizes6
-rw-r--r--gpsd.h-tail2
-rw-r--r--serial.c10
3 files changed, 16 insertions, 2 deletions
diff --git a/devtools/sizes b/devtools/sizes
index 7b6407dc..21fbee23 100755
--- a/devtools/sizes
+++ b/devtools/sizes
@@ -63,8 +63,10 @@ sizeit("Minimalist build, stripped to NMEA only with shm interface",
"minimalist",
["--disable-socket-export",
"--disable-control-socket",
- "--disable-ipv6"] +
- nmea_variants+binary_gps+non_gps+time_service+debugging)
+ "--disable-ipv6",
+ "--enable-fixed-port-speed=9600",
+ "--enable-max-devices=1",
+ ] + nmea_variants+binary_gps+non_gps+time_service+debugging)
sizeit("Normal build, configure options defaulted", "normal", [])
os.system("size gpsd-*-build")
os.system("rm gpsd-*-build")
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 73c5834e..5e471f89 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -366,7 +366,9 @@ struct gps_device_t {
#ifndef _WIN32
struct termios ttyset, ttyset_old;
#endif
+#ifndef FIXED_PORT_SPEED
unsigned int baudindex;
+#endif /* FIXED_PORT_SPEED */
int saved_baud;
struct gps_packet_t packet;
int getcount;
diff --git a/serial.c b/serial.c
index 26480767..cb63b0fc 100644
--- a/serial.c
+++ b/serial.c
@@ -465,7 +465,9 @@ int gpsd_serial_open(struct gps_device_t *session)
session->ttyset.c_iflag = session->ttyset.c_oflag =
session->ttyset.c_lflag = (tcflag_t) 0;
+#ifndef FIXED_PORT_SPEED
session->baudindex = 0;
+#endif /* FIXED_PORT_SPEED */
gpsd_set_speed(session, gpsd_get_speed(&session->ttyset_old), 'N', 1);
}
gpsd_report(LOG_SPIN, "open(%s) -> %d in gpsd_serial_open()\n",
@@ -515,14 +517,22 @@ bool gpsd_next_hunt_setting(struct gps_device_t * session)
if (session->packet.retry_counter++ >= SNIFF_RETRIES) {
session->packet.retry_counter = 0;
+#ifdef FIXED_PORT_SPEED
+ return false;
+#else
if (session->baudindex++ >=
(unsigned int)(sizeof(rates) / sizeof(rates[0])) - 1) {
session->baudindex = 0;
if (session->gpsdata.dev.stopbits++ >= 2)
return false; /* hunt is over, no sync */
+#endif /* FIXED_PORT_SPEED */
}
gpsd_set_speed(session,
+#ifdef FIXED_PORT_SPEED
+ FIXED_PORT_SPEED,
+#else
rates[session->baudindex],
+#endif /* FIXED_PORT_SPEED */
session->gpsdata.dev.parity,
session->gpsdata.dev.stopbits);
}