All of lore.kernel.org
 help / color / mirror / Atom feed
* qmimodems: netreg properties CellId and LocationAreaCode sometimes not present
@ 2019-06-20 10:18 Christophe Ronco
  2019-06-20 16:20 ` Denis Kenzior
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe Ronco @ 2019-06-20 10:18 UTC (permalink / raw)
  To: ofono

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

Hi,

With qmi modems I am using (quectel EG25, sierra MC7304), sometimes I
don't have CellId and LocationAreaCode properties in netreg properties
while I am registered. Example:

root(a)klk-wiis-020001:~ # dbus-send --system --type=method_call
--print-reply --dest=org.ofono /quectelqmi_0
org.ofono.NetworkRegistration.GetProperties
method return time=1561022820.781396 sender=:1.8 -> destination=:1.25
serial=96 reply_serial=2
   array [
      dict entry(
         string "Status"
         variant             string "registered"
      )
      dict entry(
         string "Mode"
         variant             string "auto"
      )
      dict entry(
         string "Technology"
         variant             string "lte"
      )
      dict entry(
         string "MobileCountryCode"
         variant             string "208"
      )
      dict entry(
         string "MobileNetworkCode"
         variant             string "10"
      )
      dict entry(
         string "Name"
         variant             string "SFR"
      )
      dict entry(
         string "Strength"
         variant             byte 40
      )
   ]


CellId and LocationAreaCode come from Current serving system info
indication in QMI protocol. These indications contains many parameters
and most of them are optional. What's happening here is:

 - first serving system info indication indicates modem is registered,
gives CellId and LAC

 - another serving system info indication indicates modem is
registered,and give no information on CellId and LAC


When the second indication is processed, ofono_netreg_status_notify is
called with lac and cellid equal to -1. As a consequence, corresponding
NetworkRegistration properties are removed.


Here are traces from ofono when problem occurs:

2019-06-20T09:22:43.709727+00:00 klk-wiis-020001 ofonod[736]: oFono
version 1.24
2019-06-20T09:22:45.683101+00:00 klk-wiis-020001 ofonod[736]:
ofono_sim_register /quectelqmi_0 isPresent:0
2019-06-20T09:22:45.684212+00:00 klk-wiis-020001 ofonod[736]:
sim_inserted_update modem /quectelqmi_0 isPresent:1
2019-06-20T09:22:45.685682+00:00 klk-wiis-020001 ofonod[736]: Interface
org.ofono.AllowedAccessPoints not found on the interface_list
2019-06-20T09:22:45.778324+00:00 klk-wiis-020001 ofonod[736]: Requested
file structure differs from SIM: 6fb7
2019-06-20T09:22:46.258948+00:00 klk-wiis-020001 ofonod[736]:
sim_inserted_update modem /quectelqmi_0 isPresent:0
2019-06-20T09:22:46.260482+00:00 klk-wiis-020001 ofonod[736]: Interface
org.ofono.AllowedAccessPoints not found on the interface_list
2019-06-20T09:22:46.898106+00:00 klk-wiis-020001 ofonod[736]:
sim_inserted_update modem /quectelqmi_0 isPresent:1
2019-06-20T09:22:46.899788+00:00 klk-wiis-020001 ofonod[736]: Interface
org.ofono.AllowedAccessPoints not found on the interface_list
2019-06-20T09:22:47.155130+00:00 klk-wiis-020001 ofonod[736]: Requested
file structure differs from SIM: 6fb7
2019-06-20T09:22:48.626979+00:00 klk-wiis-020001 ofonod[736]: Unable to
read waiting messages numbers from SIM
2019-06-20T09:22:48.818950+00:00 klk-wiis-020001 ofonod[736]: Unable to
read mailbox identifies from SIM
2019-06-20T09:22:48.915000+00:00 klk-wiis-020001 ofonod[736]:
ofono_netreg_status_notify modem /quectelqmi_0 status 2 lac -1 cellid -1
tech -1
2019-06-20T09:22:48.947207+00:00 klk-wiis-020001 ofonod[736]:
ofono_gprs_status_notify modem /quectelqmi_0 status 0
2019-06-20T09:22:49.010982+00:00 klk-wiis-020001 ofonod[736]:
ofono_netreg_status_notify modem /quectelqmi_0 status 2 lac -1 cellid -1
tech 7
2019-06-20T09:22:49.714986+00:00 klk-wiis-020001 ofonod[736]:
ofono_netreg_status_notify modem /quectelqmi_0 status 1 lac 65534 cellid
1076227 tech 7
2019-06-20T09:22:49.717442+00:00 klk-wiis-020001 ofonod[736]: CRO
set_registration_cellid netreg->cellid: -1 ci: 1076227
2019-06-20T09:22:49.721963+00:00 klk-wiis-020001 ofonod[736]:
ofono_gprs_status_notify modem /quectelqmi_0 status 1
2019-06-20T09:22:49.724312+00:00 klk-wiis-020001 ofonod[736]: CRO
network_get_properties netreg->cellid: 1076227
2019-06-20T09:22:49.779005+00:00 klk-wiis-020001 ofonod[736]:
ofono_netreg_status_notify modem /quectelqmi_0 status 1 lac -1 cellid -1
tech 7
2019-06-20T09:22:49.779508+00:00 klk-wiis-020001 ofonod[736]: CRO
set_registration_cellid netreg->cellid: 1076227 ci: -1
2019-06-20T09:26:46.610671+00:00 klk-wiis-020001 ofonod[736]: CRO
network_get_properties netreg->cellid: -1


I see two ways to fix this problem:

1) modify QMI modem driver to remember LAC and CellId inside the driver.
When a notification arrives without CellId or LAC information, use
remembered information. The drawback of this solution is that these
information are remembered twice: in driver and in core.

2) modify core to add a way for drivers to say that these parameters are
not modified. The drawback of this solution is that it is a change in
core (even a change in core interface with drivers)


I assume that solution 1 is better of this problem is for QMI modems
only. I assume that solution 2 is better if some other drivers can have
the same kind of problems.

What do you think? How should I fix this problem? Will a change in
driver/core interface be helpful?


Best Regards,


Christophe Ronco




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

* Re: qmimodems: netreg properties CellId and LocationAreaCode sometimes not present
  2019-06-20 10:18 qmimodems: netreg properties CellId and LocationAreaCode sometimes not present Christophe Ronco
@ 2019-06-20 16:20 ` Denis Kenzior
  2019-07-17 13:29   ` [PATCH 1/1] qmimodem: remember lac and cellid Christophe Ronco
  0 siblings, 1 reply; 4+ messages in thread
From: Denis Kenzior @ 2019-06-20 16:20 UTC (permalink / raw)
  To: ofono

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

Hi Christophe,

On 06/20/2019 05:18 AM, Christophe Ronco wrote:
> Hi,
> 
> With qmi modems I am using (quectel EG25, sierra MC7304), sometimes I
> don't have CellId and LocationAreaCode properties in netreg properties
> while I am registered. Example:
> 
> root(a)klk-wiis-020001:~ # dbus-send --system --type=method_call
> --print-reply --dest=org.ofono /quectelqmi_0
> org.ofono.NetworkRegistration.GetProperties
> method return time=1561022820.781396 sender=:1.8 -> destination=:1.25
> serial=96 reply_serial=2
>     array [
>        dict entry(
>           string "Status"
>           variant             string "registered"
>        )
>        dict entry(
>           string "Mode"
>           variant             string "auto"
>        )
>        dict entry(
>           string "Technology"
>           variant             string "lte"
>        )
>        dict entry(
>           string "MobileCountryCode"
>           variant             string "208"
>        )
>        dict entry(
>           string "MobileNetworkCode"
>           variant             string "10"
>        )
>        dict entry(
>           string "Name"
>           variant             string "SFR"
>        )
>        dict entry(
>           string "Strength"
>           variant             byte 40
>        )
>     ]
> 
> 
> CellId and LocationAreaCode come from Current serving system info
> indication in QMI protocol. These indications contains many parameters
> and most of them are optional. What's happening here is:
> 
>   - first serving system info indication indicates modem is registered,
> gives CellId and LAC
> 
>   - another serving system info indication indicates modem is
> registered,and give no information on CellId and LAC
> 
> 
> When the second indication is processed, ofono_netreg_status_notify is
> called with lac and cellid equal to -1. As a consequence, corresponding
> NetworkRegistration properties are removed.
> 
> 
> Here are traces from ofono when problem occurs:
> 
> 2019-06-20T09:22:43.709727+00:00 klk-wiis-020001 ofonod[736]: oFono
> version 1.24
> 2019-06-20T09:22:45.683101+00:00 klk-wiis-020001 ofonod[736]:
> ofono_sim_register /quectelqmi_0 isPresent:0
> 2019-06-20T09:22:45.684212+00:00 klk-wiis-020001 ofonod[736]:
> sim_inserted_update modem /quectelqmi_0 isPresent:1
> 2019-06-20T09:22:45.685682+00:00 klk-wiis-020001 ofonod[736]: Interface
> org.ofono.AllowedAccessPoints not found on the interface_list
> 2019-06-20T09:22:45.778324+00:00 klk-wiis-020001 ofonod[736]: Requested
> file structure differs from SIM: 6fb7
> 2019-06-20T09:22:46.258948+00:00 klk-wiis-020001 ofonod[736]:
> sim_inserted_update modem /quectelqmi_0 isPresent:0
> 2019-06-20T09:22:46.260482+00:00 klk-wiis-020001 ofonod[736]: Interface
> org.ofono.AllowedAccessPoints not found on the interface_list
> 2019-06-20T09:22:46.898106+00:00 klk-wiis-020001 ofonod[736]:
> sim_inserted_update modem /quectelqmi_0 isPresent:1
> 2019-06-20T09:22:46.899788+00:00 klk-wiis-020001 ofonod[736]: Interface
> org.ofono.AllowedAccessPoints not found on the interface_list
> 2019-06-20T09:22:47.155130+00:00 klk-wiis-020001 ofonod[736]: Requested
> file structure differs from SIM: 6fb7
> 2019-06-20T09:22:48.626979+00:00 klk-wiis-020001 ofonod[736]: Unable to
> read waiting messages numbers from SIM
> 2019-06-20T09:22:48.818950+00:00 klk-wiis-020001 ofonod[736]: Unable to
> read mailbox identifies from SIM
> 2019-06-20T09:22:48.915000+00:00 klk-wiis-020001 ofonod[736]:
> ofono_netreg_status_notify modem /quectelqmi_0 status 2 lac -1 cellid -1
> tech -1
> 2019-06-20T09:22:48.947207+00:00 klk-wiis-020001 ofonod[736]:
> ofono_gprs_status_notify modem /quectelqmi_0 status 0
> 2019-06-20T09:22:49.010982+00:00 klk-wiis-020001 ofonod[736]:
> ofono_netreg_status_notify modem /quectelqmi_0 status 2 lac -1 cellid -1
> tech 7
> 2019-06-20T09:22:49.714986+00:00 klk-wiis-020001 ofonod[736]:
> ofono_netreg_status_notify modem /quectelqmi_0 status 1 lac 65534 cellid
> 1076227 tech 7
> 2019-06-20T09:22:49.717442+00:00 klk-wiis-020001 ofonod[736]: CRO
> set_registration_cellid netreg->cellid: -1 ci: 1076227
> 2019-06-20T09:22:49.721963+00:00 klk-wiis-020001 ofonod[736]:
> ofono_gprs_status_notify modem /quectelqmi_0 status 1
> 2019-06-20T09:22:49.724312+00:00 klk-wiis-020001 ofonod[736]: CRO
> network_get_properties netreg->cellid: 1076227
> 2019-06-20T09:22:49.779005+00:00 klk-wiis-020001 ofonod[736]:
> ofono_netreg_status_notify modem /quectelqmi_0 status 1 lac -1 cellid -1
> tech 7
> 2019-06-20T09:22:49.779508+00:00 klk-wiis-020001 ofonod[736]: CRO
> set_registration_cellid netreg->cellid: 1076227 ci: -1
> 2019-06-20T09:26:46.610671+00:00 klk-wiis-020001 ofonod[736]: CRO
> network_get_properties netreg->cellid: -1
> 
> 
> I see two ways to fix this problem:
> 
> 1) modify QMI modem driver to remember LAC and CellId inside the driver.
> When a notification arrives without CellId or LAC information, use
> remembered information. The drawback of this solution is that these
> information are remembered twice: in driver and in core.

This is the preferred solution...

> 
> 2) modify core to add a way for drivers to say that these parameters are
> not modified. The drawback of this solution is that it is a change in
> core (even a change in core interface with drivers)
> 
> 
> I assume that solution 1 is better of this problem is for QMI modems
> only. I assume that solution 2 is better if some other drivers can have
> the same kind of problems.
> 
> What do you think? How should I fix this problem? Will a change in
> driver/core interface be helpful?

The general rule is that oFono follows 27.007 interface whenever 
possible.  Any deviations from 'idealized' 27.007 behavior have to be 
handled by the driver.

27.007 is generally understood to always include lac/ci on all updates, 
so I think qmimodem is stuck caching the lac/ci info if the firmware 
doesn't provide it in all cases.

Regards,
-Denis

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

* [PATCH 1/1] qmimodem: remember lac and cellid
  2019-06-20 16:20 ` Denis Kenzior
