From d187d3a7b677f82cdb00bf4a2f66f62e0f3508df Mon Sep 17 00:00:00 2001
From: Ajay Garg <ajay@activitycentral.com>
Date: Mon, 6 Feb 2012 19:21:14 +0530
Subject: [PATCH] sl#3321: Pick up whatever Modem-Parameters are entered
(in "modemconfiguration" CP).
Organization: Sugar Labs Foundation
Signed-off-by: Ajay Garg <ajay@activitycentral.com>
---
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
|
b
|
def load_gsm_connection(): |
945 | 945 | pin = client.get_string(GSM_PIN_PATH) or '' |
946 | 946 | puk = client.get_string(GSM_PUK_PATH) or '' |
947 | 947 | |
948 | | if username and number and apn: |
949 | | settings = SettingsGsm() |
950 | | settings.gsm.username = username |
951 | | settings.gsm.number = number |
952 | | settings.gsm.apn = apn |
953 | | |
954 | | secrets = SecretsGsm() |
955 | | secrets.pin = pin |
956 | | secrets.puk = puk |
957 | | secrets.password = password |
958 | | |
959 | | settings.connection.id = 'gsm' |
960 | | settings.connection.type = NM_CONNECTION_TYPE_GSM |
961 | | uuid = settings.connection.uuid = unique_id() |
962 | | settings.connection.autoconnect = False |
963 | | settings.ip4_config.method = 'auto' |
964 | | settings.serial.baud = _BAUD_RATE |
| 948 | logging.warning('Trying to establish 3G GSM connection. However,' |
| 949 | ' the connection may fail due to invalid/missing' |
| 950 | ' parameters, with NetworkManager giving' |
| 951 | ' error-code. For more details, see' |
| 952 | ' "http://dev.laptop.org.au/issues/1018"') |
| 953 | settings = SettingsGsm() |
| 954 | settings.gsm.username = username |
| 955 | settings.gsm.number = number |
| 956 | settings.gsm.apn = apn |
| 957 | |
| 958 | secrets = SecretsGsm() |
| 959 | secrets.pin = pin |
| 960 | secrets.puk = puk |
| 961 | secrets.password = password |
| 962 | |
| 963 | settings.connection.id = 'gsm' |
| 964 | settings.connection.type = NM_CONNECTION_TYPE_GSM |
| 965 | uuid = settings.connection.uuid = unique_id() |
| 966 | settings.connection.autoconnect = False |
| 967 | settings.ip4_config.method = 'auto' |
| 968 | settings.serial.baud = _BAUD_RATE |
965 | 969 | |
966 | | try: |
967 | | add_connection(uuid, settings, secrets) |
968 | | except Exception: |
969 | | logging.exception('Error adding gsm connection to NMSettings.') |
970 | | else: |
971 | | logging.warning('No gsm connection was set in GConf.') |
| 970 | try: |
| 971 | add_connection(uuid, settings, secrets) |
| 972 | except Exception: |
| 973 | logging.exception('Error adding gsm connection to NMSettings.') |
972 | 974 | |
973 | 975 | |
974 | 976 | def load_connections(): |