From 89b7dfda2f8d09001e0c9ad37ad139d2e69fcf00 Mon Sep 17 00:00:00 2001 From: ArenM Date: Mon, 4 Oct 2021 23:26:16 -0400 Subject: [PATCH 1/2] at: remove call to g_strstrip before sending commando This log statement called g_strstrip before sending the command, which caused it to fail because it doesn't send the newline required to run it. --- src/at.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/at.c b/src/at.c index b50ceea..a252923 100644 --- a/src/at.c +++ b/src/at.c @@ -83,8 +83,6 @@ gboolean at_send_command(struct EG25Manager *manager) manager->at_callback = at_cmd->callback; - g_message("Sending command: %s", g_strstrip(command)); - do { ret = write(manager->at_fd, &command[pos], len); From aec8135ad4c30c56e2afdf2426d9a6bbb806a5b1 Mon Sep 17 00:00:00 2001 From: ArenM Date: Sun, 3 Oct 2021 19:58:25 -0400 Subject: [PATCH 2/2] at: escape non text characters in modem response logs --- src/at.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/at.c b/src/at.c index a252923..b8bb3e8 100644 --- a/src/at.c +++ b/src/at.c @@ -241,12 +241,15 @@ static gboolean modem_response(gint fd, } while (ret > 0 && pos < (sizeof(response) - 1)); if (pos > 0) { + g_autofree gchar *escaped = NULL; + response[pos] = 0; g_strstrip(response); if (strlen(response) == 0) return TRUE; - g_message("Response: [%s]", response); + escaped = g_strescape(response, "\""); + g_message("Response: [%s]", escaped); /* * When the modem is started, it outputs 'RDY' to indicate that