Add quirk for Qualcomm issues with setting CBS topic ranges
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 10 Jun 2010 01:40:59 +0000 (18:40 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 10 Jun 2010 01:40:59 +0000 (18:40 -0700)
drivers/atmodem/cbs.c

index eb46d30..a1c4037 100644 (file)
@@ -38,6 +38,7 @@
 #include "gatresult.h"
 
 #include "atmodem.h"
+#include "vendor.h"
 
 static const char *none_prefix[] = { NULL };
 static const char *cscb_prefix[] = { "+CSCB:", NULL };
@@ -45,6 +46,7 @@ static const char *cscb_prefix[] = { "+CSCB:", NULL };
 struct cbs_data {
        GAtChat *chat;
        gboolean cscb_mode_1;
+       unsigned int vendor;
 };
 
 static void at_cbm_notify(GAtResult *result, gpointer user_data)
@@ -113,6 +115,17 @@ static void at_cbs_set_topics(struct ofono_cbs *cbs, const char *topics,
        if (!cbd)
                goto error;
 
+       /* For the Qualcomm based devices it is required to clear
+        * the list of topics first.  Otherwise setting the new
+        * topic ranges will fail.
+        *
+        * In addition only AT+CSCB=1 seems to work.  Providing
+        * a topic range for clearing makes AT+CSBC=0,... fail.
+        */
+       if (data->vendor == OFONO_VENDOR_QUALCOMM_MSM)
+               g_at_chat_send(data->chat, "AT+CSCB=1", none_prefix,
+                               NULL, NULL, NULL);
+
        buf = g_strdup_printf("AT+CSCB=0,\"%s\"", topics);
 
        id = g_at_chat_send(data->chat, buf, none_prefix,
@@ -225,6 +238,7 @@ static int at_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
 
        data = g_new0(struct cbs_data, 1);
        data->chat = chat;
+       data->vendor = vendor;
 
        ofono_cbs_set_data(cbs, data);