Correct connection sequence to maximize chances of e.g.: getting connected :)

Aleksander Morgado aleksander at aleksander.es
Wed Apr 22 14:07:28 UTC 2020


Hey Enrico!

>
> So, I was following this ML lately, to notice I am not the only one having the issue of modem not being able to establish a connection sometimes, with errors like "Call failed".
> I seen that error many times. I will for sure need to dig deeper into this, but my question was more generic, like:
> what's the proper sequence one has to follow to maximize chances of "resetting" the modemstate so that it can get connected with a given configuration?
> My following flow of actions looks as follows: (-> = modem transitions from "lower" to "higher" state, >- = modem transitions from "higher" to "lower" state, - = action being taken, * = initial state)
> * the modem is in "locked" state:
>          - try to unlock it
> -> modem is in disabled state
>         - if software isn't exiting, then:
>                  - delete all of the bearers pertaining to this modem

There should be no need to delete all bearers at this point I'd say,
unless you want to recreate over and over the same ones all the time.
What you should do instead is; create them if they don't exist, and
then *reuse* them for connecting and reconnecting, without deleting
them. That is what the "Simple" interface already does when you want
to use one single bearer object.

>                  - enable modem
> -> modem enabled
>         - here one may wait for the modem to get registered, as it happens normally; however, sometimes, explicitly asking the modem to register seems to be needed
>         - if no bearers exist at this time, then create all configured bearers, and start a periodic checker that connects created bearers
> >- modem enabled
>         - here one may wait for the modem to get registered, as it happens normally; however, sometimes, explicitly asking the modem to register seems to be needed
> -> modem connected
>         - we are happy
>

In 3GPP modems the registration phase once the modem is enabled is
automatic. You may sometimes find times when it takes longer to
register, e.g. when switching from one network to another and such,
but that should always end up with the modem registered at some point.
If it isn't, I think this is something to debug at modem protocol
level I'd say. A different thing is if you've configured the modem for
"manual" registration, in that case, you definitely need to keep using
manual registration if e.g. you're switching between roaming networks
and such.

Other than that, the sequence is quite equivalent to what we already
do in the Simple interface.

> I added the bearer checker because I found no way to be able to unref objects in cases where the modem may be removed in some cases.
>

This checker shouldn't be needed. If the modem goes away, all its
references should also go away, along with all bearer objects it
owned. If you can reproduce a case where this is not happening, please
let me know and I'll debug it.

> What I can observe is that, even for the same model of modem module, in some cases all goes as expected and connection comes up in the first attempt, or in one of the first 2 / 3 attempts.
> In some other cases, I get a storm of "CallFailed" errors, and simply can't bring up the connection unless:
> a - i reset the modem via mmcli
> b - just wait

Well, it all depends on the exact "CallFailed" error you're having. It
may very well be some internal modem error or some other thing.
Resetting the modem via mmcli will do a full IMSI detach and re-attach
from the network as well, and that would also solve errors that may
happen in the current session you had with the network. Without
knowing the exact error codes returned during the call failure, hard
to say what happened. I assume you're using a QMI modem, so please
update to libqmi 1.24.10 in order to get a bunch of new list of QMI
error codes supported.

>
> We went as far as getting QMI message timeouts in some cases, but that's another problem.

In which QMI commands did you have the timeouts?

> What's the best strategy to connect a modem as per user configuration when we "get" one visible in ModemManager?

Using NetworkManager? NM takes care of all that process, keeping the
connection settings as NM profiles. Is this not working for you?

> My phone is able to do this all of the time, judging from it's speed, so why can't we? :)

Well, we can. You're showcasing problems in the connection logic, but
as far as I can tell the reason for your connection failures are "Call
Failed" errors from the modem. We would need to get into detail of
those errors, to see what kind of errors they are.

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list