summaryrefslogtreecommitdiff
path: root/spectro/icoms.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-07-11 22:19:56 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-07-11 22:19:56 +0200
commita0442ed58dee48a521ea053083ea967894507898 (patch)
tree241f3920c6a80d0bad494d3969ea98aabfef4b7d /spectro/icoms.c
parentf6b8e0eae4374f339487a33e3e4fe5462d5816e1 (diff)
New upstream version 2.0.1+repackupstream/2.0.1+repackupstream
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;