From 88cd47988315e72d50efd137a538eca6100e76eb Mon Sep 17 00:00:00 2001 From: Kai Harrekilde-Petersen Date: Thu, 22 Mar 2018 22:34:21 +0100 Subject: [PATCH 2/5] On Linux systems, accept/try up to 921600 baud. Signed-off-by: Kai Harrekilde-Petersen --- gpsctl.c | 2 +- serial.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gpsctl.c b/gpsctl.c index 9a425f16..b9cf9d77 100644 --- a/gpsctl.c +++ b/gpsctl.c @@ -583,7 +583,7 @@ int main(int argc, char **argv) #ifdef RECONFIGURE_ENABLE } else if (reset) { /* hard reset will go through lower-level operations */ - const int speeds[] = {2400, 4800, 9600, 19200, 38400, 57600, 115200}; + const int speeds[] = {2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600}; static struct gps_device_t session; /* zero this too */ int i; diff --git a/serial.c b/serial.c index 2c171f21..4a9c1db1 100644 --- a/serial.c +++ b/serial.c @@ -211,6 +211,12 @@ static speed_t gpsd_get_speed_termios(const struct termios *ttyctl) return (115200); case B230400: return (230400); +#ifdef __linux__ + case B460800: + return (460800); + case B921600: + return (921600); +#endif /* __linux__ */ default: /* B0 */ return 0; } @@ -289,8 +295,17 @@ void gpsd_set_speed(struct gps_device_t *session, rate = B57600; else if (speed < 230400) rate = B115200; +#ifdef __linux__ + else if (speed < 460800) + rate = B230400; + else if (speed < 921600) + rate = B460800; + else + rate = B921600; +#else else rate = B230400; +#endif /* __linux__ */ if (rate != cfgetispeed(&session->ttyset) || parity != session->gpsdata.dev.parity @@ -676,7 +691,7 @@ bool gpsd_next_hunt_setting(struct gps_device_t * session) #else /* every rate we're likely to see on a GPS */ static unsigned int rates[] = - { 0, 4800, 9600, 19200, 38400, 57600, 115200, 230400}; + { 0, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600}; if (session->baudindex++ >= (unsigned int)(sizeof(rates) / sizeof(rates[0])) - 1) { -- 2.11.0