Skip to contentSkip to conversation

AT modem on Droid 4: where is my sms?

PATCH Superseded Pavel Machek 3 participants 8 messages Jul 31, 2020 – Aug 1, 2020 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

Hi!

I have problems with getting CNMA to work, so I'm exploring other possibilities. Apparently ofono should be able to work without that.. but is it working properly?

ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n
ofonod[5218]: < \r\n+CMTI: "ME",2\r\n
ofonod[5218]: drivers/atmodem/sms.c:at_cmti_notify() Got a CMTI indication@ME, index: 2
ofonod[5218]: > AT+CMGR=2\r
ofonod[5218]: < \r\nOK\r\n
ofonod[5218]: > AT+CMGD=2\r
ofonod[5218]: < \r\nOK\r\n
ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n

So.... modem told us we have new message and where it is, but then ofono ... deleted the message without delivering it...?

There's no new message@monitor-ofono...

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw
Quoted 18 lines · Pavel Machek

Hi!

I have problems with getting CNMA to work, so I'm exploring other possibilities. Apparently ofono should be able to work without that.. but is it working properly?

ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n
ofonod[5218]: < \r\n+CMTI: "ME",2\r\n
ofonod[5218]: drivers/atmodem/sms.c:at_cmti_notify() Got a CMTI indication at ME, index: 2
ofonod[5218]: > AT+CMGR=2\r
ofonod[5218]: < \r\nOK\r\n
ofonod[5218]: > AT+CMGD=2\r
ofonod[5218]: < \r\nOK\r\n
ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n

Quoted 2 lines

So.... modem told us we have new message and where it is, but then ofono ... deleted the message without delivering it...?

After a while, this appeared in the log:

ofonod[5218]: < \r\n+CIEV: 1,4\r\n
ofonod[5218]: < \r\n+CMTI: "ME",-1\r\n
ofonod[5218]: Unable to parse CMTI notification

Not sure what is going on there.

Best regards, Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw
In reply to Pavel Machek

Hi Pavel,

Quoted 6 lines · Pavel Machek

Hi!

I have problems with getting CNMA to work, so I'm exploring other possibilities. Apparently ofono should be able to work without that.. but is it working properly?

Quoted 7 lines

ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n
ofonod[5218]: < \r\n+CMTI: "ME",2\r\n
ofonod[5218]: drivers/atmodem/sms.c:at_cmti_notify() Got a CMTI indication at ME, index: 2
ofonod[5218]: > AT+CMGR=2\r
ofonod[5218]: < \r\nOK\r\n

That's quite strange, CMGR response should have an intermediate response prefixed by +CMGR: prior to the OK. Your modem is just weird ;)

Quoted 8 lines

ofonod[5218]: > AT+CMGD=2\r
ofonod[5218]: < \r\nOK\r\n
ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n

So.... modem told us we have new message and where it is, but then ofono ... deleted the message without delivering it...?

What the stock AT modem driver does is reads the message and deletes it right away. Somehow your modem says 'sure' to the read request without actually reading the message. Maybe the firmware is just too slow or oFono is too fast, or maybe this modem needs extra special magic.

Regards,
-Denis

#3 lore raw

Hi,

Quoted 17 lines · Denis Kenzior

Hi Pavel,

Quoted 6 lines · Pavel Machek

Hi!

I have problems with getting CNMA to work, so I'm exploring other possibilities. Apparently ofono should be able to work without that.. but is it working properly?

Quoted 7 lines

ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n
ofonod[5218]: < \r\n+CMTI: "ME",2\r\n
ofonod[5218]: drivers/atmodem/sms.c:at_cmti_notify() Got a CMTI indication at ME, index: 2
ofonod[5218]: > AT+CMGR=2\r
ofonod[5218]: < \r\nOK\r\n

Quoted 2 lines

That's quite strange, CMGR response should have an intermediate response prefixed by +CMGR: prior to the OK.  Your modem is just weird ;)

Just my guess. This can happen if another process (other than Ofono) is reading the tty channel.

Quoted 20 lines
Quoted 9 lines

ofonod[5218]: > AT+CMGD=2\r
ofonod[5218]: < \r\nOK\r\n
ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n

So.... modem told us we have new message and where it is, but then ofono ... deleted the message without delivering it...?

What the stock AT modem driver does is reads the message and deletes it right away.  Somehow your modem says 'sure' to the read request without actually reading the message.  Maybe the firmware is just too slow or oFono is too fast, or maybe this modem needs extra special magic.

Regards,
-Denis
_______________________________________________
ofono mailing list -- ofono(a)ofono.org
To unsubscribe send an email to ofono-leave(a)ofono.org

#4 lore raw

Hi!

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

I have problems with getting CNMA to work, so I'm exploring other possibilities. Apparently ofono should be able to work without that.. but is it working properly?

ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n
ofonod[5218]: < \r\n+CMTI: "ME",2\r\n
ofonod[5218]: drivers/atmodem/sms.c:at_cmti_notify() Got a CMTI indication at ME, index: 2
ofonod[5218]: > AT+CMGR=2\r
ofonod[5218]: < \r\nOK\r\n

Quoted 4 lines
Quoted 2 lines

That's quite strange, CMGR response should have an intermediate response prefixed by +CMGR: prior to the OK.  Your modem is just weird ;)

Just my guess. This can happen if another process (other than Ofono) is reading the tty channel.

There should not be such other process. And this is quite reproducible..

It might be something power-management-related, I'm fighting with that a lot; but I believe modem is simply weird.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#5 lore raw
In reply to Denis Kenzior

Hi!

Quoted 12 lines
Quoted 11 lines

I have problems with getting CNMA to work, so I'm exploring other possibilities. Apparently ofono should be able to work without that.. but is it working properly?

ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n
ofonod[5218]: < \r\n+CMTI: "ME",2\r\n
ofonod[5218]: drivers/atmodem/sms.c:at_cmti_notify() Got a CMTI indication at ME, index: 2
ofonod[5218]: > AT+CMGR=2\r
ofonod[5218]: < \r\nOK\r\n

Quoted 2 lines

That's quite strange, CMGR response should have an intermediate response prefixed by +CMGR: prior to the OK. Your modem is just weird ;)

Yes, it is.

Quoted 5 lines
Quoted 5 lines

ofonod[5218]: > AT+CMGD=2\r
ofonod[5218]: < \r\nOK\r\n
ofonod[5218]: < \r\n+CIEV: 1,3\r\n
ofonod[5218]: < \r\n+CIEV: 1,4\r\n

Quoted 8 lines
Quoted 3 lines

So.... modem told us we have new message and where it is, but then ofono ... deleted the message without delivering it...?

What the stock AT modem driver does is reads the message and deletes it right away. Somehow your modem says 'sure' to the read request without actually reading the message. Maybe the firmware is just too slow or oFono is too fast, or maybe this modem needs extra special magic.

Would it make sense not to proceed with +CMGD in case modem did not provide a message for +CMGR?

I don't think it is timing, as we see OK after CMGR...

Fortunately, I found a mode that works...

Best regards,
Pavel

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

PATCH 1/1 Support weird modem in Motorola Droid 4

In reply to Pavel Machek

This is basic support for modem in Droid 4, accessed over ttyUSB4. That interface is unfortunately quite broken, so we need to force very specific SMS mode.

Makefile.am +3 -0
index fbb0eff4..9b3fbb8d 100644
@@ -603,6 +603,9 @@ builtin_sources += plugins/ublox.c
 builtin_modules += xmm7xxx
 builtin_sources += plugins/xmm7xxx.c
 
+builtin_modules += droid
+builtin_sources += plugins/droid.c
+
 if BLUETOOTH
 if BLUEZ4
 builtin_modules += sap
drivers/atmodem/sim.c +1 -0
index e750a139..f46cd3a2 100644
@@ -199,6 +199,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
 	case OFONO_VENDOR_SPEEDUP:
 	case OFONO_VENDOR_QUALCOMM_MSM:
 	case OFONO_VENDOR_SIMCOM:
+	case OFONO_VENDOR_DROID:
 		/* Maximum possible length */
 		len += sprintf(buf + len, ",0,0,255");
 		break;
drivers/atmodem/sms.c +23 -5
index d502da72..c0f33ebc 100644
@@ -349,8 +349,15 @@ static inline void at_ack_delivery(struct ofono_sms *sms)
 			break;
 		}
 	} else {
-		/* Should be a safe fallback */
-		snprintf(buf, sizeof(buf), "AT+CNMA=0");
+		switch (data->vendor) {
+		case OFONO_VENDOR_DROID:
+			snprintf(buf, sizeof(buf), "AT");
+			break;
+		default:
+			/* Should be a safe fallback */
+			snprintf(buf, sizeof(buf), "AT+CNMA=0");
+			break;
+		}
 	}
 
 	g_at_chat_send(data->chat, buf, none_prefix, at_cnma_cb, NULL, NULL);
