Is there a terminal command to switch apn profile on the L5? As my operator (Telia Sweden) has different settings for mobile data and mms, it would be convenient to make that switch through the command line instead of the settings gui.
settings are you searching for:
Not searching for settings, just a cli command to switch between the two I have. Don’t know if this is doable e.g. through gsettings.
mmcli -m MODEM_INDEX --simple-connect="apn=internet.myisp.example"
Please try above commands, as described here under 3.2.1.
Second one would be:
I love Linux, but it is never easy. Found MODEM_INDEX 19 and using this command
sudo mmcli -m 19 --simple-connect="apn=mms.telia.se"
error: couldn't connect the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.NotFound: No valid data port found to launch connection'
No need to use
sudo there and I’m not promising that above command might work at all, yet it needs to be changed to resemble this one:
mmcli -m /org/freedesktop/ModemManager1/Modem/0 --simple-connect="apn=internet.myisp.example"
.xml file might be the most recent, related one in order to find
telia related settings: https://github.com/sailfishos/mobile-broadband-provider-info/blob/master/mobile-broadband-provider-info/serviceproviders.xml.
online.telia.se, as described here: https://forum.sailfishos.org/t/wrong-service-provider-settings-for-fello-sweden/11329.
As well and at the first place you might choose or even need to follow this (most recent updates related) Linux path: How will APN settings work?.
Still getting the same error as in my previous command. I need to research this command further.
My APN settings are fine and each of them work when I switch from the settings app.
I don’t have a Librem5 yet but on the Pinephone I use
sudo nmcli conn down vzwapp sudo nmcli conn up vzwinternet
to switch from one Verizon APN to the other. Each has its own network manager connection profile.
It seems to be enough to do
sudo nmcli conn up "Telia 3G" or
sudo nmcli conn up mms, without doing
sudo nmcli conn down [APN name] in between.
$ nmcli conn show gives me:
NAME UUID TYPE DEVICE Telia 3G 64b9a32f-f89b-4459-a20c-670f82b8233d gsm cdc-wdm0
NAME UUID TYPE DEVICE mms 4cda9ff6-4ab2-4258-bdb8-652859f291fc gsm cdc-wdm0
This should enable me to check for MMS messages automatically once or twice a day and then return to the APN which gives me mobile data.
Interestingly, Access Point Names in the Settings app don’t change accordingly
If you want to make a launcher for it: https://source.puri.sm/Librem5/community-wiki/-/wikis/Tips-&-Tricks#creating-a-shortcut-to-execute-a-terminal-command
Very good, thanks!
Yeah, the gnome-settings applet isn’t synchronized and I haven’t figured out where it’s saving its state. It seems too that if you boot up with a different connection than is shown in the settings then the modem may not connect.
I made a small python script that periodically checks for files in ~/.cache/mmstng/modemmanager/ and alerts me if there is > 0 so that I can switch to the MMS connection long enough to finish the conversation and then I switch back to the all-other-data connection.
You seem to have the same challenges as me when it comes to mms . Would you mind sharing that python script with me? Thanks
A seemingly-easy way to add sound to the notifications is “fbcli -E message-new-sms”. I’ve tried several ways of running this from a Python script - all work when running as a normal process but there is no sound when running as a service. Frustrating.
Perhaps it’s possible to do the notifications via dbus.
How does one get their provider added? I work for Tbaytel which is a telco that provides cell service that is technically Rogers in Canada but I noticed that our apn’s are not the same as Rogers. I’ve had to manually create my apn’s based on my work phone, and also found out the hard way that the phone didn’t treat my cell data connection as metered so it was just using data whenever the wifi wasn’t good/disconnected. I have since set it in Advanced networking to metered but it would be nice to have it do this automatically in case there is more than just me in this area using the phone.
apn carrier="Tbaytel Tethering" carrier_id = "2090" mcc="302" mnc="720" apn="ltedata.apn" type="dun" protocol="IPV4V6" mvno_type="gid" mvno_match_data="BA" apn carrier="Tbaytel Internet" carrier_id = "2090" mcc="302" mnc="720" apn="ltemobile.apn" type="default,ia,mms,supl" protocol="IPV4V6" mmsc="http://mms.gprs.rogers.com" mmsproxy="mmsproxy.rogers.com" mmsport="80" mvno_type="imsi" mvno_match_data="302720x92" apn carrier="Tbaytel Internet" carrier_id = "2090" mcc="302" mnc="720" apn="ltemobile.apn" type="default,ia,mms,supl" protocol="IPV4V6" mmsc="http://mms.gprs.rogers.com" mmsproxy="mmsproxy.rogers.com" mmsport="80" mvno_type="gid" mvno_match_data="BA"
Sure, you’ll need to prepare above data into format recognized from PureOS. As first edit this file:
/usr/share/mobile-broadband-provider-info/serviceproviders.xml, please create smaller working file with fields/format as needed. Convert/write above data to this smaller
.txt file by yourself and copy them into
serviceproviders.xml, save this updated file, reboot and let us know if connection to Tbaytel is automatically recognized now. Hope this helps.
EDIT: In addition, please check following file compatibility with Tbaytel as well (it is too late for me to do this now):
the GIF totally crashes my mobile Firefox ESR browser v102.7.0, just a fun sidenote
That worked, I can share the exact stanza from the based on what my work phone has. It picked up the correct apn for internet and also the mms config and proxy and so on.
<provider> <name>Tbaytel</name> <gsm> <network-id mcc="302" mnc="720"/> <apn value="ltemobile.apn"> <plan type="postpaid"/> <usage type="internet"/> <name>Tbaytel Internet</name> </apn> <apn value="ltemobile.apn"> <usage type="mms"/> <mmsc>http://mms.gprs.rogers.com</mmsc> <mmsproxy>mmsproxy.rogers.com:80</mmsproxy> </apn> </gsm> </provider>
FYI, I’ve got MMS-Monitor published now. It’s not substantially different than what you’ve already got. For others:
This project is aimed at people using a Gnu/Linux phone and a cell carrier with different APNs for MMS messages versus general internet data. The intent is to allow the phone to be configured for general internet use by default and yet still get an alert when a MMS message is pending. The user would then switch to the MMS APN to receive the message and maybe reply, then switch back to the non-MMS APN.