From ee5f1e62e4ddba77a05d6d625f208e1e8da578cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Tue, 15 Nov 2022 17:44:11 -0500 Subject: [PATCH] Add new 3-wire (No RTS) connection type This is for weird embedded systems where RTS is not supported by the communications channel, but is actually controlling something else (TX, Bootloader update mode, etc). --- src/syncterm/bbslist.c | 10 +++++++--- src/syncterm/conn.c | 5 +++-- src/syncterm/conn.h | 1 + src/syncterm/menu.c | 2 +- src/syncterm/modem.c | 5 ++++- src/syncterm/term.c | 8 ++++---- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/syncterm/bbslist.c b/src/syncterm/bbslist.c index ba6c5683ff..b4fad61454 100644 --- a/src/syncterm/bbslist.c +++ b/src/syncterm/bbslist.c @@ -248,6 +248,7 @@ static char *conn_type_help= "`Connection Type`\n\n" "`SSH`..............: Connect using the Secure Shell (SSH-2) protocol\n" "`Modem`............: Connect using a dial-up modem\n" "`Serial`...........: Connect directly to a serial communications port\n" + "`3-wire (no RTS)`..: As with Serial, but lower RTS\n" "`Shell`............: Connect to a local PTY (*nix only)\n" "`MBBS GHost`.......: Communicate using the Major BBS 'GHost' protocol\n"; ; @@ -980,7 +981,7 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd sprintf(opt[i++], "Name %s",itemname); if(item->conn_type==CONN_TYPE_MODEM) sprintf(opt[i++], "Phone Number %s",item->addr); - else if(item->conn_type==CONN_TYPE_SERIAL) + else if (item->conn_type == CONN_TYPE_SERIAL || item->conn_type == CONN_TYPE_SERIAL_NORTS) sprintf(opt[i++], "Device Name %s",item->addr); else if(item->conn_type==CONN_TYPE_SHELL) sprintf(opt[i++], "Command %s",item->addr); @@ -1166,6 +1167,7 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd uifc.input(WIN_MID|WIN_SAV,0,0 ,item->conn_type==CONN_TYPE_MODEM ? "Phone Number" :item->conn_type==CONN_TYPE_SERIAL ? "Device Name" + :item->conn_type==CONN_TYPE_SERIAL_NORTS ? "Device Name" :item->conn_type==CONN_TYPE_SHELL ? "Command" : "Address" ,item->addr,LIST_ADDR_MAX,K_EDIT); @@ -1173,7 +1175,7 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd iniSetString(&inifile,itemname,"Address",item->addr,&ini_style); break; case 3: - if (item->conn_type == CONN_TYPE_MODEM || item->conn_type == CONN_TYPE_SERIAL) { + if (item->conn_type == CONN_TYPE_MODEM || item->conn_type == CONN_TYPE_SERIAL || item->conn_type == CONN_TYPE_SERIAL_NORTS) { uifc.helpbuf = "`Flow Control`\n\n" "Select the desired flow control type.\n" "This should usually be left as \"RTS/CTS\".\n"; @@ -1281,7 +1283,7 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd item->user[0] = 0; } - if(item->conn_type!=CONN_TYPE_MODEM && item->conn_type!=CONN_TYPE_SERIAL + if(item->conn_type!=CONN_TYPE_MODEM && item->conn_type!=CONN_TYPE_SERIAL && item->conn_type != CONN_TYPE_SERIAL_NORTS && item->conn_type!=CONN_TYPE_SHELL ) { /* Set the port too */ @@ -2413,6 +2415,7 @@ struct bbslist *show_bbslist(char *current, int connected) list[listcount-1]->conn_type++; if(list[listcount-1]->conn_type!=CONN_TYPE_MODEM && list[listcount-1]->conn_type!=CONN_TYPE_SERIAL + && list[listcount-1]->conn_type!=CONN_TYPE_SERIAL_NORTS && list[listcount-1]->conn_type!=CONN_TYPE_SHELL ) { /* Set the port too */ @@ -2434,6 +2437,7 @@ struct bbslist *show_bbslist(char *current, int connected) uifc.input(WIN_MID|WIN_SAV,0,0 ,list[listcount-1]->conn_type==CONN_TYPE_MODEM ? "Phone Number" :list[listcount-1]->conn_type==CONN_TYPE_SERIAL ? "Device Name" + :list[listcount-1]->conn_type==CONN_TYPE_SERIAL_NORTS ? "Device Name" :list[listcount-1]->conn_type==CONN_TYPE_SHELL ? "Command" :"Address" ,list[listcount-1]->addr,LIST_ADDR_MAX,K_EDIT); diff --git a/src/syncterm/conn.c b/src/syncterm/conn.c index 169ed8541f..4aa890a1bf 100644 --- a/src/syncterm/conn.c +++ b/src/syncterm/conn.c @@ -47,8 +47,8 @@ #include "conn_telnet.h" struct conn_api conn_api; -char *conn_types_enum[]={"Unknown","RLogin","RLoginReversed","Telnet","Raw","SSH","SSHNA","Modem","Serial","Shell","MBBSGhost","TelnetS", NULL}; -char *conn_types[]={"Unknown","RLogin","RLogin Reversed","Telnet","Raw","SSH","SSH (no auth)","Modem","Serial","Shell","MBBS GHost","TelnetS",NULL}; +char *conn_types_enum[]={"Unknown","RLogin","RLoginReversed","Telnet","Raw","SSH","SSHNA","Modem","Serial","NoRTS","Shell","MBBSGhost","TelnetS", NULL}; +char *conn_types[]={"Unknown","RLogin","RLogin Reversed","Telnet","Raw","SSH","SSH (no auth)","Modem","Serial","3-wire (No RTS)","Shell","MBBS GHost","TelnetS",NULL}; short unsigned int conn_ports[]={0,513,513,23,0,22,22,0,0,0,65535,992,0}; struct conn_buffer conn_inbuf; @@ -377,6 +377,7 @@ int conn_connect(struct bbslist *bbs) #endif #ifndef __HAIKU__ case CONN_TYPE_SERIAL: + case CONN_TYPE_SERIAL_NORTS: conn_api.connect=modem_connect; conn_api.close=serial_close; break; diff --git a/src/syncterm/conn.h b/src/syncterm/conn.h index 2178e3708f..12a5be3cca 100644 --- a/src/syncterm/conn.h +++ b/src/syncterm/conn.h @@ -24,6 +24,7 @@ enum { ,CONN_TYPE_SSHNA ,CONN_TYPE_MODEM ,CONN_TYPE_SERIAL + ,CONN_TYPE_SERIAL_NORTS ,CONN_TYPE_SHELL ,CONN_TYPE_MBBS_GHOST ,CONN_TYPE_TELNETS diff --git a/src/syncterm/menu.c b/src/syncterm/menu.c index 50d9f5e682..5a3942bf6e 100644 --- a/src/syncterm/menu.c +++ b/src/syncterm/menu.c @@ -224,7 +224,7 @@ int syncmenu(struct bbslist *bbs, int *speed) } break; case 5: /* Output rate */ - if(bbs->conn_type==CONN_TYPE_MODEM || bbs->conn_type==CONN_TYPE_SERIAL) { + if(bbs->conn_type==CONN_TYPE_MODEM || bbs->conn_type==CONN_TYPE_SERIAL || bbs->conn_type == CONN_TYPE_SERIAL_NORTS) { uifcmsg("Not supported for this connection type" ,"Cannot change the display rate for Modem/Serial connections."); } diff --git a/src/syncterm/modem.c b/src/syncterm/modem.c index 5f8cf66261..617b2ac5ff 100644 --- a/src/syncterm/modem.c +++ b/src/syncterm/modem.c @@ -142,7 +142,7 @@ int modem_connect(struct bbslist *bbs) if (!bbs->hidepopups) init_uifc(TRUE, TRUE); - if(bbs->conn_type == CONN_TYPE_SERIAL) { + if(bbs->conn_type == CONN_TYPE_SERIAL || bbs->conn_type == CONN_TYPE_SERIAL_NORTS) { if((com=comOpen(bbs->addr)) == COM_HANDLE_INVALID) { if (!bbs->hidepopups) uifcmsg("Cannot Open Port", "`Cannot Open Port`\n\n" @@ -160,6 +160,9 @@ int modem_connect(struct bbslist *bbs) return(-1); } } + if (bbs->conn_type == CONN_TYPE_SERIAL_NORTS) { + comLowerRTS(com); + } if(!comRaiseDTR(com)) { if (!bbs->hidepopups) uifcmsg("Cannot Raise DTR", "`Cannot Raise DTR`\n\n" diff --git a/src/syncterm/term.c b/src/syncterm/term.c index 091012c397..c66110ec97 100644 --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -2505,7 +2505,7 @@ BOOL doterm(struct bbslist *bbs) int speedwatch = 0; gettextinfo(&txtinfo); - if(bbs->conn_type == CONN_TYPE_SERIAL) + if(bbs->conn_type == CONN_TYPE_SERIAL || bbs->conn_type == CONN_TYPE_SERIAL_NORTS) speed = 0; else speed = bbs->bpsrate; @@ -2549,7 +2549,7 @@ BOOL doterm(struct bbslist *bbs) hold_update=TRUE; sleep=TRUE; if(!term.nostatus) - update_status(bbs, (bbs->conn_type == CONN_TYPE_SERIAL)?bbs->bpsrate:speed, ooii_mode); + update_status(bbs, (bbs->conn_type == CONN_TYPE_SERIAL || bbs->conn_type == CONN_TYPE_SERIAL_NORTS)?bbs->bpsrate:speed, ooii_mode); for(remain=count_data_waiting() /* Hack for connection check */ + (!is_connected(NULL)); remain; remain--) { if(speed) thischar=xp_timer(); @@ -3001,7 +3001,7 @@ BOOL doterm(struct bbslist *bbs) key = 0; break; case 0x9800: /* ALT-Up */ - if(bbs->conn_type != CONN_TYPE_SERIAL) { + if(bbs->conn_type != CONN_TYPE_SERIAL && bbs->conn_type != CONN_TYPE_SERIAL_NORTS) { if(speed) speed=rates[get_rate_num(speed)+1]; else @@ -3010,7 +3010,7 @@ BOOL doterm(struct bbslist *bbs) } break; case 0xa000: /* ALT-Down */ - if(bbs->conn_type != CONN_TYPE_SERIAL) { + if(bbs->conn_type != CONN_TYPE_SERIAL && bbs->conn_type != CONN_TYPE_SERIAL_NORTS) { i=get_rate_num(speed); if(i==0) speed=0; -- GitLab