diff options
author | Andres Salomon <dilinger@collabora.co.uk> | 2009-09-02 19:35:40 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-09-02 19:06:03 -0700 |
commit | aceaac4b7b06cc64bd872c095c5aa09a2a8b329d (patch) | |
tree | fbf1208d2e80af24856f276f9004aefcba36fab6 /drivers | |
parent | 3bb7fbd5d5779f267ce248504592e64f9da18629 (diff) | |
download | ofono-aceaac4b7b06cc64bd872c095c5aa09a2a8b329d.tar.bz2 |
G1: Add an SMS quirk for CNMI mode
The G1 doesn't support mode2, despite advertising it.
The G1 chokes w/ an "Error 303" when we specify NMI mode 2. Adding a
quirk to drop that mode from the supported list (just use mode 1) allows
the G1 to properly deal with SMS.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/atmodem/sms.c | 19 | ||||
-rw-r--r-- | drivers/atmodem/vendor.h | 1 |
2 files changed, 15 insertions, 5 deletions
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c index fc6c0528..fc53480b 100644 --- a/drivers/atmodem/sms.c +++ b/drivers/atmodem/sms.c @@ -35,6 +35,7 @@ #include <ofono/sms.h> #include "smsutil.h" #include "util.h" +#include "vendor.h" #include "gatchat.h" #include "gatresult.h" @@ -570,17 +571,25 @@ static inline gboolean append_cnmi_element(char *buf, int *len, int cap, } static gboolean build_cnmi_string(char *buf, int *cnmi_opts, - gboolean cnma_enabled) + struct sms_data *data) { + const char *mode; int len = sprintf(buf, "AT+CNMI="); - /* Mode doesn't matter, but sounds like 2 is the sanest option */ - if (!append_cnmi_element(buf, &len, cnmi_opts[0], "2310", FALSE)) + if (data->vendor == OFONO_VENDOR_HTC_G1) + /* The G1 advertises support for mode 2, but returns an error + * if we attempt to actually use it. */ + mode = "1"; + else + /* Sounds like 2 is the sanest mode */ + mode = "2310"; + + if (!append_cnmi_element(buf, &len, cnmi_opts[0], mode, FALSE)) return FALSE; /* Prefer to deliver SMS via +CMT if CNMA is supported */ if (!append_cnmi_element(buf, &len, cnmi_opts[1], - cnma_enabled ? "21" : "1", FALSE)) + data->cnma_enabled ? "21" : "1", FALSE)) return FALSE; /* Always deliver CB via +CBM, otherwise don't deliver at all */ @@ -666,7 +675,7 @@ static void at_cnmi_query_cb(gboolean ok, GAtResult *result, gpointer user_data) goto out; } - if (build_cnmi_string(buf, cnmi_opts, data->cnma_enabled)) + if (build_cnmi_string(buf, cnmi_opts, data)) supported = TRUE; if (data->cnma_enabled) diff --git a/drivers/atmodem/vendor.h b/drivers/atmodem/vendor.h index ebf771bd..9551a108 100644 --- a/drivers/atmodem/vendor.h +++ b/drivers/atmodem/vendor.h @@ -21,4 +21,5 @@ enum ofono_vendor { OFONO_VENDOR_GENERIC = 0, + OFONO_VENDOR_HTC_G1 = 1, }; |