From 05affb77faf1bf71e15b4a11b35df80f42a9b639 Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Fri, 18 Jan 2019 16:07:24 -0800 Subject: driver_sirf: Obey the -b (readonly) flag. --- driver_sirf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/driver_sirf.c b/driver_sirf.c index 5b701975..9fb82a38 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -244,6 +244,10 @@ static bool sirf_write(struct gps_device_t *session, unsigned char *msg) bool ok; unsigned int type = (unsigned int)msg[4]; + /* do not write if -b (readonly) option set */ + if (session->context->readonly) + return true; + /* * Control strings spaced too closely together confuse the SiRF * IV. This wasn't an issue on older SiRFs, but they've gone to a @@ -274,10 +278,11 @@ static bool sirf_write(struct gps_device_t *session, unsigned char *msg) gpsd_log(&session->context->errout, LOG_PROG, "SiRF: Writing MID %#02x:\n", type); - ok = (gpsd_write(session, (const char *)msg, len+8) == (ssize_t) (len+8)); + ok = (gpsd_write(session, (const char *)msg, len + 8) == + (ssize_t) (len + 8)); session->driver.sirf.need_ack = type; - return (ok); + return ok; } #ifdef CONTROLSEND_ENABLE -- cgit v1.2.1