Skip to content

Commit

Permalink
Do not enable character echo with a GPS device
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-fb-martin committed Jan 2, 2020
1 parent fb7f946 commit 67df92e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hc_nmea.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <termios.h>

#include "houseclock.h"
#include "hc_db.h"
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 67df92e

Please sign in to comment.