From: Julien Tournier <[email protected]>

Hi Denis,

Here is the fixed patch for the +CMT notification parsing on some cinterion
modems that have a leading coma. I hope i took all your remarks into account


 drivers/atmodem/sms.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

-- 
2.18.0

>From 937a78ccdac4975e1a292a8e9259060d2d94adc2 Mon Sep 17 00:00:00 2001
From: Julien Tournier <[email protected]>
Date: Wed, 29 Aug 2018 15:55:58 +0200
Subject: [PATCH 1/1] atmodem: Handle broken +CMT notifications of some 
cinterion modems
---
 drivers/atmodem/sms.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index 68b89862..9c920667 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -412,9 +412,24 @@ static void at_cmt_notify(GAtResult *result, gpointer 
user_data)
 
        switch (data->vendor) {
        case OFONO_VENDOR_CINTERION:
-               if (!g_at_result_iter_next_number(&iter, &tpdu_len))
-                       goto err;
-               break;
+               if (!g_at_result_iter_next_number(&iter, &tpdu_len)) {
+                       /*
+                        * On some cinterions modems (ALS3,PLS8...), we can't 
directly
+                        * get the PDU length, we need to skip the leading coma
+                        *  \r\n+CMT: ,23\r\nCAFECAFECAFE... ...\r\n
+                        *             ^------- PDU length
+                        */
+                       DBG("Retrying to find the PDU length");
+
+                       if (!g_at_result_iter_skip_next(&iter))
+                               goto err;
+
+                       /* Next attempt at finding the PDU length. */
+                       if (!g_at_result_iter_next_number(&iter, &tpdu_len))
+                               goto err;
+               }
+
+               break;
        default:
                if (!g_at_result_iter_skip_next(&iter))
                        goto err;
-- 
2.18.0

_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to