summaryrefslogtreecommitdiff
path: root/spectro/icoms.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-07-11 22:20:14 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-07-11 22:20:14 +0200
commit7beb00cd8d28c3d5893ce3db907a828d64afdea9 (patch)
tree395a3dee2fe197b8284dee02c5f527889df78413 /spectro/icoms.c
parente2d30e0583c047a4bedf4c8d0c86320f1b3fd8ed (diff)
parenta0442ed58dee48a521ea053083ea967894507898 (diff)
Update upstream source from tag 'upstream/2.0.1+repack'
Update to upstream version '2.0.1+repack' with Debian dir 6edb5dd2df9aca152662fc4a8f72bd6d86f8552e
Diffstat (limited to 'spectro/icoms.c')
-rwxr-xr-xspectro/icoms.c10
1 files changed, 10 insertions, 0 deletions
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;