From 6c370dd36d13c3d913d3801876407b3c9ff71ae9 Mon Sep 17 00:00:00 2001 From: Stephane Fillod Date: Mon, 6 May 2013 23:47:56 +0200 Subject: [PATCH] serial: fix blocking call on ports, esp. on win32 Summary from Lada: On Win7, good testing command is: C:\hamlib> rigctl -vvvvv -m 214 -r COM1 -s 4800 -C data_bits=8 -C stop_bits=2 -C serial_handshake=Hardware -C timeout=1000 Behavior of this command differs on COM port. On hardware ports (onboard, PCI NetMos, all probably 16550-compatible) rigctl freeze in data write. It is correct, no hardware handshake is estabilished. On FT232 USB port initialization failed by timeout. I think it is not correct but this is not subject of this e-mail. Looked into hamlib source and found, that timeout argument is no longer handled. SetCommTimeouts takes timeout from c_cc[VTIME] which is not filled. Signed-off-by: Ladislav Vaiz --- src/serial.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/serial.c b/src/serial.c index 96d0c2af3..13d691563 100644 --- a/src/serial.c +++ b/src/serial.c @@ -1,6 +1,6 @@ /* * Hamlib Interface - serial communication low-level support - * Copyright (c) 2000-2010 by Stephane Fillod + * Copyright (c) 2000-2013 by Stephane Fillod * Copyright (c) 2000-2003 by Frank Singleton * Parts of the PTT handling are derived from soundmodem, an excellent * ham packet softmodem written by Thomas Sailer, HB9JNX. @@ -346,6 +346,11 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp) sg.sg_flags = RAW; #endif + /* + * VTIME in deciseconds, rp->timeout in miliseconds + */ + options.c_cc[VTIME] = rp->timeout / 100; + options.c_cc[VMIN] = 1; /* * Flush serial port