@ 2019-07-17 13:29   ` Christophe Ronco
  2019-07-19  6:20     ` Denis Kenzior
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe Ronco @ 2019-07-17 13:29 UTC (permalink / raw)
  To: ofono

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

Lac and cellid information are optional in ss_info notifications.
Remember them in order to give a correct information each time a
notification is received.
---
 drivers/qmimodem/network-registration.c | 53 ++++++++++++++++++++++-----------
 1 file changed, 35 insertions(+), 18 deletions(-)

diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c
index 1fccb57..04f20c6 100644
--- a/drivers/qmimodem/network-registration.c
+++ b/drivers/qmimodem/network-registration.c
@@ -42,6 +42,8 @@ struct netreg_data {
 	struct qmi_service *nas;
 	struct ofono_network_operator operator;
 	uint8_t current_rat;
+	int lac;
+	int cellid;
 	bool is_roaming;
 };
 
@@ -166,6 +168,31 @@ static bool extract_ss_info(struct qmi_result *result, int *status,
 	return true;
 }
 
+static int remember_ss_info(struct netreg_data *data, int status, int lac,
+					int cellid, enum roaming_status roaming)
+{
+	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) {
+		if (lac >= 0)
+			data->lac = lac;
+		if (cellid >= 0)
+			data->cellid = cellid;
+	} else {
+		data->lac = -1;
+		data->cellid = -1;
+	}
+
+	if (status == QMI_NAS_REGISTRATION_STATE_REGISTERED &&
+							data->is_roaming)
+		status = NETWORK_REGISTRATION_STATUS_ROAMING;
+
+	return status;
+}
+
 static void ss_info_notify(struct qmi_result *result, void *user_data)
 {
 	struct ofono_netreg *netreg = user_data;
@@ -183,16 +210,10 @@ static void ss_info_notify(struct qmi_result *result, void *user_data)
 							&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;
+	status = remember_ss_info(data, status, lac, cellid, roaming);
 
-	ofono_netreg_status_notify(netreg, status, lac, cellid, tech);
+	ofono_netreg_status_notify(netreg, status, data->lac, data->cellid,
+									tech);
 }
 
 static void get_ss_info_cb(struct qmi_result *result, void *user_data)
