* [PATCH] qmimodem: fix roaming status report @ 2017-12-15 10:28 Christophe Ronco 2017-12-15 10:28 ` Christophe Ronco 0 siblings, 1 reply; 7+ messages in thread From: Christophe Ronco @ 2017-12-15 10:28 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 5451 bytes --] Hi, With a MC7304 modem and a roaming SIM card, Status in org.ofono.NetworkRegistration properties ends up in "registered" instead of roaming. Both AT command and qmicli indicates we are roaming. What's happening is the following: 1) first QMI_NAS_SS_INFO_IND indicating we are registered contains a QMI_NAS_RESULT_ROAMING_STATUS parameter. Parameter inside says we are roaming and qmimidem driver correctly reports status NETWORK_REGISTRATION_STATUS_ROAMING. 2) other QMI_NAS_SS_INFO_IND arrive, saying we are registered without QMI_NAS_RESULT_ROAMING_STATUS parameter. Driver reports NETWORK_REGISTRATION_STATUS_REGISTERED. Extract of traces with QMI binary debug interpreted (as far as I can...): a) first "searching" indication Dec 13 13:19:40 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: < 01 3b 00 80 03 01 04 00 00 24 00 2f 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 22 05 00 01 02 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_LIMITED, QMI_NAS_NETWORK_SERVICE_DOMAIN_PS, ... 15 03 00 01 08 01 LTE, no roaming 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 01 00 00 10 01 00 01 No roaming 01 06 00 02 02 02 02 01 08 QMI_NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, CS detached, PS detached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_LTE Dec 13 13:19:40 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: NAS_ind msg=36 len=47 [client=1,type=4,tid=0,len=59] Dec 13 13:19:40 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: {type=41,len=5} {type=34,len=5} {type=21,len=3} {type=18,len=5} Dec 13 13:19:40 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: {type=17,len=1} {type=16,len=1} {type=1,len=6} Dec 13 13:19:40 klk-lpbs-0504B4 daemon.debug ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 2 lac -1 cellid -1 tech 7 b) second "searching" indication Dec 13 13:19:41 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: < 01 21 00 80 03 01 04 00 00 24 00 15 00 22 05 00 03 03 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_LIMITED_REGIONAL, CS_PS, ... 11 01 00 00 01 06 00 02 02 02 02 01 08 QMI_NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, CS detached, PS detached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_LTE Dec 13 13:19:41 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: NAS_ind msg=36 len=21 [client=1,type=4,tid=0,len=33] Dec 13 13:19:41 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: {type=34,len=5} {type=17,len=1} {type=1,len=6} c) First indication while "registered" Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: < 01 5e 00 80 03 01 04 00 00 24 00 52 00 2a 01 00 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 28 02 00 15 01 UMTS Primary Scrambling Code 26 08 00 03 00 00 00 03 00 00 00 CS: all calls allowed, PS: all calls allowed 22 05 00 02 03 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_AVAILABLE, CS_PS, ... 1e 04 00 f7 00 95 04 CID 3GPP 1d 02 00 fb 50 LAC 3GPP 15 03 00 01 05 00 UMTS: roaming 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 04 00 03 03 04 05 10 01 00 00 ROAMING ON 01 06 00 01 01 01 02 01 05 QMI_NAS_REGISTRATION_STATE_REGISTERED, CS attached, PS attached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_UMTS Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: NAS_ind msg=36 len=82 [client=1,type=4,tid=0,len=94] Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: {type=42,len=1} {type=41,len=5} {type=40,len=2} {type=38,len=8} Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: {type=34,len=5} {type=30,len=4} {type=29,len=2} {type=21,len=3} Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: {type=18,len=5} {type=17,len=4} {type=16,len=1} {type=1,len=6} Dec 13 13:19:56 klk-lpbs-0504B4 daemon.debug ofonod[855]: ofono_gprs_status_notify modem /sierra_0 status 1 ==================> ROAMING status reported <========================== Dec 13 13:19:56 klk-lpbs-0504B4 daemon.debug ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 5 lac 20731 cellid 76873975 tech 2 d) second indication while "registered" Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: < 01 31 00 80 03 01 04 00 00 24 00 25 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 28 02 00 15 01 UMTS Primary Scrambling Code 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 04 00 03 03 04 05 01 06 00 01 01 01 02 01 05 QMI_NAS_REGISTRATION_STATE_REGISTERED, CS attached, PS attached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_UMTS Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: NAS_ind msg=36 len=37 [client=1,type=4,tid=0,len=49] Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: {type=41,len=5} {type=40,len=2} {type=18,len=5} {type=17,len=4} Dec 13 13:19:56 klk-lpbs-0504B4 daemon.info ofonod[855]: QMI: {type=1,len=6} ==================> ROAMING information lost <========================== Dec 13 13:19:56 klk-lpbs-0504B4 daemon.debug ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 1 lac -1 cellid -1 tech 2 I don't know if this is a problem specific to MC7304 or even to my firmware version or if this is a normal behavior to have ROAMING_STATUS parameter only when status change from anything to registered. Best Regards, Christophe Christophe Ronco (1): qmimodem: fix roaming status report drivers/qmimodem/network-registration.c | 50 ++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] qmimodem: fix roaming status report 2017-12-15 10:28 [PATCH] qmimodem: fix roaming status report Christophe Ronco @ 2017-12-15 10:28 ` Christophe Ronco 2017-12-15 17:46 ` Denis Kenzior 0 siblings, 1 reply; 7+ messages in thread From: Christophe Ronco @ 2017-12-15 10:28 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 3887 bytes --] --- drivers/qmimodem/network-registration.c | 50 ++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c index 6c1f50b..85de4e1 100644 --- a/drivers/qmimodem/network-registration.c +++ b/drivers/qmimodem/network-registration.c @@ -42,6 +42,13 @@ struct netreg_data { struct qmi_service *nas; struct ofono_network_operator operator; uint8_t current_rat; + bool is_roaming; +}; + +enum roaming_status { + ROAMING_STATUS_OFF, + ROAMING_STATUS_ON, + ROAMING_STATUS_NO_CHANGE, }; static bool extract_ss_info_time( @@ -78,11 +85,12 @@ static bool extract_ss_info_time( static bool extract_ss_info(struct qmi_result *result, int *status, int *lac, int *cellid, int *tech, + enum roaming_status *roaming, struct ofono_network_operator *operator) { const struct qmi_nas_serving_system *ss; const struct qmi_nas_current_plmn *plmn; - uint8_t i, roaming; + uint8_t i, is_not_roaming; uint16_t value16, len, opname_len; uint32_t value32; @@ -105,10 +113,13 @@ static bool extract_ss_info(struct qmi_result *result, int *status, } if (qmi_result_get_uint8(result, QMI_NAS_RESULT_ROAMING_STATUS, - &roaming)) { - if (ss->status == 1 && roaming == 0) - *status = NETWORK_REGISTRATION_STATUS_ROAMING; - } + &is_not_roaming)) { + if (is_not_roaming == 0) + *roaming = ROAMING_STATUS_ON; + else + *roaming = ROAMING_STATUS_OFF; + } else + *roaming = ROAMING_STATUS_NO_CHANGE; if (!operator) return true; @@ -160,16 +171,28 @@ static void ss_info_notify(struct qmi_result *result, void *user_data) struct ofono_network_time net_time; struct netreg_data *data = ofono_netreg_get_data(netreg); int status, lac, cellid, tech; + enum roaming_status roaming; DBG(""); if (extract_ss_info_time(result, &net_time)) ofono_netreg_time_notify(netreg, &net_time); - if (!extract_ss_info(result, &status, &lac, &cellid, &tech, + if (!extract_ss_info(result, &status, &lac, &cellid, &tech, &roaming, &data->operator)) return; + if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED) { + if (roaming == ROAMING_STATUS_ON || + (roaming == ROAMING_STATUS_NO_CHANGE && + data->is_roaming)) { + status = NETWORK_REGISTRATION_STATUS_ROAMING; + data->is_roaming = true; + } else + data->is_roaming = false; + } else + data->is_roaming = false; + ofono_netreg_status_notify(netreg, status, lac, cellid, tech); } @@ -179,6 +202,7 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_data) ofono_netreg_status_cb_t cb = cbd->cb; struct netreg_data *data = cbd->user; int status, lac, cellid, tech; + enum roaming_status roaming; DBG(""); @@ -187,12 +211,23 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_data) return; } - if (!extract_ss_info(result, &status, &lac, &cellid, &tech, + if (!extract_ss_info(result, &status, &lac, &cellid, &tech, &roaming, &data->operator)) { CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, cbd->data); return; } + if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED) { + if (roaming == ROAMING_STATUS_ON || + (roaming == ROAMING_STATUS_NO_CHANGE && + data->is_roaming)) { + status = NETWORK_REGISTRATION_STATUS_ROAMING; + data->is_roaming = true; + } else + data->is_roaming = false; + } else + data->is_roaming = false; + CALLBACK_WITH_SUCCESS(cb, status, lac, cellid, tech, cbd->data); } @@ -580,6 +615,7 @@ static int qmi_netreg_probe(struct ofono_netreg *netreg, data->operator.tech = -1; data->current_rat = QMI_NAS_NETWORK_RAT_NO_CHANGE; + data->is_roaming = false; ofono_netreg_set_data(netreg, data); -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] qmimodem: fix roaming status report 2017-12-15 10:28 ` Christophe Ronco @ 2017-12-15 17:46 ` Denis Kenzior 2017-12-18 9:33 ` Christophe Ronco 2018-09-07 14:29 ` [PATCHV2 0/1] " Christophe Ronco 0 siblings, 2 replies; 7+ messages in thread From: Denis Kenzior @ 2017-12-15 17:46 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 4706 bytes --] Hi Christophe, On 12/15/2017 04:28 AM, Christophe Ronco wrote: It would be nice to have the information in the cover letter included in the commit description. > --- > drivers/qmimodem/network-registration.c | 50 ++++++++++++++++++++++++++++----- > 1 file changed, 43 insertions(+), 7 deletions(-) > > diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c > index 6c1f50b..85de4e1 100644 > --- a/drivers/qmimodem/network-registration.c > +++ b/drivers/qmimodem/network-registration.c > @@ -42,6 +42,13 @@ struct netreg_data { > struct qmi_service *nas; > struct ofono_network_operator operator; > uint8_t current_rat; > + bool is_roaming; > +}; > + > +enum roaming_status { > + ROAMING_STATUS_OFF, > + ROAMING_STATUS_ON, > + ROAMING_STATUS_NO_CHANGE, > }; > > static bool extract_ss_info_time( > @@ -78,11 +85,12 @@ static bool extract_ss_info_time( > > static bool extract_ss_info(struct qmi_result *result, int *status, > int *lac, int *cellid, int *tech, > + enum roaming_status *roaming, > struct ofono_network_operator *operator) > { > const struct qmi_nas_serving_system *ss; > const struct qmi_nas_current_plmn *plmn; > - uint8_t i, roaming; > + uint8_t i, is_not_roaming; > uint16_t value16, len, opname_len; > uint32_t value32; > > @@ -105,10 +113,13 @@ static bool extract_ss_info(struct qmi_result *result, int *status, > } > > if (qmi_result_get_uint8(result, QMI_NAS_RESULT_ROAMING_STATUS, > - &roaming)) { > - if (ss->status == 1 && roaming == 0) > - *status = NETWORK_REGISTRATION_STATUS_ROAMING; > - } > + &is_not_roaming)) { Can we just call this roaming_status. roaming, is_not_roaming in the same code block is getting confusing. > + if (is_not_roaming == 0) > + *roaming = ROAMING_STATUS_ON; > + else > + *roaming = ROAMING_STATUS_OFF; > + } else > + *roaming = ROAMING_STATUS_NO_CHANGE; > > if (!operator) > return true; > @@ -160,16 +171,28 @@ static void ss_info_notify(struct qmi_result *result, void *user_data) > struct ofono_network_time net_time; > struct netreg_data *data = ofono_netreg_get_data(netreg); > int status, lac, cellid, tech; > + enum roaming_status roaming; > > DBG(""); > > if (extract_ss_info_time(result, &net_time)) > ofono_netreg_time_notify(netreg, &net_time); > > - if (!extract_ss_info(result, &status, &lac, &cellid, &tech, > + if (!extract_ss_info(result, &status, &lac, &cellid, &tech, &roaming, > &data->operator)) > return; > > + if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED) { > + if (roaming == ROAMING_STATUS_ON || > + (roaming == ROAMING_STATUS_NO_CHANGE && > + data->is_roaming)) { > + status = NETWORK_REGISTRATION_STATUS_ROAMING; > + data->is_roaming = true; > + } else > + data->is_roaming = false; Can we unwind this complicated logic a bit? Maybe something like: if (roaming == ROAMING_STATUS_ON) data->is_roaming = true; if (data->is_roaming) status = NETWORK_REGISTRATION_STATUS_ROAMING; > + } else > + data->is_roaming = false; > + > ofono_netreg_status_notify(netreg, status, lac, cellid, tech); > } > > @@ -179,6 +202,7 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_data) > ofono_netreg_status_cb_t cb = cbd->cb; > struct netreg_data *data = cbd->user; > int status, lac, cellid, tech; > + enum roaming_status roaming; > > DBG(""); > > @@ -187,12 +211,23 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_data) > return; > } > > - if (!extract_ss_info(result, &status, &lac, &cellid, &tech, > + if (!extract_ss_info(result, &status, &lac, &cellid, &tech, &roaming, > &data->operator)) { > CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, cbd->data); > return; > } > > + if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED) { > + if (roaming == ROAMING_STATUS_ON || > + (roaming == ROAMING_STATUS_NO_CHANGE && > + data->is_roaming)) { > + status = NETWORK_REGISTRATION_STATUS_ROAMING; > + data->is_roaming = true; > + } else > + data->is_roaming = false; > + } else > + data->is_roaming = false; > + > CALLBACK_WITH_SUCCESS(cb, status, lac, cellid, tech, cbd->data); > } > > @@ -580,6 +615,7 @@ static int qmi_netreg_probe(struct ofono_netreg *netreg, > data->operator.tech = -1; > > data->current_rat = QMI_NAS_NETWORK_RAT_NO_CHANGE; > + data->is_roaming = false; > > ofono_netreg_set_data(netreg, data); > > Regards, -Denis ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] qmimodem: fix roaming status report 2017-12-15 17:46 ` Denis Kenzior @ 2017-12-18 9:33 ` Christophe Ronco 2018-09-07 14:29 ` [PATCHV2 0/1] " Christophe Ronco 1 sibling, 0 replies; 7+ messages in thread From: Christophe Ronco @ 2017-12-18 9:33 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 8624 bytes --] Problem seen with a MC7304 modem and a roaming SIM card. Status in org.ofono.NetworkRegistration properties ends up in "registered" instead of roaming. Both AT command and qmicli indicates we are roaming. What's happening is the following: 1) first QMI_NAS_SS_INFO_IND indicating we are registered contains a QMI_NAS_RESULT_ROAMING_STATUS parameter. Parameter inside says we are roaming and qmimidem driver correctly reports status NETWORK_REGISTRATION_STATUS_ROAMING. 2) other QMI_NAS_SS_INFO_IND arrive, saying we are registered without QMI_NAS_RESULT_ROAMING_STATUS parameter. Driver reports NETWORK_REGISTRATION_STATUS_REGISTERED. Extract of traces with QMI binary debug interpreted (as far as I can...): a) first "searching" indication ofonod[855]: QMI: < 01 3b 00 80 03 01 04 00 00 24 00 2f 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 22 05 00 01 02 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_LIMITED, QMI_NAS_NETWORK_SERVICE_DOMAIN_PS, ... 15 03 00 01 08 01 LTE, no roaming 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 01 00 00 10 01 00 01 No roaming 01 06 00 02 02 02 02 01 08 NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, CS detached, PS detached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_LTE ofonod[855]: QMI: NAS_ind msg=36 len=47 [client=1,type=4,tid=0,len=59] ofonod[855]: QMI: {type=41,len=5} {type=34,len=5} {type=21,len=3} {type=18,len=5} ofonod[855]: QMI: {type=17,len=1} {type=16,len=1} {type=1,len=6} ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 2 lac -1 cellid -1 tech 7 b) second "searching" indication ofonod[855]: QMI: < 01 21 00 80 03 01 04 00 00 24 00 15 00 22 05 00 03 03 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_LIMITED_REGIONAL, CS_PS, ... 11 01 00 00 01 06 00 02 02 02 02 01 08 NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, CS detached, PS detached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_LTE ofonod[855]: QMI: NAS_ind msg=36 len=21 [client=1,type=4,tid=0,len=33] ofonod[855]: QMI: {type=34,len=5} {type=17,len=1} {type=1,len=6} c) First indication while "registered" ofonod[855]: QMI: < 01 5e 00 80 03 01 04 00 00 24 00 52 00 2a 01 00 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 28 02 00 15 01 UMTS Primary Scrambling Code 26 08 00 03 00 00 00 03 00 00 00 CS: all calls allowed, PS: all calls allowed 22 05 00 02 03 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_AVAILABLE, CS_PS, ... 1e 04 00 f7 00 95 04 CID 3GPP 1d 02 00 fb 50 LAC 3GPP 15 03 00 01 05 00 UMTS: roaming 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 04 00 03 03 04 05 10 01 00 00 ROAMING ON 01 06 00 01 01 01 02 01 05 NAS_REGISTRATION_STATE_REGISTERED, CS attached, PS attached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_UMTS ofonod[855]: QMI: NAS_ind msg=36 len=82 [client=1,type=4,tid=0,len=94] ofonod[855]: QMI: {type=42,len=1} {type=41,len=5} {type=40,len=2} {type=38,len=8} ofonod[855]: QMI: {type=34,len=5} {type=30,len=4} {type=29,len=2} {type=21,len=3} ofonod[855]: QMI: {type=18,len=5} {type=17,len=4} {type=16,len=1} {type=1,len=6} ofonod[855]: ofono_gprs_status_notify modem /sierra_0 status 1 ==================> ROAMING status reported <========================== ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 5 lac 20731 cellid 76873975 tech 2 d) second indication while "registered" ofonod[855]: QMI: < 01 31 00 80 03 01 04 00 00 24 00 25 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 28 02 00 15 01 UMTS Primary Scrambling Code 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 04 00 03 03 04 05 01 06 00 01 01 01 02 01 05 NAS_REGISTRATION_STATE_REGISTERED, CS attached, PS attached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_UMTS ofonod[855]: QMI: NAS_ind msg=36 len=37 [client=1,type=4,tid=0,len=49] ofonod[855]: QMI: {type=41,len=5} {type=40,len=2} {type=18,len=5} {type=17,len=4} ofonod[855]: QMI: {type=1,len=6} ==================> ROAMING information lost <========================== ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 1 lac -1 cellid -1 tech 2 I can't tell if not having the ROAMING_STATUS parameter in all indication is something happening only on MC7304 or if it happens on all "QMI" modems. --- drivers/qmimodem/network-registration.c | 50 ++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c index 6c1f50b..85de4e1 100644 --- a/drivers/qmimodem/network-registration.c +++ b/drivers/qmimodem/network-registration.c @@ -42,6 +42,13 @@ struct netreg_data { struct qmi_service *nas; struct ofono_network_operator operator; uint8_t current_rat; + bool is_roaming; +}; + +enum roaming_status { + ROAMING_STATUS_OFF, + ROAMING_STATUS_ON, + ROAMING_STATUS_NO_CHANGE, }; static bool extract_ss_info_time( @@ -78,11 +85,12 @@ static bool extract_ss_info_time( static bool extract_ss_info(struct qmi_result *result, int *status, int *lac, int *cellid, int *tech, + enum roaming_status *roaming, struct ofono_network_operator *operator) { const struct qmi_nas_serving_system *ss; const struct qmi_nas_current_plmn *plmn; - uint8_t i, roaming; + uint8_t i, is_not_roaming; uint16_t value16, len, opname_len; uint32_t value32; @@ -105,10 +113,13 @@ static bool extract_ss_info(struct qmi_result *result, int *status, } if (qmi_result_get_uint8(result, QMI_NAS_RESULT_ROAMING_STATUS, - &roaming)) { - if (ss->status == 1 && roaming == 0) - *status = NETWORK_REGISTRATION_STATUS_ROAMING; - } + &is_not_roaming)) { + if (is_not_roaming == 0) + *roaming = ROAMING_STATUS_ON; + else + *roaming = ROAMING_STATUS_OFF; + } else + *roaming = ROAMING_STATUS_NO_CHANGE; if (!operator) return true; @@ -160,16 +171,28 @@ static void ss_info_notify(struct qmi_result *result, void *user_data) struct ofono_network_time net_time; struct netreg_data *data = ofono_netreg_get_data(netreg); int status, lac, cellid, tech; + enum roaming_status roaming; DBG(""); if (extract_ss_info_time(result, &net_time)) ofono_netreg_time_notify(netreg, &net_time); - if (!extract_ss_info(result, &status, &lac, &cellid, &tech, + if (!extract_ss_info(result, &status, &lac, &cellid, &tech, &roaming, &data->operator)) return; + if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED) { + if (roaming == ROAMING_STATUS_ON || + (roaming == ROAMING_STATUS_NO_CHANGE && + data->is_roaming)) { + status = NETWORK_REGISTRATION_STATUS_ROAMING; + data->is_roaming = true; + } else + data->is_roaming = false; + } else + data->is_roaming = false; + ofono_netreg_status_notify(netreg, status, lac, cellid, tech); } @@ -179,6 +202,7 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_data) ofono_netreg_status_cb_t cb = cbd->cb; struct netreg_data *data = cbd->user; int status, lac, cellid, tech; + enum roaming_status roaming; DBG(""); @@ -187,12 +211,23 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_data) return; } - if (!extract_ss_info(result, &status, &lac, &cellid, &tech, + if (!extract_ss_info(result, &status, &lac, &cellid, &tech, &roaming, &data->operator)) { CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, cbd->data); return; } + if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED) { + if (roaming == ROAMING_STATUS_ON || + (roaming == ROAMING_STATUS_NO_CHANGE && + data->is_roaming)) { + status = NETWORK_REGISTRATION_STATUS_ROAMING; + data->is_roaming = true; + } else + data->is_roaming = false; + } else + data->is_roaming = false; + CALLBACK_WITH_SUCCESS(cb, status, lac, cellid, tech, cbd->data); } @@ -580,6 +615,7 @@ static int qmi_netreg_probe(struct ofono_netreg *netreg, data->operator.tech = -1; data->current_rat = QMI_NAS_NETWORK_RAT_NO_CHANGE; + data->is_roaming = false; ofono_netreg_set_data(netreg, data); -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCHV2 0/1] qmimodem: fix roaming status report 2017-12-15 17:46 ` Denis Kenzior 2017-12-18 9:33 ` Christophe Ronco @ 2018-09-07 14:29 ` Christophe Ronco 2018-09-07 14:29 ` [PATCHV2 1/1] " Christophe Ronco 1 sibling, 1 reply; 7+ messages in thread From: Christophe Ronco @ 2018-09-07 14:29 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 517 bytes --] I didn't remember I did only part of the job back in december. Sorry for that. Here is a corrected version of the patch. I saw once with a MC7430 a roaming information coming while not registered. So patch is slightly modified to get roaming status information even if status is not "registered". Christophe Ronco (1): qmimodem: fix roaming status report drivers/qmimodem/network-registration.c | 47 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCHV2 1/1] qmimodem: fix roaming status report 2018-09-07 14:29 ` [PATCHV2 0/1] " Christophe Ronco @ 2018-09-07 14:29 ` Christophe Ronco 2018-09-07 16:34 ` Denis Kenzior 0 siblings, 1 reply; 7+ messages in thread From: Christophe Ronco @ 2018-09-07 14:29 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 9176 bytes --] Problem seen with a MC7304 modem and a roaming SIM card. Status in org.ofono.NetworkRegistration properties ends up in "registered" instead of roaming. Both AT command and qmicli indicates we are roaming. What's happening is the following: 1) first QMI_NAS_SS_INFO_IND indicating we are registered contains a QMI_NAS_RESULT_ROAMING_STATUS parameter. Parameter inside says we are roaming and qmimidem driver correctly reports status NETWORK_REGISTRATION_STATUS_ROAMING. 2) other QMI_NAS_SS_INFO_IND arrive, saying we are registered without QMI_NAS_RESULT_ROAMING_STATUS parameter. Driver reports NETWORK_REGISTRATION_STATUS_REGISTERED. Extract of traces with QMI binary debug interpreted (as far as I can...): a) first "searching" indication ofonod[855]: QMI: < 01 3b 00 80 03 01 04 00 00 24 00 2f 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 22 05 00 01 02 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_LIMITED, QMI_NAS_NETWORK_SERVICE_DOMAIN_PS, ... 15 03 00 01 08 01 LTE, no roaming 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 01 00 00 10 01 00 01 No roaming 01 06 00 02 02 02 02 01 08 NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, CS detached, PS detached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_LTE ofonod[855]: QMI: NAS_ind msg=36 len=47 [client=1,type=4,tid=0,len=59] ofonod[855]: QMI: {type=41,len=5} {type=34,len=5} {type=21,len=3} {type=18,len=5} ofonod[855]: QMI: {type=17,len=1} {type=16,len=1} {type=1,len=6} ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 2 lac -1 cellid -1 tech 7 b) second "searching" indication ofonod[855]: QMI: < 01 21 00 80 03 01 04 00 00 24 00 15 00 22 05 00 03 03 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_LIMITED_REGIONAL, CS_PS, ... 11 01 00 00 01 06 00 02 02 02 02 01 08 NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, CS detached, PS detached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_LTE ofonod[855]: QMI: NAS_ind msg=36 len=21 [client=1,type=4,tid=0,len=33] ofonod[855]: QMI: {type=34,len=5} {type=17,len=1} {type=1,len=6} c) First indication while "registered" ofonod[855]: QMI: < 01 5e 00 80 03 01 04 00 00 24 00 52 00 2a 01 00 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 28 02 00 15 01 UMTS Primary Scrambling Code 26 08 00 03 00 00 00 03 00 00 00 CS: all calls allowed, PS: all calls allowed 22 05 00 02 03 00 01 00 Detailed Service Status: QMI_NAS_SERVICE_STATUS_AVAILABLE, CS_PS, ... 1e 04 00 f7 00 95 04 CID 3GPP 1d 02 00 fb 50 LAC 3GPP 15 03 00 01 05 00 UMTS: roaming 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 04 00 03 03 04 05 10 01 00 00 ROAMING ON 01 06 00 01 01 01 02 01 05 NAS_REGISTRATION_STATE_REGISTERED, CS attached, PS attached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_UMTS ofonod[855]: QMI: NAS_ind msg=36 len=82 [client=1,type=4,tid=0,len=94] ofonod[855]: QMI: {type=42,len=1} {type=41,len=5} {type=40,len=2} {type=38,len=8} ofonod[855]: QMI: {type=34,len=5} {type=30,len=4} {type=29,len=2} {type=21,len=3} ofonod[855]: QMI: {type=18,len=5} {type=17,len=4} {type=16,len=1} {type=1,len=6} ofonod[855]: ofono_gprs_status_notify modem /sierra_0 status 1 ==================> ROAMING status reported <========================== ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 5 lac 20731 cellid 76873975 tech 2 d) second indication while "registered" ofonod[855]: QMI: < 01 31 00 80 03 01 04 00 00 24 00 25 00 29 05 00 d0 00 14 00 00 MCC:208 MNC:20 28 02 00 15 01 UMTS Primary Scrambling Code 12 05 00 d0 00 14 00 00 Current PLMN: MCC:208 MNC:20, no desc 11 04 00 03 03 04 05 01 06 00 01 01 01 02 01 05 NAS_REGISTRATION_STATE_REGISTERED, CS attached, PS attached, NETWORK_TYPE_3GPP, QMI_NAS_RADIO_INTERFACE_UMTS ofonod[855]: QMI: NAS_ind msg=36 len=37 [client=1,type=4,tid=0,len=49] ofonod[855]: QMI: {type=41,len=5} {type=40,len=2} {type=18,len=5} {type=17,len=4} ofonod[855]: QMI: {type=1,len=6} ==================> ROAMING information lost <========================== ofonod[855]: ofono_netreg_status_notify modem /sierra_0 status 1 lac -1 cellid -1 tech 2 I can't tell if not having the ROAMING_STATUS parameter in all indication is something happening only on MC7304 or if it happens on all "QMI" modems. I have also seen (on MC7430, with a roaming SIM card): - first notification indicating status QMI_NAS_REGISTRATION_STATE_SEARCHING and roaming ON - following notifications indicating status QMI_NAS_REGISTRATION_STATE_REGISTERED and no roaming notification So we must handle roaming information even when not registered. --- drivers/qmimodem/network-registration.c | 47 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c index 6c1f50b..a1e3ebc 100644 --- a/drivers/qmimodem/network-registration.c +++ b/drivers/qmimodem/network-registration.c @@ -42,6 +42,13 @@ struct netreg_data { struct qmi_service *nas; struct ofono_network_operator operator; uint8_t current_rat; + bool is_roaming; +}; + +enum roaming_status { + ROAMING_STATUS_OFF, + ROAMING_STATUS_ON, + ROAMING_STATUS_NO_CHANGE, }; static bool extract_ss_info_time( @@ -78,11 +85,12 @@ static bool extract_ss_info_time( static bool extract_ss_info(struct qmi_result *result, int *status, int *lac, int *cellid, int *tech, + enum roaming_status *roaming, struct ofono_network_operator *operator) { const struct qmi_nas_serving_system *ss; const struct qmi_nas_current_plmn *plmn; - uint8_t i, roaming; + uint8_t i, roaming_status; uint16_t value16, len, opname_len; uint32_t value32; @@ -104,10 +112,13 @@ static bool extract_ss_info(struct qmi_result *result, int *status, *tech = qmi_nas_rat_to_tech(ss->radio_if[i]); } + *roaming = ROAMING_STATUS_NO_CHANGE; if (qmi_result_get_uint8(result, QMI_NAS_RESULT_ROAMING_STATUS, - &roaming)) { - if (ss->status == 1 && roaming == 0) - *status = NETWORK_REGISTRATION_STATUS_ROAMING; + &roaming_status)) { + if (roaming_status == 0) + *roaming = ROAMING_STATUS_ON; + else if (roaming_status == 1) + *roaming = ROAMING_STATUS_OFF; } if (!operator) @@ -149,7 +160,8 @@ static bool extract_ss_info(struct qmi_result *result, int *status, else *cellid = -1; - DBG("lac %d cellid %d tech %d", *lac, *cellid, *tech); + DBG("roaming %u lac %d cellid %d tech %d", *roaming, *lac, *cellid, + *tech); return true; } @@ -160,16 +172,26 @@ static void ss_info_notify(struct qmi_result *result, void *user_data) struct ofono_network_time net_time; struct netreg_data *data = ofono_netreg_get_data(netreg); int status, lac, cellid, tech; + enum roaming_status roaming; DBG(""); if (extract_ss_info_time(result, &net_time)) ofono_netreg_time_notify(netreg, &net_time); - if (!extract_ss_info(result, &status, &lac, &cellid, &tech, + if (!extract_ss_info(result, &status, &lac, &cellid, &tech, &roaming, &data->operator)) return; + if (roaming == ROAMING_STATUS_ON) + data->is_roaming = true; + else if (roaming == ROAMING_STATUS_OFF) + data->is_roaming = false; + + if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED && + data->is_roaming) + status = NETWORK_REGISTRATION_STATUS_ROAMING; + ofono_netreg_status_notify(netreg, status, lac, cellid, tech); } @@ -179,6 +201,7 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_data) ofono_netreg_status_cb_t cb = cbd->cb; struct netreg_data *data = cbd->user; int status, lac, cellid, tech; + enum roaming_status roaming; DBG(""); @@ -187,12 +210,21 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_data) return; } - if (!extract_ss_info(result, &status, &lac, &cellid, &tech, + if (!extract_ss_info(result, &status, &lac, &cellid, &tech, &roaming, &data->operator)) { CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, cbd->data); return; } + if (roaming == ROAMING_STATUS_ON) + data->is_roaming = true; + else if (roaming == ROAMING_STATUS_OFF) + data->is_roaming = false; + + if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED && + data->is_roaming) + status = NETWORK_REGISTRATION_STATUS_ROAMING; + CALLBACK_WITH_SUCCESS(cb, status, lac, cellid, tech, cbd->data); } @@ -580,6 +612,7 @@ static int qmi_netreg_probe(struct ofono_netreg *netreg, data->operator.tech = -1; data->current_rat = QMI_NAS_NETWORK_RAT_NO_CHANGE; + data->is_roaming = false; ofono_netreg_set_data(netreg, data); -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCHV2 1/1] qmimodem: fix roaming status report 2018-09-07 14:29 ` [PATCHV2 1/1] " Christophe Ronco @ 2018-09-07 16:34 ` Denis Kenzior 0 siblings, 0 replies; 7+ messages in thread From: Denis Kenzior @ 2018-09-07 16:34 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 327 bytes --] Hi Christophe, On 09/07/2018 09:29 AM, Christophe Ronco wrote: > Problem seen with a MC7304 modem and a roaming SIM card. > Status in org.ofono.NetworkRegistration properties ends up in "registered" > instead of roaming. Both AT command and qmicli indicates we are roaming. > Applied, thanks. Regards, -Denis ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-09-07 16:34 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-12-15 10:28 [PATCH] qmimodem: fix roaming status report Christophe Ronco 2017-12-15 10:28 ` Christophe Ronco 2017-12-15 17:46 ` Denis Kenzior 2017-12-18 9:33 ` Christophe Ronco 2018-09-07 14:29 ` [PATCHV2 0/1] " Christophe Ronco 2018-09-07 14:29 ` [PATCHV2 1/1] " Christophe Ronco 2018-09-07 16:34 ` 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.