Skip to contentSkip to conversation

droid 4: special handling for SMSes

PATCH Applied Pavel Machek 2 participants 3 messages Sep 15, 2020 – Sep 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 droid 4: special handling for SMSes

Droid 4 modem is "special" (aka broken) so and getting incoming SMSes
to work is quite tricky. This should get it right.

---
 drivers/atmodem/sms.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/atmodem/sms.c +12 -3
index d502da72..f08f2fb1 100644
@@ -463,7 +463,8 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data)
 	decode_hex_own_buf(hexpdu, -1, &pdu_len, 0, pdu);
 	ofono_sms_deliver_notify(sms, pdu, pdu_len, tpdu_len);
 
-	if (data->vendor != OFONO_VENDOR_SIMCOM)
+	if ((data->vendor != OFONO_VENDOR_SIMCOM) &&
+	    (data->vendor != OFONO_VENDOR_DROID))
 		at_ack_delivery(sms);
 	return;
 
@@ -845,6 +846,7 @@ static gboolean build_cnmi_string(char *buf, int *cnmi_opts,
 	case OFONO_VENDOR_ZTE:
 	case OFONO_VENDOR_SIMCOM:
 	case OFONO_VENDOR_QUECTEL:
+	case OFONO_VENDOR_DROID:
 		/* MSM devices advertise support for mode 2, but return an
 		 * error if we attempt to actually use it. */
 		mode = "1";
@@ -858,9 +860,14 @@ static gboolean build_cnmi_string(char *buf, int *cnmi_opts,
 	if (!append_cnmi_element(buf, &len, cnmi_opts[0], mode, FALSE))
 		return FALSE;
 
+	mode = "21";
+	if (!data->cnma_enabled)
+		mode = "1";
+	if (data->vendor == OFONO_VENDOR_DROID)
+		mode = "2";
+
 	/* Prefer to deliver SMS via +CMT if CNMA is supported */
-	if (!append_cnmi_element(buf, &len, cnmi_opts[1],
-					data->cnma_enabled ? "21" : "1", FALSE))
+	if (!append_cnmi_element(buf, &len, cnmi_opts[1], mode, FALSE))
 		return FALSE;
 
 	switch (data->vendor) {
@@ -1290,6 +1297,8 @@ static void at_csms_query_cb(gboolean ok, GAtResult *result,
 		goto out;
 
 	switch (data->vendor) {
+	case OFONO_VENDOR_DROID:
+		break;
 	case OFONO_VENDOR_QUECTEL_SERIAL:
 		g_at_result_iter_next_number(&iter, &status_min);
 		g_at_result_iter_next_number(&iter, &status_max);
Signature · 6 lines
2.11.0


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

Hi Pavel,

Quoted 11 lines · Pavel Machek

Droid 4 modem is "special" (aka broken) so and getting incoming SMSes
to work is quite tricky. This should get it right.

---
  drivers/atmodem/sms.c | 15 ++++++++++++---
  1 file changed, 12 insertions(+), 3 deletions(-)
drivers/atmodem/sms.c +0 -0
index d502da72..f08f2fb1 100644

drivers/atmodem/sms.c static void at_cmt_notify(GAtResult *result, gpointer user_data) · line 467

Quoted 6 lines
drivers/atmodem/sms.c +2 -1
@@ -463,7 +463,8 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data)
  	decode_hex_own_buf(hexpdu, -1, &pdu_len, 0, pdu);
  	ofono_sms_deliver_notify(sms, pdu, pdu_len, tpdu_len);
 
-	if (data->vendor != OFONO_VENDOR_SIMCOM)
+	if ((data->vendor != OFONO_VENDOR_SIMCOM) &&
+	    (data->vendor != OFONO_VENDOR_DROID))

Fixed up style here per item M4

Quoted 3 lines
drivers/atmodem/sms.c +0 -0
  		at_ack_delivery(sms);
  	return;
 

<snip>

drivers/atmodem/sms.c static gboolean build_cnmi_string(char *buf, int *cnmi_opts, · line 868

Quoted 10 lines
drivers/atmodem/sms.c +6 -0
@@ -858,9 +860,14 @@ static gboolean build_cnmi_string(char *buf, int *cnmi_opts,
  	if (!append_cnmi_element(buf, &len, cnmi_opts[0], mode, FALSE))
  		return FALSE;
 
+	mode = "21";
+	if (!data->cnma_enabled)
+		mode = "1";
+	if (data->vendor == OFONO_VENDOR_DROID)
+		mode = "2";
+

And here per item M1.

Also, I had to resolve a minor conflict manually. Please rebase against git HEAD when sending out patches.

Applied, thanks.

Regards,
-Denis

#2 lore raw

Hi!

Quoted 6 lines

And here per item M1.

Also, I had to resolve a minor conflict manually. Please rebase against git HEAD when sending out patches.

Applied, thanks.

Thank you!
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html