diff --git a/net_io.c b/net_io.c index cb53b650..0c643451 100644 --- a/net_io.c +++ b/net_io.c @@ -4438,6 +4438,10 @@ static int readClient(struct client *c, int64_t now) { nread = recv(c->fd, c->buf + c->buflen, left, 0); } else { // read instead of recv for modesbeast / gns-hulc .... + if (Modes.debug_serial) { + fprintTimePrecise(stderr, now); + fprintf(stderr, " serial read ... fd: %d maxbytes: %d\n", c->fd, left); + } nread = read(c->fd, c->buf + c->buflen, left); if (Modes.debug_serial) { fprintTimePrecise(stderr, now); diff --git a/sdr_beast.c b/sdr_beast.c index ffd0ea22..94111a0d 100644 --- a/sdr_beast.c +++ b/sdr_beast.c @@ -137,9 +137,6 @@ bool beastOpen(void) { speed_t baud = B3000000; int flags = O_RDWR | O_NOCTTY; - if (Modes.debug_serial) { - flags |= O_NONBLOCK; - } Modes.beast_fd = open(Modes.beast_serial, flags); if (Modes.beast_fd < 0) { fprintf(stderr, "Failed to open serial device %s: %s\n", @@ -157,8 +154,8 @@ bool beastOpen(void) { tios.c_oflag = 0; tios.c_lflag = 0; tios.c_cflag = CS8 | CRTSCTS; - tios.c_cc[VMIN] = 11; - tios.c_cc[VTIME] = 0; + tios.c_cc[VMIN] = 11; // read returns when a minimum of 11 characters are available + tios.c_cc[VTIME] = 1; // 100 ms timeout for reads if (Modes.sdr_type == SDR_GNS) { baud = B921600; @@ -194,6 +191,7 @@ bool beastOpen(void) { if (Modes.sdr_type == SDR_MODESBEAST) { /* set options */ + beastSetOption('B'); /* set classic beast mode */ beastSetOption('C'); /* use binary format */ beastSetOption('H'); /* RTS enabled */