Skip to content
Snippets Groups Projects
Commit c6ab223f authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't call com_setup() unless an alternate [COM:x] section is loaded

Apparently com_setup() (which just calls tcsetattr()) will cause an attached modem (with a caller) to disconnect the caller. So you can't do this with a live modem. Leave the hack in for Nelgin's null modem cable setup, but you can't (apparently) support both 8N1 and 7E1 "callers" with a real modem (not surprisingly, for multiple reasons).
parent aa8b8943
No related branches found
No related tags found
No related merge requests found
...@@ -1392,8 +1392,10 @@ void parse_tcp_section(const char* section) ...@@ -1392,8 +1392,10 @@ void parse_tcp_section(const char* section)
telnet = iniGetBool(ini,section,"Telnet", telnet); telnet = iniGetBool(ini,section,"Telnet", telnet);
} }
void parse_com_section(const char* section) BOOL parse_com_section(const char* section)
{ {
if(!iniSectionExists(ini, section))
return FALSE;
iniGetExistingWord(ini, section, "Device", NULL, com_dev); iniGetExistingWord(ini, section, "Device", NULL, com_dev);
com_baudrate = iniGetLongInt(ini, section, "BaudRate", com_baudrate); com_baudrate = iniGetLongInt(ini, section, "BaudRate", com_baudrate);
com_parity = iniGetBool(ini, section, "Parity", com_parity); com_parity = iniGetBool(ini, section, "Parity", com_parity);
...@@ -1406,6 +1408,7 @@ void parse_com_section(const char* section) ...@@ -1406,6 +1408,7 @@ void parse_com_section(const char* section)
dcd_ignore = iniGetBool(ini, section, "IgnoreDCD", dcd_ignore); dcd_ignore = iniGetBool(ini, section, "IgnoreDCD", dcd_ignore);
dtr_delay = iniGetLongInt(ini, section, "DTRDelay", dtr_delay); dtr_delay = iniGetLongInt(ini, section, "DTRDelay", dtr_delay);
mdm_null = iniGetBool(ini, section, "NullModem", mdm_null); mdm_null = iniGetBool(ini, section, "NullModem", mdm_null);
return TRUE;
} }
void parse_ini_file(const char* ini_fname) void parse_ini_file(const char* ini_fname)
...@@ -1643,11 +1646,11 @@ service_loop(int argc, char** argv) ...@@ -1643,11 +1646,11 @@ service_loop(int argc, char** argv)
SAFEPRINTF(str, "TCP:%c", ch); SAFEPRINTF(str, "TCP:%c", ch);
parse_tcp_section(str); parse_tcp_section(str);
SAFEPRINTF(str, "COM:%c", ch); SAFEPRINTF(str, "COM:%c", ch);
parse_com_section(str); if(parse_com_section(str))
com_setup();
} }
} else } else
lprintf(LOG_NOTICE, "Timeout (%d seconds) waiting for response to prompt", prompt_timeout); lprintf(LOG_NOTICE, "Timeout (%d seconds) waiting for response to prompt", prompt_timeout);
com_setup();
} }
if((sock=connect_socket(host, port)) == INVALID_SOCKET) { if((sock=connect_socket(host, port)) == INVALID_SOCKET) {
comWriteString(com_handle,"\7\r\n!ERROR connecting to TCP port\r\n"); comWriteString(com_handle,"\7\r\n!ERROR connecting to TCP port\r\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment