From e3defcadd670c4a735b94fb1f08cbee7111e7d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Wed, 20 Nov 2024 20:18:29 -0500 Subject: [PATCH] Set flow control before raising DTR Possibly setting CTS/RTS after raising DTR drops DTR which causes DCD to be lost. --- src/syncterm/modem.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/syncterm/modem.c b/src/syncterm/modem.c index 1b9c88bab1..8ca6eec451 100644 --- a/src/syncterm/modem.c +++ b/src/syncterm/modem.c @@ -180,6 +180,14 @@ modem_connect(struct bbslist *bbs) comClose(com); return -1; } + if (!comSetFlowControl(com, bbs->flow_control)) { + conn_api.close(); + if (!bbs->hidepopups) { + uifcmsg("Failed to set Flow Control", "`Failed to set Flow Control`\n\n" + "SyncTERM was unable to set flow control.\n"); + } + return -1; + } if (bbs->conn_type == CONN_TYPE_SERIAL_NORTS) comLowerRTS(com); if (!comRaiseDTR(com)) { @@ -225,6 +233,15 @@ modem_connect(struct bbslist *bbs) comClose(com); return -1; } + if (!comSetFlowControl(com, bbs->flow_control)) { + conn_api.close(); + if (!bbs->hidepopups) { + uifcmsg("Failed to set Flow Control", "`Failed to set Flow Control`\n\n" + "SyncTERM was unable to set flow control.\n"); + } + return -1; + } + if (!comRaiseDTR(com)) { if (!bbs->hidepopups) uifcmsg("Cannot Raise DTR", "`Cannot Raise DTR`\n\n" @@ -320,15 +337,6 @@ modem_connect(struct bbslist *bbs) } } - if (!comSetFlowControl(com, bbs->flow_control)) { - conn_api.close(); - if (!bbs->hidepopups) { - uifcmsg("Failed to set Flow Control", "`Failed to set Flow Control`\n\n" - "SyncTERM was unable to set flow control.\n"); - } - return -1; - } - if (!create_conn_buf(&conn_inbuf, BUFFER_SIZE)) { conn_api.close(); return -1; -- GitLab