From a774d9ed4932f4a6a2bbdf590d3f83e490cf12d9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 9 Jun 2010 18:40:59 -0700 Subject: [PATCH] Add quirk for Qualcomm issues with setting CBS topic ranges --- drivers/atmodem/cbs.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/atmodem/cbs.c b/drivers/atmodem/cbs.c index eb46d30d..a1c40377 100644 --- a/drivers/atmodem/cbs.c +++ b/drivers/atmodem/cbs.c @@ -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);