TMXR: Add EXPECT/SEND support for BUFFERED lines

- Provide consistent behavior for connected OR BUFFERED lines
   BUFFERED lines can be used with MUX EXPECT/SEND scripting
   without an active connection.
- Fix SHOW MUX to display useful info for BUFFERED lines.
This commit is contained in:
Mark Pizzolato 2018-06-19 16:13:22 -07:00
parent ffb6d4b269
commit b5537796ea

View file

@ -728,8 +728,10 @@ else {
} }
} }
else { else {
if (lp->conn == TMXR_LINE_DISABLED) { if ((lp->conn == TMXR_LINE_DISABLED) ||
((lp->conn == 0) && lp->txbfd)){
written = length; /* Count here output timing is correct */ written = length; /* Count here output timing is correct */
if (lp->conn == TMXR_LINE_DISABLED)
lp->txdrp += length; /* Record as having been dropped on the floor */ lp->txdrp += length; /* Record as having been dropped on the floor */
} }
} }
@ -2262,7 +2264,7 @@ TMLN *lp;
tmxr_debug_trace (mp, "tmxr_poll_tx()"); tmxr_debug_trace (mp, "tmxr_poll_tx()");
for (i = 0; i < mp->lines; i++) { /* loop thru lines */ for (i = 0; i < mp->lines; i++) { /* loop thru lines */
lp = mp->ldsc + i; /* get line desc */ lp = mp->ldsc + i; /* get line desc */
if (!lp->conn) /* skip if !conn */ if ((!lp->conn) && (!lp->txbfd)) /* skip if !conn and !buffered */
continue; continue;
nbytes = tmxr_send_buffered_data (lp); /* buffered bytes */ nbytes = tmxr_send_buffered_data (lp); /* buffered bytes */
if (nbytes == 0) { /* buf empty? enab line */ if (nbytes == 0) { /* buf empty? enab line */
@ -3992,7 +3994,7 @@ else {
fprintf (st, "\n"); fprintf (st, "\n");
} }
if ((!lp->sock) && (!lp->connecting) && (!lp->serport) && (!lp->master)) { if ((!lp->sock) && (!lp->connecting) && (!lp->serport) && (!lp->master)) {
if (lp->modem_control) if ((lp->modem_control) || (lp->txbfd))
tmxr_fconns (st, lp, -1); tmxr_fconns (st, lp, -1);
continue; continue;
} }
@ -4134,7 +4136,7 @@ for (i=0; i<mp->lines; i++) {
} }
sooner = MIN(sooner, due); sooner = MIN(sooner, due);
} }
if ((lp->conn) && /* Connected? */ if ((lp->conn || lp->txbfd) && /* Connected (or buffered)? */
(uptr == lp->o_uptr) && /* output completion unit? */ (uptr == lp->o_uptr) && /* output completion unit? */
(lp->txbps)) { /* while rate limiting */ (lp->txbps)) { /* while rate limiting */
if ((tmxr_tqln(lp)) && /* pending output data? */ if ((tmxr_tqln(lp)) && /* pending output data? */
@ -4647,7 +4649,7 @@ if (lp->cnms) {
fprintf (st, " %s %02d:%02d:%02d\n", lp->connecting ? "Connecting for" : "Connected", hr, mn, sc); fprintf (st, " %s %02d:%02d:%02d\n", lp->connecting ? "Connecting for" : "Connected", hr, mn, sc);
} }
else else
fprintf (st, " Line disconnected\n"); fprintf (st, " Line disconnected%s\n", lp->txbfd ? " (buffered)" : "");
if (lp->modem_control) { if (lp->modem_control) {
fprintf (st, " Modem Bits: %s%s%s%s%s%s\n", (lp->modembits & TMXR_MDM_DTR) ? "DTR " : "", fprintf (st, " Modem Bits: %s%s%s%s%s%s\n", (lp->modembits & TMXR_MDM_DTR) ? "DTR " : "",