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

Ajay Garg ajay at activitycentral.com
Fri Mar 9 06:37:25 EST 2012


Note that this patch is to be applied in full, and not over version-1 patch.

Changes of version-2 over version-1 :
-------------------------------------

Corrected the default values of modem-parameters (to 'None').
These default values are picked up, if there are no corresponding
gconf-keys.

Thanks a ton to Sridhar, for remote-debugging this.

 src/jarabe/model/network.py |   62 ++++++++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index 84e3666..f66b620 100644
--- a/src/jarabe/model/network.py
+++ b/src/jarabe/model/network.py
@@ -938,37 +938,39 @@ def load_gsm_connection():
 
     client = gconf.client_get_default()
 
-    username = client.get_string(GSM_USERNAME_PATH) or ''
-    password = client.get_string(GSM_PASSWORD_PATH) or ''
-    number = client.get_string(GSM_NUMBER_PATH) or ''
-    apn = client.get_string(GSM_APN_PATH) or ''
-    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
+    username = client.get_string(GSM_USERNAME_PATH) or None
+    password = client.get_string(GSM_PASSWORD_PATH) or None
+    number = client.get_string(GSM_NUMBER_PATH) or None
+    apn = client.get_string(GSM_APN_PATH) or None
+    pin = client.get_string(GSM_PIN_PATH) or None
+    puk = client.get_string(GSM_PUK_PATH) or None
+
+    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