@@ -216,16 +237,10 @@ static void get_ss_info_cb(struct qmi_result *result, void *user_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;
+	status = remember_ss_info(data, status, lac, cellid, roaming);
 
-	CALLBACK_WITH_SUCCESS(cb, status, lac, cellid, tech, cbd->data);
+	CALLBACK_WITH_SUCCESS(cb, status, data->lac, data->cellid, tech,
+								cbd->data);
 }
 
 static void qmi_registration_status(struct ofono_netreg *netreg,
@@ -613,6 +628,8 @@ static int qmi_netreg_probe(struct ofono_netreg *netreg,
 
 	data->current_rat = QMI_NAS_NETWORK_RAT_NO_CHANGE;
 	data->is_roaming = false;
+	data->lac = -1;
+	data->cellid = -1;
 
 	ofono_netreg_set_data(netreg, data);
 
-- 
2.7.4


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

* Re: [PATCH 1/1] qmimodem: remember lac and cellid
  2019-07-17 13:29   ` [PATCH 1/1] qmimodem: remember lac and cellid Christophe Ronco
@ 2019-07-19  6:20     ` Denis Kenzior
  0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2019-07-19  6:20 UTC (permalink / raw)
  To: ofono

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

Hi Christophe,

On 7/17/19 8:29 AM, Christophe Ronco wrote:
> Lac and cellid information are optional in ss_info notifications.
> Remember them in order to give a correct information each time a
> notification is received.
> ---
>   drivers/qmimodem/network-registration.c | 53 ++++++++++++++++++++++-----------
>   1 file changed, 35 insertions(+), 18 deletions(-)
> 

Applied, thanks.

Regards,
-Denis


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

end of thread, other threads:[~2019-07-19  6:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 10:18 qmimodems: netreg properties CellId and LocationAreaCode sometimes not present Christophe Ronco
2019-06-20 16:20 ` Denis Kenzior
2019-07-17 13:29   ` [PATCH 1/1] qmimodem: remember lac and cellid Christophe Ronco
2019-07-19  6:20     ` 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.