From 36115d03d5b7fd623c40b16a9b5713d12d44e461 Mon Sep 17 00:00:00 2001 From: nishi Date: Wed, 5 Jun 2024 14:20:04 +0000 Subject: [PATCH] work git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@163 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- Server/hayes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Server/hayes.c b/Server/hayes.c index a70c4a2..4dcfb5f 100644 --- a/Server/hayes.c +++ b/Server/hayes.c @@ -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(); -- 2.43.0