Hi Denis,

Den tors 15 aug. 2019 kl 22:41 skrev Denis Kenzior <denkenz@gmail.com>:
Hi Richard,

On 8/14/19 1:24 PM, richard.rojfors@gmail.com wrote:
> From: Richard Röjfors <richard@puffinpack.se>
>
> Since its registered context is a condition for being attached
> when running LTE, we might need to update the attached state
> when a context is deactivated. Otherwise we might remain

Well, by definition if we're on LTE then we're attached.  So I'm not
quite sure what you mean here?

OK, maybe this is overkill. And about the order things are happening in reporting from the modem.
 

> attached, and connection managers (at least connman) start
> to hammer us to connect a context, eventhough it happens
> automatically in LTE.

What happens automatically?  Yes, it is true that you need a default
context to attach to LTE.  So activating a context is basically a part
of the LTE attach procedure.

But that default context does not need to be an internet context (e.g.
Verizon uses (or used to) use an ims context for this). So ConnMan still
might need to activate an Internet context even if we're on LTE.

To do that wouldn't we need to be able to flag attached even without
registered context for LTE?
Or will the modem not attach to 4G until the context is configured?
I can not test that case with my modems.


I'm also not sure that the heuristic of 0 active contexts means not
attached is a good one.  Shouldn't you be using +CREG or +CEREG status
for this?

As you say that is probably more correct :)
First I wanted to get things running with the current solution which uses an active
context as condition.
 

> ---
>   src/gprs.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/src/gprs.c b/src/gprs.c
> index 94d13f82..cb31e2d2 100644
> --- a/src/gprs.c
> +++ b/src/gprs.c
> @@ -2738,11 +2738,12 @@ void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
>        * If "Attached" property was about to be signalled as TRUE but there
>        * were still active contexts, try again to signal "Attached" property
>        * to registered applications after active contexts have been released.
> +      *
> +      * ... or in the case of LTE where the attached state were a registered
> +      * context is a condition for being attached
>        */
> -     if (gc->gprs->flags & GPRS_FLAG_ATTACHED_UPDATE) {
> -             gc->gprs->flags &= ~GPRS_FLAG_ATTACHED_UPDATE;
> -             gprs_attached_update(gc->gprs);
> -     }
> +     gc->gprs->flags &= ~GPRS_FLAG_ATTACHED_UPDATE;
> +     gprs_attached_update(gc->gprs);
>   }
>   
>   int ofono_gprs_context_driver_register(
>

Regards,
-Denis