qmimodem: return all serial numbers
PATCH 1/1 qmimodem: return all serial numbers
From: Tom Nguyen <[email protected]>
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(-)
drivers/qmimodem/devinfo.c +19 -14
@@ -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,
Signature · 1 line
2.20.1
Hi Tom/Joshua
Quoted 8 lines · Joshua Watt
From: Tom Nguyen <[email protected]>
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...
Quoted 4 lines
--- drivers/qmimodem/devinfo.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
Regards,
-Denis