Dan
This should be possible. I already have some experience with Python and NetworkManager-ModemManager. By now, there isn't a Python library available for the ModemManager dbus interface but there is for the NetworkManager dbus API. I used this Python script a starting point to write a dbus interface for ModemManager. Many functionality is already available by the NetworkManager library and I only had to add some classes to be able to read the ModemManager. I did the same for the WPA_supplicant dbus interface. I however must warn you for the versions of NetworkManager and ModemManager. I'm now using debian jessie (recently turned to be stable). This version has the org.freedesktop.ModemManager1 interface available while older ModemManager versions do not support this interface. This said: success with the development. I'm willing to send my sources! Pieter > Date: Wed, 3 Jun 2015 10:13:35 +0100 > From: arigead gmail com > To: dcbw redhat com > Subject: Re: Interaction with ModemManager > CC: networkmanager-list gnome org > > 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 gnome.org, 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. > > > > > > > Dan > > > _______________________________________________ > networkmanager-list mailing list > networkmanager-list gnome org > https://mail.gnome.org/mailman/listinfo/networkmanager-list |