@@ -845,6 +852,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 +866,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) {
@@ -1243,7 +1256,9 @@ static void at_csms_status_cb(gboolean ok, GAtResult *result,
 			goto out;
 
 		if (service == 1 || service == 128)
-			data->cnma_enabled = TRUE;
+			if (data->vendor != OFONO_VENDOR_DROID) {
+				data->cnma_enabled = TRUE;
+			}
 
 		if (mt == 1 && mo == 1)
 			supported = TRUE;
@@ -1290,6 +1305,9 @@ static void at_csms_query_cb(gboolean ok, GAtResult *result,
 		goto out;
 
 	switch (data->vendor) {
+	case OFONO_VENDOR_DROID:
+	  	csms = 0;
+		break;
 	case OFONO_VENDOR_QUECTEL_SERIAL:
 		g_at_result_iter_next_number(&iter, &status_min);
 		g_at_result_iter_next_number(&iter, &status_max);
drivers/atmodem/vendor.h +1 -0
index d839d1e0..2bfd3eb8 100644
@@ -27,6 +27,7 @@ enum ofono_vendor {
 	OFONO_VENDOR_MBM,
 	OFONO_VENDOR_GOBI,
 	OFONO_VENDOR_QUALCOMM_MSM,
+	OFONO_VENDOR_DROID,
 	OFONO_VENDOR_OPTION_HSO,
 	OFONO_VENDOR_ZTE,
 	OFONO_VENDOR_HUAWEI,
drivers/atmodem/voicecall.c +4 -0
index 7ab6567f..6c80bd4e 100644
@@ -160,6 +160,10 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
 			poll_again = TRUE;
 			goto poll_again;
 		}
+		if (vd->vendor == OFONO_VENDOR_DROID) {
+			poll_again = TRUE;
+			goto poll_again;
+		}
 
 		ofono_error("We are polling CLCC and received an error");
 		ofono_error("All bets are off for call management");
plugins/droid.c new file +226 -0

226 lines not on this page · raw message

plugins/udevng.c +33 -0
index 4a38621b..5f8e86e4 100644
@@ -712,6 +712,36 @@ static gboolean setup_telitqmi(struct modem_info *modem)
 	return TRUE;
 }
 
+static gboolean setup_droid(struct modem_info *modem)
+{
+  	const char *qmi = NULL, *net = NULL, *at = NULL;
+	GSList *list;
+
+	DBG("%s", modem->syspath);
+
+	for (list = modem->devices; list; list = list->next) {
+		struct device_info *info = list->data;
+
+		DBG("%s %s %s %s %s", info->devnode, info->interface,
+				info->number, info->label, info->subsystem);
+
+		if (g_strcmp0(info->interface, "255/255/255") == 0 &&
+				g_strcmp0(info->number, "04") == 0) {
+			at = info->devnode;
+		}
+	}
+
+	if (at == NULL)
+		return FALSE;
+
+	DBG("at=%s qmi=%s net=%s", at, qmi, net);
+
+	ofono_modem_set_string(modem->modem, "Device", at);
+	ofono_modem_set_driver(modem->modem, "droid");
+
+	return TRUE;
+}
+
 /* TODO: Not used as we have no simcom driver */
 static gboolean setup_simcom(struct modem_info *modem)
 {
@@ -1401,6 +1431,7 @@ static struct {
 	{ "gemalto",	setup_gemalto	},
 	{ "xmm7xxx",	setup_xmm7xxx	},
 	{ "mbim",	setup_mbim	},
+	{ "droid",	setup_droid	},
 	/* Following are non-USB modems */
 	{ "ifx",	setup_ifx		},
 	{ "u8500",	setup_isi_serial	},
@@ -1786,6 +1817,8 @@ static struct {
 	{ "telit",	"cdc_acm",	"1bc7", "0021"	},
 	{ "telitqmi",	"qmi_wwan",	"1bc7", "1201"	},
 	{ "telitqmi",	"option",	"1bc7", "1201"	},
+	{ "droid",	"qmi_wwan",	"22b8", "2a70"	},
+	{ "droid",	"option",	"22b8", "2a70"	},
 	{ "nokia",	"option",	"0421", "060e"	},
 	{ "nokia",	"option",	"0421", "0623"	},
 	{ "samsung",	"option",	"04e8", "6889"	},
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#7 lore raw

PATCH v2 1/1 Support weird modem in Motorola Droid 4

This is basic support for modem in Droid 4, accessed over ttyUSB4. That interface is unfortunately quite broken, so we need to force very specific SMS mode.

---

Sorry, hit send too soon and sent version with unused variables and broken whitespace. This one should be better.

Makefile.am +3 -0
index fbb0eff4..9b3fbb8d 100644
@@ -603,6 +603,9 @@ builtin_sources += plugins/ublox.c
 builtin_modules += xmm7xxx
 builtin_sources += plugins/xmm7xxx.c
 
+builtin_modules += droid
+builtin_sources += plugins/droid.c
+
 if BLUETOOTH
 if BLUEZ4
 builtin_modules += sap
drivers/atmodem/sim.c +1 -0
index e750a139..f46cd3a2 100644
@@ -199,6 +199,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
 	case OFONO_VENDOR_SPEEDUP:
 	case OFONO_VENDOR_QUALCOMM_MSM:
 	case OFONO_VENDOR_SIMCOM:
+	case OFONO_VENDOR_DROID:
 		/* Maximum possible length */
 		len += sprintf(buf + len, ",0,0,255");
 		break;
drivers/atmodem/sms.c +22 -5
index d502da72..a9306916 100644
@@ -349,8 +349,15 @@ static inline void at_ack_delivery(struct ofono_sms *sms)
 			break;
 		}
 	} else {
-		/* Should be a safe fallback */
-		snprintf(buf, sizeof(buf), "AT+CNMA=0");
+		switch (data->vendor) {
+		case OFONO_VENDOR_DROID:
+			snprintf(buf, sizeof(buf), "AT");
+			break;
+		default:
+			/* Should be a safe fallback */
+			snprintf(buf, sizeof(buf), "AT+CNMA=0");
+			break;
+		}
 	}
 
 	g_at_chat_send(data->chat, buf, none_prefix, at_cnma_cb, NULL, NULL);
@@ -845,6 +852,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 +866,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) {
@@ -1243,7 +1256,9 @@ static void at_csms_status_cb(gboolean ok, GAtResult *result,
 			goto out;
 
 		if (service == 1 || service == 128)
-			data->cnma_enabled = TRUE;
+			if (data->vendor != OFONO_VENDOR_DROID) {
+				data->cnma_enabled = TRUE;
+			}
 
 		if (mt == 1 && mo == 1)
 			supported = TRUE;
@@ -1290,6 +1305,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);
drivers/atmodem/vendor.h +1 -0
index d839d1e0..2bfd3eb8 100644
@@ -27,6 +27,7 @@ enum ofono_vendor {
 	OFONO_VENDOR_MBM,
 	OFONO_VENDOR_GOBI,
 	OFONO_VENDOR_QUALCOMM_MSM,
+	OFONO_VENDOR_DROID,
 	OFONO_VENDOR_OPTION_HSO,
 	OFONO_VENDOR_ZTE,
 	OFONO_VENDOR_HUAWEI,
drivers/atmodem/voicecall.c +4 -0
index 7ab6567f..6c80bd4e 100644
@@ -160,6 +160,10 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
 			poll_again = TRUE;
 			goto poll_again;
 		}
+		if (vd->vendor == OFONO_VENDOR_DROID) {
+			poll_again = TRUE;
+			goto poll_again;
+		}
 
 		ofono_error("We are polling CLCC and received an error");
 		ofono_error("All bets are off for call management");
plugins/droid.c new file +226 -0

226 lines not on this page · raw message

plugins/udevng.c +31 -0
index 4a38621b..14e6e2a7 100644
@@ -712,6 +712,34 @@ static gboolean setup_telitqmi(struct modem_info *modem)
 	return TRUE;
 }
 
+static gboolean setup_droid(struct modem_info *modem)
+{
+	const char *at = NULL;
+	GSList *list;
+
+	DBG("%s", modem->syspath);
+
+	for (list = modem->devices; list; list = list->next) {
+		struct device_info *info = list->data;
+
+		DBG("%s %s %s %s %s", info->devnode, info->interface,
+				info->number, info->label, info->subsystem);
+
+		if (g_strcmp0(info->interface, "255/255/255") == 0 &&
+				g_strcmp0(info->number, "04") == 0) {
+			at = info->devnode;
+		}
+	}
+
+	if (at == NULL)
+		return FALSE;
+
+	ofono_modem_set_string(modem->modem, "Device", at);
+	ofono_modem_set_driver(modem->modem, "droid");
+
+	return TRUE;
+}
+
 /* TODO: Not used as we have no simcom driver */
 static gboolean setup_simcom(struct modem_info *modem)
 {
@@ -1401,6 +1429,7 @@ static struct {
 	{ "gemalto",	setup_gemalto	},
 	{ "xmm7xxx",	setup_xmm7xxx	},
 	{ "mbim",	setup_mbim	},
+	{ "droid",	setup_droid	},
 	/* Following are non-USB modems */
 	{ "ifx",	setup_ifx		},
 	{ "u8500",	setup_isi_serial	},
@@ -1786,6 +1815,8 @@ static struct {
 	{ "telit",	"cdc_acm",	"1bc7", "0021"	},
 	{ "telitqmi",	"qmi_wwan",	"1bc7", "1201"	},
 	{ "telitqmi",	"option",	"1bc7", "1201"	},
+	{ "droid",	"qmi_wwan",	"22b8", "2a70"	},
+	{ "droid",	"option",	"22b8", "2a70"	},
 	{ "nokia",	"option",	"0421", "060e"	},
 	{ "nokia",	"option",	"0421", "0623"	},
 	{ "samsung",	"option",	"04e8", "6889"	},
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html