From a0442ed58dee48a521ea053083ea967894507898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 11 Jul 2018 22:19:56 +0200 Subject: New upstream version 2.0.1+repack --- spectro/icoms.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spectro/icoms.c') diff --git a/spectro/icoms.c b/spectro/icoms.c index 875f3b6..08ddd92 100755 --- a/spectro/icoms.c +++ b/spectro/icoms.c @@ -760,8 +760,12 @@ int frbw /* nz to Flush Read Before Write */ int debug = p->log->debug; int bread; + p->ser_clearerr(p); + if (debug < 8) p->log->debug = 0; + /* (Could use tcflush() or ioctl(TCFLSH) on *nix, */ + /* except these don't work on USB serial ports!) */ for (;;) { bread = 0; p->read(p, tbuf, 500, &bread, NULL, 500, 0.02); @@ -813,6 +817,11 @@ double tout /* Timeout for write and then read (i.e. max = 2 x tout) */ return icoms_write_read_ex(p, wbuf, nwch, rbuf, bsize, bread, tc, ntc, tout, 0); } +/* Default NOP implementation - Serial open or set_methods may override */ +static void icoms_ser_clearerr(icoms *p) { + return; +} + /* Optional callback to client from device */ /* Default implementation is a NOOP */ static int icoms_interrupt(icoms *p, @@ -907,6 +916,7 @@ icoms *new_icoms( p->read = NULL; p->write_read = icoms_write_read; p->write_read_ex = icoms_write_read_ex; + p->ser_clearerr = icoms_ser_clearerr; /* Default NOP implementation */ p->interrupt = icoms_interrupt; p->del = icoms_del; -- cgit v1.2.3