Missing error message when connecting with invalid APN

Aleksander Morgado aleksander at aleksander.es
Wed Jun 26 08:49:22 UTC 2019


> I’m currently using ModemManager 1.6.10 on Ubuntu 16.04 server, on a system without user interaction. The modem is unlocked and enabled based on a configuration in a database.
> I tried to set an invalid APN on a modem to see if this error situation easily could be reported back to my database, but I can’t find any good error messages from ModemManager that I can use.
> The modem is in enabled state (as expected), but  MMModemStateFailedReason is MM_MODEM_STATE_FAILED_REASON_NONE. I had hoped for something like SIM_ERROR or even better, a message telling that the APN is invalid.

The MMModemStateFailedReason is exclusively used only when the modem
is reported to be in "failed" state, i.e. when the modem is completely
unusable by ModemManager. This property wouldn't apply to your use

> Is this maybe solved in newer versions of MM? Or can I extract this error from somewhere else?

If you are using a wrong APN, you will get some kind of error during
the Bearer connection operation. I see you're using a QMI modem, so
you should be looking at the "QMI WDS Start Network" response message.
You need to enable debug logs in MM in order to see the transferred
QMI messages: https://www.freedesktop.org/wiki/Software/ModemManager/Debugging/

The failure reason for the connection is not exposed in any DBus
property. The failure reason will be reported as a response to either
the Simple.Connect() or Bearer.Connect() API operations, so directly
reported to NetworkManager if you're using NetworkManager. It may be a
good idea to keep the "error from the last connection attempt" exposed
in the bearer interface, patches welcome :D

But, beware, the error when using the wrong APN may be reported in
very very very different ways, as this is part of the connection
sequence with the operator. I've seen multiple modems just reporting
"unknown error" when using the wrong APN, so you shouldn't expect a
100% clear error code like "wrong APN" because you may never get that
in a consistent way. You should check the "QMI WDS Start Network"
response message in your device as said before.


More information about the ModemManager-devel mailing list