After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688944 - Guess operator name from MCC/MNC or SID when not explicitly given
Guess operator name from MCC/MNC or SID when not explicitly given
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Network
3.7.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on: 688206
Blocks:
 
 
Reported: 2012-11-23 16:03 UTC by Aleksander Morgado
Modified: 2013-02-12 16:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Try to guess operator name from MCCMNC or SID (14.80 KB, patch)
2013-02-05 18:02 UTC, Aleksander Morgado
needs-work Details | Review
Updated patch (13.89 KB, patch)
2013-02-12 09:42 UTC, Aleksander Morgado
committed Details | Review

Description Aleksander Morgado 2012-11-23 16:03:45 UTC
When the modem doesn't know the operator name, try to guess it using the mobile broadband providers database through libnm-gtk (see bug 688206):
 * GSM/HSPA/LTE modems can look for Operator name using Operator code (MCC/MNC)
 * CDMA/EV-DO modems can look for the Operator name using SID

This logic is currently used also in gnome-shell.
Comment 1 Bastien Nocera 2012-12-06 14:01:17 UTC
Yep, though waiting on updated packages for ModemManager to test this. Also, is there a way to fake such a modem, or make MM unable to find out the operator name in the first place?
Comment 2 Aleksander Morgado 2012-12-06 17:28:38 UTC
The updated package should be in network-manager-applet, not in MM.

In my case, I test this by forcing the modem into 2G or 3G; my main operator only does 3G and in that case it gives both MCCMNC and operator ID; when forced to do 2G it roams to another operator and in this case it only gives me MCCMNC.

In order to test this, though, I usually just hack an empty string operator-id hardcoded directly...
Comment 3 Bastien Nocera 2013-01-31 08:52:25 UTC
Once bug 688238 has landed, a patch would be much appreciated.
Comment 4 Aleksander Morgado 2013-01-31 09:30:00 UTC
Both things are completely orthogonal actually; the operator name guessing depends on network-manager-applet (which is already in git master); while the MM1 interface integration depends on NM (which is also in git master).

I'll sure provide a patch for this one anyway - actually, I thought I already had done it :)
Comment 5 Aleksander Morgado 2013-02-05 18:02:37 UTC
Created attachment 235243 [details] [review]
Try to guess operator name from MCCMNC or SID

This patch implements the logic using the mobile providers database handled in libnm-gtk. Patch is based on top of the one for bug 688238.
Comment 6 Bastien Nocera 2013-02-11 14:10:15 UTC
Review of attachment 235243 [details] [review]:

Please bump the libnm-gtk requirement in configure.ac.

::: panels/network/net-device-mobile.c
@@ +271,3 @@
+static gchar *
+device_mobile_find_provider (NetDeviceMobile *device_mobile,
+                             const gchar *mccmnc,

Line the arguments here.

@@ +333,3 @@
+                        operator_name = device_mobile_find_provider (device_mobile,
+                                                                     modem_3gpp ? mm_modem_3gpp_get_operator_code (modem_3gpp) : NULL,
+                                                                     modem_cdma ? mm_modem_cdma_get_sid (modem_cdma) : 0);

This is pretty horrible, use temporary variables.

@@ +360,3 @@
+                panel_set_device_widget_details (device_mobile->priv->builder,
+                                                 "provider",
+                                                 str ? str : (gsm ? gsm : (cdma ? cdma : NULL)));

I can't really parse that.

@@ +567,3 @@
 
+        /* If none give, try to guess it */
+        if (!operator_name || !operator_name[0]) {

if (operator_name == NULL ||
    *operator_name == '\0')
Comment 7 Aleksander Morgado 2013-02-12 09:22:21 UTC
(In reply to comment #6)
> Review of attachment 235243 [details] [review]:
> 
> Please bump the libnm-gtk requirement in configure.ac.
> 

Not really needed to bump, the one specified in git master should already contain the MobileProvidersDatabase thing.
Comment 8 Aleksander Morgado 2013-02-12 09:42:36 UTC
Created attachment 235771 [details] [review]
Updated patch
Comment 9 Bastien Nocera 2013-02-12 15:22:55 UTC
Review of attachment 235771 [details] [review]:

Looks good.
Comment 10 Aleksander Morgado 2013-02-12 16:30:08 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Review of attachment 235243 [details] [review] [details]:
> > 
> > Please bump the libnm-gtk requirement in configure.ac.
> > 
> 
> Not really needed to bump, the one specified in git master should already
> contain the MobileProvidersDatabase thing.

I was wrong, as the min required version was reduced for the GNOME 3.7.5 release. As danw suggested, I'll revert this one first:

    network: Allow compiling against NM 0.9.6
    
    NM 0.9.7 has still not been released, even as a tarball, so allow
    compiling against 0.9.6 (without certain bits of new functionality).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691721
Comment 11 Aleksander Morgado 2013-02-12 16:44:37 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.