Skip to content

Commit 67df92e

Browse files
Do not enable character echo with a GPS device
1 parent fb7f946 commit 67df92e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

hc_nmea.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
#include <sys/stat.h>
123123
#include <fcntl.h>
124124
#include <time.h>
125+
#include <termios.h>
125126

126127
#include "houseclock.h"
127128
#include "hc_db.h"
@@ -214,6 +215,16 @@ int hc_nmea_initialize (int argc, const char **argv) {
214215
hc_nmea_reset();
215216
gpsTty = open(gpsDevice, O_RDONLY);
216217

218+
// Remove echo of characters from the GPS device.
219+
if (gpsTty >= 0) {
220+
struct termios options;
221+
int status = tcgetattr(gpsTty, &options);
222+
if (status == 0) {
223+
options.c_lflag &= (~(ECHO+ECHONL));
224+
tcsetattr(gpsTty, TCSANOW, &options);
225+
}
226+
}
227+
217228
gpsInitialized = time(0);
218229
return gpsTty;
219230
}

0 commit comments

Comments
 (0)