[Sugar-devel] [PATCH] sl#3321: Pick up whatever Modem-Parameters are entered (in "modemconfiguration" CP).

Ajay Garg ajay at activitycentral.com
Mon Feb 6 09:07:04 EST 2012


Before this, the parameters were not picked up, without necessarily
entering "username", "number" and "apn".

 src/jarabe/model/network.py |   48 ++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index 84e3666..0f727e6 100644
--- a/src/jarabe/model/network.py
+++ b/src/jarabe/model/network.py
@@ -945,30 +945,32 @@ def load_gsm_connection():
     pin = client.get_string(GSM_PIN_PATH) or ''
     puk = client.get_string(GSM_PUK_PATH) or ''
 
-    if username and number and apn:
-        settings = SettingsGsm()
-        settings.gsm.username = username
-        settings.gsm.number = number
-        settings.gsm.apn = apn
-
-        secrets = SecretsGsm()
-        secrets.pin = pin
-        secrets.puk = puk
-        secrets.password = password
-
-        settings.connection.id = 'gsm'
-        settings.connection.type = NM_CONNECTION_TYPE_GSM
-        uuid = settings.connection.uuid = unique_id()
-        settings.connection.autoconnect = False
-        settings.ip4_config.method = 'auto'
-        settings.serial.baud = _BAUD_RATE
+    logging.warning('Trying to establish 3G GSM connection. However,'
+            ' the connection may fail due to invalid/missing'
+            ' parameters, with NetworkManager giving'
+            ' error-code. For more details, see'
+            ' "http://dev.laptop.org.au/issues/1018"')
+    settings = SettingsGsm()
+    settings.gsm.username = username
+    settings.gsm.number = number
+    settings.gsm.apn = apn
+
+    secrets = SecretsGsm()
+    secrets.pin = pin
+    secrets.puk = puk
+    secrets.password = password
+
+    settings.connection.id = 'gsm'
+    settings.connection.type = NM_CONNECTION_TYPE_GSM
+    uuid = settings.connection.uuid = unique_id()
+    settings.connection.autoconnect = False
+    settings.ip4_config.method = 'auto'
+    settings.serial.baud = _BAUD_RATE
 
-        try:
-            add_connection(uuid, settings, secrets)
-        except Exception:
-            logging.exception('Error adding gsm connection to NMSettings.')
-    else:
-        logging.warning('No gsm connection was set in GConf.')
+    try:
+        add_connection(uuid, settings, secrets)
+    except Exception:
+        logging.exception('Error adding gsm connection to NMSettings.')
 
 
 def load_connections():
-- 
1.7.4.4



More information about the Sugar-devel mailing list