From 67df92e5abd69a1fbff7fe17b40f92dab5506d78 Mon Sep 17 00:00:00 2001 From: Pascal Martin Date: Wed, 1 Jan 2020 21:23:14 -0800 Subject: [PATCH] Do not enable character echo with a GPS device --- hc_nmea.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hc_nmea.c b/hc_nmea.c index dfe3602..9b06ee5 100644 --- a/hc_nmea.c +++ b/hc_nmea.c @@ -122,6 +122,7 @@ #include #include #include +#include #include "houseclock.h" #include "hc_db.h" @@ -214,6 +215,16 @@ int hc_nmea_initialize (int argc, const char **argv) { hc_nmea_reset(); gpsTty = open(gpsDevice, O_RDONLY); + // Remove echo of characters from the GPS device. + if (gpsTty >= 0) { + struct termios options; + int status = tcgetattr(gpsTty, &options); + if (status == 0) { + options.c_lflag &= (~(ECHO+ECHONL)); + tcsetattr(gpsTty, TCSANOW, &options); + } + } + gpsInitialized = time(0); return gpsTty; }