From 9fe130cbee481a60d93b3d48771046eecead1821 Mon Sep 17 00:00:00 2001 From: nishi Date: Sat, 15 Jun 2024 02:23:02 +0000 Subject: [PATCH] fixed remote client git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@314 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- RemoteClient/hayes.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/RemoteClient/hayes.c b/RemoteClient/hayes.c index 6e873f2..5a4d4c2 100644 --- a/RemoteClient/hayes.c +++ b/RemoteClient/hayes.c @@ -150,7 +150,7 @@ int rcli_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") || __dw_strcaseequ(resp, "NO CARRIER"); + bool echo = __dw_strcaseequ(resp, "AT&FE0F1"); if(resp != NULL && echo) free(resp); /* Kill echo */ if(resp == NULL) return 1; if(echo) resp = modem_response(); @@ -162,7 +162,13 @@ int rcli_init(void) { write_serial(dial); write_serial("\r"); while(true) { + free(resp); resp = modem_response(); + if(__dw_strcaseequ(resp, "NO CARRIER")) { + connected = false; + free(resp); + return 1; + } int i; for(i = 0; resp[i] != 0; i++) { if(resp[i] == ' ') { @@ -173,6 +179,7 @@ int rcli_init(void) { if(__dw_strcaseequ(resp, "CONNECT")) { printf("Connected\n"); connected = true; + free(resp); break; } } -- 2.43.0