]> Nishi Git Mirror - dataworks.git/commitdiff
work
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 5 Jun 2024 14:20:04 +0000 (14:20 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 5 Jun 2024 14:20:04 +0000 (14:20 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@163 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Server/hayes.c

index a70c4a27837b624c9747af99039f3ce1a479ed4b..4dcfb5f2abb4b60caa982355036599bf6cd970f2 100644 (file)
@@ -47,6 +47,7 @@ extern char** argv;
 void protocol_init(int sock);
 void protocol_loop(int sock);
 void disconnect(int sock);
+void writeline(int sock, const char* str);
 
 bool option(const char* str, const char* shortopt, const char* longopt);
 
@@ -107,6 +108,7 @@ char* modem_response(void) {
                if(signals > 0){
                        free(buf);
                        if(connected){
+                               writeline(0, "QUIT:Bye");
                                disconnect(0);
                        }
                        return NULL;
@@ -153,7 +155,7 @@ int server_init(void) {
        _bios_serialcom(_COM_INIT, port, _COM_9600 | _COM_NOPARITY | _COM_CHR8 | _COM_STOP1);
        write_serial("AT&FE0F1\r");
        char* resp = modem_response();
-       bool echo = __dw_strcaseequ(resp, "AT&FE0F1");
+       bool echo = __dw_strcaseequ(resp, "AT&FE0F1") || __dw_strcaseequ(resp, "NO CARRIER");
        if(resp != NULL && echo) free(resp); /* Kill echo */
        if(resp == NULL) return 0;
        if(echo) resp = modem_response();