diff options
author | Aki Niemi <aki.niemi@nokia.com> | 2010-01-12 10:57:43 +0200 |
---|---|---|
committer | Aki Niemi <aki.niemi@nokia.com> | 2010-01-14 10:32:57 +0200 |
commit | e1548d27304ca5f7c5645752c4232cae7c15f1bf (patch) | |
tree | 77c5d54932f802a27481e269df3bc0ebc055bcd0 /drivers | |
parent | 85df7a952a7d78a5cd07c869999f3312f786d93c (diff) | |
download | ofono-e1548d27304ca5f7c5645752c4232cae7c15f1bf.tar.bz2 |
Refactor CBS driver
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isimodem/cbs.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/isimodem/cbs.c b/drivers/isimodem/cbs.c index 60cb7a75..705fe7a0 100644 --- a/drivers/isimodem/cbs.c +++ b/drivers/isimodem/cbs.c @@ -79,27 +79,30 @@ static bool routing_resp_cb(GIsiClient *client, const void *restrict data, { const unsigned char *msg = data; struct ofono_cbs *cbs = opaque; - - DBG(""); + const char *debug = NULL; if (!msg) { DBG("ISI client error: %d", g_isi_client_error(client)); - goto error; + return true; } if (len < 3 || msg[0] != SMS_GSM_CB_ROUTING_RESP) - goto error; + return false; if (msg[1] != SMS_OK) { - DBG("Request failed: 0x%02X", msg[1]); - goto error; + DBG("Request failed: 0x%02X (%s).\n\n Unable to bootstrap CBS" + " routing.\n It appears some other component is" + " already\n registered as the CBS routing endpoint.\n " + " As a consequence, receiving CBSs is NOT going" + " to work.\n\n", msg[1], sms_isi_cause_name(msg[1])); + return true; } - ofono_cbs_register(cbs); - return true; + debug = getenv("OFONO_ISI_DEBUG"); + if (debug && (strcmp(debug, "all") == 0 || strcmp(debug, "cbs") == 0)) + g_isi_client_set_debug(client, sms_debug, NULL); -error: - DBG("Unable to bootstrap CB routing."); + ofono_cbs_register(cbs); return true; } @@ -131,13 +134,12 @@ static int isi_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor, ofono_cbs_set_data(cbs, cd); - g_isi_client_set_debug(cd->client, sms_debug, NULL); - g_isi_subscribe(cd->client, SMS_GSM_CB_ROUTING_NTF, routing_ntf_cb, cbs); - if (!g_isi_request_make(cd->client, msg, sizeof(msg), CBS_TIMEOUT, routing_resp_cb, cbs)) DBG("Failed to set CBS routing."); + g_isi_subscribe(cd->client, SMS_GSM_CB_ROUTING_NTF, routing_ntf_cb, cbs); + return 0; } |