From ba5767520fc1a22bfb6cddbd465f50b893df7ffd Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 18 Apr 2013 12:46:57 -0700 Subject: [PATCH] Added better support for virtual null modem cables on Modem Control multiplexer lines. If the multiplexer is a modem control one, this change caused connections to be established ONLY if DTR is presented by the simulated system and to always be dropped when DTR is not asserted. --- sim_tmxr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sim_tmxr.c b/sim_tmxr.c index cffb2451..a6b235a6 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -955,7 +955,8 @@ lp->ipad = NULL; if ((lp->destination) && (!lp->serport)) { if (lp->connecting) sim_close_sock (lp->connecting, 0); - lp->connecting = sim_connect_sock (lp->destination, "localhost", NULL); + if ((!lp->mp->modem_control) || (lp->modembits & TMXR_MDM_DTR)) + lp->connecting = sim_connect_sock (lp->destination, "localhost", NULL); } tmxr_init_line (lp); /* initialize line state */ /* Revise the unit's connect string to reflect the current attachments */ @@ -1094,10 +1095,16 @@ if (lp->mp && lp->mp->modem_control) { /* This API ONLY works on mo if (bits_to_set | bits_to_clear) { /* Anything to do? */ if (lp->serport) return sim_control_serial (lp->serport, bits_to_set, bits_to_clear, incoming_bits); - if (lp->sock) { + if ((lp->sock) || (lp->connecting)) { if (bits_to_clear&TMXR_MDM_DTR) /* drop DTR? */ tmxr_reset_ln (lp); } + else { + if ((lp->destination) && /* Virtual Null Modem Cable */ + ((bits_to_set ^ before_modem_bits) & /* and DTR being Raised */ + TMXR_MDM_DTR)) + lp->connecting = sim_connect_sock (lp->destination, "localhost", NULL); + } } return SCPE_OK; }