From 9693cce0b37f6294b1aeba8e0e3ff5aab04baf58 Mon Sep 17 00:00:00 2001 From: Jaroslav Skarvada Date: Sat, 9 Sep 2017 05:50:23 -0400 Subject: [PATCH] Fix serial_port DCD squelch Hi, I had trouble with CTS serial port squelch (on microHAM USB Interface III). It seems there is a bug in the hamlib code and I think the similar thing should be done as has been done for the pttport, i.e. if the dcdport is the same as the rigport, do not reopen it. Otherwise the serial port will be reset to its default and it will key the radio PTT forever (because the RTS line is reset on the port reopen). Patch attached 73! Jaroslav, OK2JRQ --- src/rig.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/rig.c b/src/rig.c index 701e3a412..2afcb377e 100644 --- a/src/rig.c +++ b/src/rig.c @@ -691,7 +691,12 @@ int HAMLIB_API rig_open(RIG *rig) strcpy(rs->dcdport.pathname, rs->rigport.pathname); } - rs->dcdport.fd = ser_open(&rs->dcdport); + if (strcmp(rs->dcdport.pathname, rs->rigport.pathname) == 0) { + rs->dcdport.fd = rs->rigport.fd; + } + else { + rs->dcdport.fd = ser_open(&rs->dcdport); + } if (rs->dcdport.fd < 0) { rig_debug(RIG_DEBUG_ERR, @@ -878,7 +883,9 @@ int HAMLIB_API rig_close(RIG *rig) case RIG_DCD_SERIAL_DSR: case RIG_DCD_SERIAL_CTS: case RIG_DCD_SERIAL_CAR: - port_close(&rs->dcdport, RIG_PORT_SERIAL); + if (rs->dcdport.fd != rs->rigport.fd) { + port_close(&rs->dcdport, RIG_PORT_SERIAL); + } break; case RIG_DCD_PARALLEL: