diff --git a/hardware/common/serial.c b/hardware/common/serial.c index 3395c3e0..6bf0e402 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -95,6 +95,13 @@ int serial_close(int fd) #endif } +int serial_flush(int fd) +{ + + tcflush(fd, TCIOFLUSH); + +} + void *serial_backup_params(int fd) { #ifdef _WIN32 diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index a103e8fc..2138aa70 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -42,7 +42,6 @@ #define NUM_TRIGGER_STAGES 4 #define TRIGGER_TYPES "01" #define SERIAL_SPEED B115200 -/* TODO: SERIAL_ bits, parity, stop bit */ #define CLOCK_RATE 100000000 /* Command opcodes */ @@ -243,12 +242,7 @@ static int hw_init(char *deviceinfo) * respond with g_poll(). */ g_message("probing %s...", (char *)l->data); -#ifdef _WIN32 - // FIXME - // hdl = serial_open(l->data, 0); -#else fd = serial_open(l->data, O_RDWR | O_NONBLOCK); -#endif if (fd != -1) { serial_params[devcnt] = serial_backup_params(fd); serial_set_params(fd, 115200, 8, 0, 1, 2); @@ -631,10 +625,7 @@ static int receive_data(int fd, int revents, void *user_data) } free(raw_sample_buf); -#ifndef _WIN32 - /* TODO: Move to serial.c? */ - tcflush(fd, TCIOFLUSH); -#endif + serial_flush(fd); serial_close(fd); packet.type = DF_END; packet.length = 0;