* Re: [PATCH] gprs: deattach driver when gprs status indicates unregistered
2019-09-17 21:48 [PATCH] gprs: deattach driver when gprs status indicates unregistered richard.rojfors
@ 2019-09-17 21:56 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
2019-09-20 14:58 ` Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Richard =?unknown-8bit?q?R=C3=B6jfors?= @ 2019-09-17 21:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 6236 bytes --]
...and a log for this:
Got deregistered
Sep 17 20:02:22 daemon.info: Aux: < \r\n+CREG: 0\r\n
Sep 17 20:02:22 daemon.debug:
../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1
lac -1 ci -1
Sep 17 20:02:22 daemon.debug:
../git/src/network.c:current_operator_callback() 0x1bb4360, 0x1bb6ae0
Sep 17 20:02:22 daemon.debug: ../git/src/gprs.c:netreg_status_changed() 0
(unregistered)
Sep 17 20:02:22 daemon.debug: ../git/src/gprs.c:gprs_netreg_update()
attach: 0, driver_attached: 1
Sep 17 20:02:22 daemon.debug: ../git/src/gprs.c:netreg_status_changed() 0
(unregistered)
Sep 17 20:02:22 daemon.debug: ../git/src/gprs.c:gprs_netreg_update()
attach: 0, driver_attached: 0
Sep 17 20:02:22 daemon.info: Aux: > AT\r
Sep 17 20:02:22 daemon.info: Aux: < \r\n+CIEV: 7,0\r\n
Sep 17 20:02:22 daemon.info: Aux: < \r\nOK\r\n
Sep 17 20:02:22 daemon.info: Aux: Finally woke up the modem
Sep 17 20:02:22 daemon.info: Aux: > AT+CGATT=0\r
Sep 17 20:02:22 daemon.info: Aux: < \r\n+CME ERROR: 148\r\n
Detach failed - driver_attached is set to 1 again
Sep 17 20:02:22 daemon.debug: ../git/src/gprs.c:gprs_attach_callback()
/ublox_0 error = 1
Sep 17 20:02:22 daemon.info: Aux: > AT+CGREG?\r
Sep 17 20:02:22 daemon.info: Aux: < \r\n+CGREG: 4\r\n
Sep 17 20:02:22 daemon.info: Aux: < \r\n+UREG: 0\r\n
Sep 17 20:02:22 daemon.info: Aux: < \r\n+CIEV: 9,1\r\n
Sep 17 20:02:22 daemon.info: Aux: < \r\n+CGREG: 2,4\r\n
Sep 17 20:02:22 daemon.info: Aux: < \r\nOK\r\n
Sep 17 20:02:22 daemon.debug: ../git/src/gprs.c:registration_status_cb()
/ublox_0 error 0 status 4
We read back the registration status, but does not set the driver_attached
to 0
Sep 17 20:02:22 daemon.debug: ../git/src/gprs.c:ofono_gprs_status_notify()
/ublox_0 status unknown (4)
Sep 17 20:02:22 daemon.debug:
../git/src/gprs.c:gprs_set_attached_property() 0x1bb1500 1 -> 0
Sep 17 20:02:33 daemon.info: Aux: < \r\n+CREG: 0\r\n
Sep 17 20:02:33 daemon.debug:
../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1
lac -1 ci -1
Sep 17 20:02:33 daemon.debug:
../git/src/network.c:current_operator_callback() 0x1bb4360, (nil)
Sep 17 20:02:33 daemon.debug: ../git/src/gprs.c:netreg_status_changed() 0
(unregistered)
Sep 17 20:02:33 daemon.debug: ../git/src/gprs.c:gprs_netreg_update()
attach: 0, driver_attached: 1
We still believe the driver is attached, trying to detach again
Sep 17 20:02:33 daemon.info: Aux: > AT\r
Sep 17 20:02:33 daemon.info: Aux: < \r\nOK\r\n
Sep 17 20:02:33 daemon.info: Aux: Finally woke up the modem
Sep 17 20:02:33 daemon.info: Aux: > AT+CGATT=0\r
Sep 17 20:05:33 daemon.info: Aux: < \r\n+CME ERROR: 2000\r\n
Detach failed again, setting back driver_attached to 1
Sep 17 20:05:33 daemon.debug: ../git/src/gprs.c:gprs_attach_callback()
/ublox_0 error = 1
Sep 17 20:05:33 daemon.info: Aux: > AT\r
Sep 17 20:05:33 daemon.info: Aux: < \r\nOK\r\n
Sep 17 20:05:33 daemon.info: Aux: Finally woke up the modem
Sep 17 20:05:33 daemon.info: Aux: > AT+CGREG?\r
Sep 17 20:05:33 daemon.info: Aux: < \r\n+CGREG: 2,4\r\n
Sep 17 20:05:33 daemon.info: Aux: < \r\nOK\r\n
Sep 17 20:05:33 daemon.debug: ../git/src/gprs.c:registration_status_cb()
/ublox_0 error 0 status 4
We still do not set driver_attached to 0, even CREG says unknown status
Sep 17 20:05:33 daemon.debug: ../git/src/gprs.c:ofono_gprs_status_notify()
/ublox_0 status unknown (4)
Sep 17 20:05:33 daemon.info: Aux: < \r\n+CTZE: +08,1,"19/09/17,22:02:36"\r\n
Sep 17 20:05:33 daemon.info: Aux: < \r\n+CREG: 5,"0000","00000010",2\r\n
Sep 17 20:05:33 daemon.debug:
../git/drivers/ubloxmodem/network-registration.c:ctze_notify() tz +08 dst 1
time 19/09/17,22:02:36
Sep 17 20:05:33 daemon.debug:
../git/src/network.c:ofono_netreg_time_notify() net time 2019-09-17
22:02:36 utcoff 7200 dst 1
Sep 17 20:05:33 daemon.debug:
../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 5 tech 2
lac 0 ci 16
Sep 17 20:05:33 daemon.debug: ../git/src/gprs.c:netreg_status_changed() 5
(roaming)
Sep 17 20:05:33 daemon.debug: ../git/src/gprs.c:gprs_netreg_update()
attach: 1, driver_attached: 1
We now got registered, but we believe the driver is attached, so no action
is taken and the driver will not be attached...
and the Attached D-Bus property will remain False.
--Richard
Den tis 17 sep. 2019 kl 23:48 skrev <richard.rojfors@gmail.com>:
> From: Richard Röjfors <richard@puffinpack.se>
>
> In the same way as we consider the driver attached when the
> gprs status indicates we are registered, we should consider
> it deattached when the status indicates unregistration.
>
> If we don't, then we would not always recover from the case
> when deattaching the driver fails. We would just revert back
> the driver attached status to true, and "ignore" if the status
> indicates the opposite when we check the registration status
> afterwards.
> ---
> src/gprs.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/gprs.c b/src/gprs.c
> index de172979..c7b181f5 100644
> --- a/src/gprs.c
> +++ b/src/gprs.c
> @@ -2568,12 +2568,6 @@ void ofono_gprs_status_notify(struct ofono_gprs
> *gprs, int status)
>
> gprs->status = status;
>
> - if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
> - status != NETWORK_REGISTRATION_STATUS_ROAMING) {
> - gprs_attached_update(gprs);
> - return;
> - }
> -
> /*
> * If we're already taking action, e.g. attaching or detaching,
> then
> * ignore this notification for now, we will take appropriate
> action
> @@ -2582,6 +2576,12 @@ void ofono_gprs_status_notify(struct ofono_gprs
> *gprs, int status)
> if (gprs->flags & GPRS_FLAG_ATTACHING)
> return;
>
> + if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
> + status != NETWORK_REGISTRATION_STATUS_ROAMING) {
> + ofono_gprs_detached_notify(gprs);
> + return;
> + }
> +
> /* We registered without being powered */
> if (gprs->powered == FALSE)
> goto detach;
> --
> 2.20.1
>
>
[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 8114 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] gprs: deattach driver when gprs status indicates unregistered
2019-09-17 21:48 [PATCH] gprs: deattach driver when gprs status indicates unregistered richard.rojfors
2019-09-17 21:56 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
@ 2019-09-20 14:58 ` Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2019-09-20 14:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 726 bytes --]
Hi Richard,
On 9/17/19 4:48 PM, richard.rojfors(a)gmail.com wrote:
> From: Richard Röjfors <richard@puffinpack.se>
>
> In the same way as we consider the driver attached when the
> gprs status indicates we are registered, we should consider
> it deattached when the status indicates unregistration.
>
> If we don't, then we would not always recover from the case
> when deattaching the driver fails. We would just revert back
> the driver attached status to true, and "ignore" if the status
> indicates the opposite when we check the registration status
> afterwards.
> ---
> src/gprs.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
Applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread