From eec4167ab960b5e1989a4845844c05c79981c71b Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Debian Linux)" <rob@synchro.net> Date: Mon, 16 Oct 2023 17:51:33 -0700 Subject: [PATCH] Implement write-retry in modem_send() In attempt to address the "Error 11" (EAGAIN) error theat Nelgin sees when configuring some longer modem init strings on Linux. This is just a single retry (after a yield) after any modem command char send failure (for any reason), including the terminating carriage-return. See issue #662 to details. --- src/sexpots/sexpots.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sexpots/sexpots.c b/src/sexpots/sexpots.c index d22a37d589..e9af3a0244 100644 --- a/src/sexpots/sexpots.c +++ b/src/sexpots/sexpots.c @@ -613,12 +613,19 @@ BOOL modem_send(COM_HANDLE com_handle, const char* str) if(ch!='^' && ch>='@') /* ^^ to send an '^' char to the modem */ ch-='@'; } - if(!comWriteByte(com_handle,ch)) - return FALSE; + if(!comWriteByte(com_handle,ch)) { + YIELD(); + if(!comWriteByte(com_handle,ch)) + return FALSE; + } } SLEEP(100); comPurgeInput(com_handle); - return comWriteByte(com_handle, '\r'); + if(!comWriteByte(com_handle, '\r')) { + YIELD(); + return comWriteByte(com_handle, '\r'); + } + return TRUE; } /****************************************************************************/ -- GitLab