serial: skip NUL bytes coming before real AT responses
Some Cinterion modems send a NUL byte before the "CONNECTED" reply to "ATD" (only during the first ATD try anyway). This fix will ignore any NUL byte leading the real response.
This commit is contained in:
@@ -265,7 +265,11 @@ mm_serial_parser_v1_parse (gpointer data,
|
||||
g_return_val_if_fail (parser != NULL, FALSE);
|
||||
g_return_val_if_fail (response != NULL, FALSE);
|
||||
|
||||
if (G_UNLIKELY (!response->len || !strlen (response->str)))
|
||||
/* Skip NUL bytes if they are found leading the response */
|
||||
while (response->len > 0 && response->str[0] == '\0')
|
||||
g_string_erase (response, 0, 1);
|
||||
|
||||
if (G_UNLIKELY (!response->len))
|
||||
return FALSE;
|
||||
|
||||
/* First, check for successful responses */
|
||||
|
Reference in New Issue
Block a user