port-probe: don't assume the NULL bytes will be at the beginning of the response
Also report as non-AT responses if the NUL bytes are embedded within a stream of bytes which doesn't start with NUL. This e.g. applies to CnS ports from Sierra modems, which show streams like: ~\0\245y\0}^T1_0_4_0BT R372 CNSZXD00000061 2011/05/12 15:25:25\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0T1_0_4_0AP R372 CNSZXD00000061 2011/05 /12 15:25:25\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 03\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0~~ \0Tb\0T1_0_4_0AP R372 CNSZXD
This commit is contained in:
+6
-5
@@ -597,15 +597,16 @@ static gboolean
|
||||
is_non_at_response (const guint8 *data, gsize len)
|
||||
{
|
||||
const gchar **iter;
|
||||
size_t iter_len;
|
||||
int i;
|
||||
gsize iter_len;
|
||||
gsize i;
|
||||
|
||||
/* Some devices (observed on a ZTE branded "QUALCOMM INCORPORATED" model
|
||||
* "154") spew NULLs from some ports.
|
||||
*/
|
||||
if ( (len >= sizeof (zerobuf))
|
||||
&& (memcmp (data, zerobuf, sizeof (zerobuf)) == 0))
|
||||
return TRUE;
|
||||
for (i = 0; (len >= sizeof (zerobuf)) && (i < len - sizeof (zerobuf)); i++) {
|
||||
if (!memcmp (&data[i], zerobuf, sizeof (zerobuf)))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Check for a well-known non-AT response. There are some ports (eg many
|
||||
* Icera-based chipsets, Qualcomm Gobi devices before their firmware is
|
||||
|
||||
Reference in New Issue
Block a user