Re: Interaction with ModemManager

On Thu, May 28, 2015 at 03:07:12PM -0500, Dan Williams wrote:
On Thu, 2015-05-28 at 15:30 +0100, John Whitmore wrote:
I could probably send this message to the ModemManager list as well but I'll
start here. 

I was on last week about connecting 2 4G LTE USB Dongles to a RaspberryPi. I
got one working but had a few issues with the second (vodafone) one. Every
time I edited the connection, the "vodafone" password had disappeared from the
connection. I'm away from the unit at the moment, taking a break 'till
tomorrow, then back at it. I ended up moving from Raspbian to Ubuntu Mate on
the RPi as Raspian has such old versions of NM and MM. Actually had serious
problems with Ubuntu Mate and Serial ports both the GPIO serial on the RPi and
USB - Serial cables. SO think I might be moving on the Arch Linux. There's a
first time for everything.

Anyhow that's not my question. When I'd added a dongle that was correctly
modeswitched and recognised by ModemManager I was able to create a new network
connection in the NetworkManager. My question is with regards to entering the
ISP details into the NetworkManager. If I'd an operator SIM, say "three" in
the dongle and create the network connection but then pull the dongle and
change the SIM to "vodafone" then the NetworkManager will attempt to connect to
the "vodafone" network with the "three" APN details.

Correct.  The APN is stored in the network connection details itself, so
the connection is really tied to a specific provider.  We intend to add
a way to lock a connection to a specific device/SIM in the future, but
that won't even really solve the SIM swapping thing.

Now I've not tested that and what happens so forgive my possibly premature
question. It seems more logical to me that the APN details would be entered
into the ModemManger and NetworkManager don't need to know it, but just
requests a connection from the ModemManager. Ideally the ModemManager could
look at the current SIM and say what that means in terms of APN details.

In recent versions of NetworkManager you can leave the APN blank (just
don't specify it when creating the connection) and then NM+MM will
request the "default subscribe APN" it the network supports it.  But, of
course, you're at the mercy of whether the network supports it, and what
is configured at the provider's end which may not always be correct.

New to the party so I'm sure there's a good reason why it is the way it is,
but just wondered. I'm sure that the data required for a Data connection must
be on the SIM becasue if I have an open unlocked phone and insert any SIM I've
never been asked for APN details. Phone just knows what to do. Well that's
been my expierence.

The data is stored on the device, actually, not the SIM.  Devices/modems
have a cached list of "PDP contexts" (GSM/UMTS) or "EPS contexts" (LTE)
that includes the APN.  When you swap the SIM that list doesn't change
unless something actively changes it, like software on the computer.

What happens on the phone is that there is software to inspect the SIM's
IMSI, extract the MCC/MNC of the provider, and reconfigure the default
APNs stored on the device to something in a hardcoded list.  Or, after
registering with the network, the provider can send an SMS that includes
the correct APNs and the phone will automatically provision.

NetworkManager doesn't do that kind of thing, it's currently up to the
callers of NetworkManager to update the configuration/connections as NM
is just a mechanism and doesn't actually enforce policy like this.  The
various UIs that talk to NM do look at the "mobile broadband provider
database" that is maintained on, that does include a list of
MCC/MNC and APNs that a client could use to match up the IMSI with a
suggested APN though.

Does that help?  In short, the SIM swapping problem is always solved at
a level higher than ModemManager, and probably higher than
NetworkManager too.

Been mulling that over in my head over the weekend and, at the risk of sounding
like a fan boy, it's brilliant. What I think that means is that I could write
a higher level piece of code, in python and talk to ModemManager via the DBus
interface to ask it about the installed modem and then fire a request to the
NetworkManager, again over DBus, to request a connection. 

The idea was always to manage two modems so given that, I can use the higher
level to ask ModemManager who has the stronger signal strength and then ask the
NetworkManager to establish a connection accordingly. Like I say Brilliant.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]