All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qmimodem: return all serial numbers
@ 2019-04-05 16:15 Joshua Watt
  2019-04-05 17:46 ` Denis Kenzior
  0 siblings, 1 reply; 3+ messages in thread
From: Joshua Watt @ 2019-04-05 16:15 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

From: Tom Nguyen <tom.nguyen@garmin.com>

ESN and MEID are used for CDMA devices. IMEI is used for GSM devices.
Some modems, eg. Quectel EC25E, have variants that support each network
for in various regions. So, the modems may return the ESN, MEID, and
IMEI regardless of the variant. To support this case, the ESN, MEID,
and IMEI should all be reported. Then the user application can decide
which to use.
---
 drivers/qmimodem/devinfo.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/qmimodem/devinfo.c b/drivers/qmimodem/devinfo.c
index af976b77..08e71fdf 100644
--- a/drivers/qmimodem/devinfo.c
+++ b/drivers/qmimodem/devinfo.c
@@ -117,7 +117,10 @@ static void get_ids_cb(struct qmi_result *result, void *user_data)
 {
 	struct cb_data *cbd = user_data;
 	ofono_devinfo_query_cb_t cb = cbd->cb;
-	char *str;
+	char *esn;
+	char *imei;
+	char *meid;
+	char buf[64];
 
 	DBG("");
 
@@ -126,20 +129,22 @@ static void get_ids_cb(struct qmi_result *result, void *user_data)
 		return;
 	}
 
-	str = qmi_result_get_string(result, QMI_DMS_RESULT_ESN);
-	/* Telit qmi modems return a "0" string when ESN is not available. */
-	if (!str || strcmp(str, "0") == 0) {
-		qmi_free(str);
-		str = qmi_result_get_string(result, QMI_DMS_RESULT_IMEI);
-		if (!str) {
-			CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
-			return;
-		}
-	}
-
-	CALLBACK_WITH_SUCCESS(cb, str, cbd->data);
+	esn = qmi_result_get_string(result, QMI_DMS_RESULT_ESN);
+	imei = qmi_result_get_string(result, QMI_DMS_RESULT_IMEI);
+	meid = qmi_result_get_string(result, QMI_DMS_RESULT_MEID);
+
+	if (esn || imei || meid) {
+		sprintf(buf, "ESN:%s,IMEI:%s,MEID:%s",
+					(esn) ? esn : "unknown",
+					(imei) ? imei : "unknown",
+					(meid) ? meid : "unknown");
+		CALLBACK_WITH_SUCCESS(cb, buf, cbd->data);
+	} else
+		CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
 
-	qmi_free(str);
+	qmi_free(esn);
+	qmi_free(imei);
+	qmi_free(meid);
 }
 
 static void qmi_query_serial(struct ofono_devinfo *devinfo,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] qmimodem: return all serial numbers
  2019-04-05 16:15 [PATCH] qmimodem: return all serial numbers Joshua Watt
@ 2019-04-05 17:46 ` Denis Kenzior
  0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2019-04-05 17:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]

Hi Tom/Joshua

On 04/05/2019 11:15 AM, Joshua Watt wrote:
> From: Tom Nguyen <tom.nguyen@garmin.com>
> 
> ESN and MEID are used for CDMA devices. IMEI is used for GSM devices.
> Some modems, eg. Quectel EC25E, have variants that support each network
> for in various regions. So, the modems may return the ESN, MEID, and
> IMEI regardless of the variant. To support this case, the ESN, MEID,
> and IMEI should all be reported. Then the user application can decide
> which to use.

So you want to be running the Quectel driver as a multi-mode device, 
either CDMA or GSM mode?  I imagine you saw that CDMA support is rather 
unfinished...?

So here's the problem.  The Modem.Serial property was really always 
meant to be the IMEI or the ESN/MEID.  It was never meant to contain 
weird strings, or combinations of IDs or anything else of that sort. 
The apps using Modem.Serial really just expect to display this as a 
number.  So the approach of stuffing IMEI: Foo ESN: Bar MEID: Baz into 
the Serial string is not going to work.

So the obvious consequence of the above is that we never really 
considered multi-mode devices, and CDMA support was abandoned pretty 
shortly after.

Given that the D-Bus API is frozen, we can't really mess with the Serial 
property at this point.  We can add additional properties however...

> ---
>   drivers/qmimodem/devinfo.c | 33 +++++++++++++++++++--------------
>   1 file changed, 19 insertions(+), 14 deletions(-)
> 

Regards,
-Denis

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] qmimodem: return all serial numbers
       [not found] <46465886edbd45a3bc563ee11286575f@garmin.com>
@ 2019-04-05 22:04 ` Denis Kenzior
  0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2019-04-05 22:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]

Hi Tom,

On 04/05/2019 03:13 PM, Nguyen, Tom wrote:
> Hi Denis,
> 
> Thank you for the quick response. By the way, I'm not able to post to ofono(a)ofono.org, so this reply probably won't show up there. I've not figured out what the problem is, but suspect it's blocking "garmin.com".

Please contact ofono-owner address again and see if someone can help.  I 
don't really have any idea why we would be blocking any domain and you 
are the first to complain in 10 or so years.

> 
> The issue is that Quectel has a single mode LTE modem that populates all 3 fields. They do this because they also have the same modem that only supports CDMA. So, the current oFono code returns the ESN even though my modem is LTE only. Your info below is very informative, thanks! The CDMA info also confirms my observation about its level of support.
> 
> I have an alternative idea. What if I query QMI_DMS_GET_CAPS, figure out which radio_if is supported, then return IMEI if GSM/UMTS/LTE is supported, else ESN or MEID? This way Modem.Serial property will still behave as it does now.

That sounds workable.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-05 22:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-05 16:15 [PATCH] qmimodem: return all serial numbers Joshua Watt
2019-04-05 17:46 ` Denis Kenzior
     [not found] <46465886edbd45a3bc563ee11286575f@garmin.com>
2019-04-05 22:04 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.