From 60de5751b47f015d3a28bcb91354f3a966f64f9e Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 19 Nov 2024 22:51:35 -0600 Subject: port-probe: add some QCDM/DIAG response bytes to non-AT responses Seen on a Qualcomm-based Quectel EG915Q on the diag port: ModemManager[34547]: [1732077670.330527] [ttyUSB0/at] <-- ' \0\0\0\8\0\0\0\2\0\0\0\0`%\160$"\6\169\128\200\1\30\197\142\0G\184\225\128\0\1+\127\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254\255\255\255\255\255\255\255\254' Signed-off-by: Dan Williams --- src/mm-port-probe.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c index 91f101e2..27f4b6e4 100644 --- a/src/mm-port-probe.c +++ b/src/mm-port-probe.c @@ -895,6 +895,13 @@ static const guint8 zerobuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static const guint8 quectel_qcdm[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, +}; + static gboolean is_non_at_response (const guint8 *data, gsize len) { @@ -910,6 +917,12 @@ is_non_at_response (const guint8 *data, gsize len) return TRUE; } + /* Observed on a Quectel EG915Q Qualcomm-based device's DIAG port */ + for (i = 0; (len >= sizeof (quectel_qcdm)) && (i < len - sizeof (quectel_qcdm)); i++) { + if (!memcmp (&data[i], quectel_qcdm, sizeof (quectel_qcdm))) + 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 * loaded, Sierra CnS ports) that just shouldn't be probed for AT capability -- cgit v1.2.3-70-g09d2