NetworkManager r3414 - in trunk: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3414 - in trunk: . src
- Date: Mon, 10 Mar 2008 21:19:46 +0000 (GMT)
Author: dcbw
Date: Mon Mar 10 21:19:45 2008
New Revision: 3414
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3414&view=rev
Log:
2008-03-10 Dan Williams <dcbw redhat com>
* src/nm-cdma-device.c
- (do_dial, init_modem): handle errors from
nm_serial_device_send_command_string()
* src/nm-gsm-device.c
- (do_dial, manual_registration, automatic_registration_get_network,
automatic_registration, enter_pin, check_pin, init_modem): handle
errors from nm_serial_device_send_command_string()
Modified:
trunk/ChangeLog
trunk/src/nm-cdma-device.c
trunk/src/nm-gsm-device.c
Modified: trunk/src/nm-cdma-device.c
==============================================================================
--- trunk/src/nm-cdma-device.c (original)
+++ trunk/src/nm-cdma-device.c Mon Mar 10 21:19:45 2008
@@ -112,18 +112,23 @@
char *command;
guint id;
char *responses[] = { "CONNECT", "BUSY", "NO DIAL TONE", "NO CARRIER", NULL };
+ gboolean success;
setting = NM_SETTING_CDMA (cdma_device_get_setting (NM_CDMA_DEVICE (device), NM_TYPE_SETTING_CDMA));
command = g_strconcat ("ATDT", setting->number, NULL);
- nm_serial_device_send_command_string (device, command);
+ success = nm_serial_device_send_command_string (device, command);
g_free (command);
- id = nm_serial_device_wait_for_reply (device, 60, responses, dial_done, NULL);
- if (id)
- cdma_device_set_pending (NM_CDMA_DEVICE (device), id);
- else
+ if (success) {
+ id = nm_serial_device_wait_for_reply (device, 60, responses, dial_done, NULL);
+ if (id)
+ cdma_device_set_pending (NM_CDMA_DEVICE (device), id);
+ else
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ } else {
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ }
}
static void
@@ -154,7 +159,11 @@
guint id;
char *responses[] = { "OK", "ERR", NULL };
- nm_serial_device_send_command_string (device, "ATZ E0");
+ if (!nm_serial_device_send_command_string (device, "ATZ E0")) {
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ return;
+ }
+
id = nm_serial_device_wait_for_reply (device, 10, responses, init_done, NULL);
if (id)
Modified: trunk/src/nm-gsm-device.c
==============================================================================
--- trunk/src/nm-gsm-device.c (original)
+++ trunk/src/nm-gsm-device.c Mon Mar 10 21:19:45 2008
@@ -123,18 +123,23 @@
char *command;
guint id;
char *responses[] = { "CONNECT", "BUSY", "NO DIAL TONE", "NO CARRIER", NULL };
+ gboolean success;
setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
command = g_strconcat ("ATDT", setting->number, NULL);
- nm_serial_device_send_command_string (device, command);
+ success = nm_serial_device_send_command_string (device, command);
g_free (command);
- id = nm_serial_device_wait_for_reply (device, 60, responses, dial_done, NULL);
- if (id)
- gsm_device_set_pending (NM_GSM_DEVICE (device), id);
- else
+ if (success) {
+ id = nm_serial_device_wait_for_reply (device, 60, responses, dial_done, NULL);
+ if (id)
+ gsm_device_set_pending (NM_GSM_DEVICE (device), id);
+ else
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ } else {
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ }
}
static void
@@ -166,18 +171,23 @@
char *command;
guint id;
char *responses[] = { "OK", "ERROR", "ERR", NULL };
+ gboolean success;
setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
command = g_strdup_printf ("AT+COPS=1,2,\"%s\"", setting->network_id);
- nm_serial_device_send_command_string (device, command);
+ success = nm_serial_device_send_command_string (device, command);
g_free (command);
- id = nm_serial_device_wait_for_reply (device, 30, responses, manual_registration_done, NULL);
- if (id)
- gsm_device_set_pending (NM_GSM_DEVICE (device), id);
- else
+ if (success) {
+ id = nm_serial_device_wait_for_reply (device, 30, responses, manual_registration_done, NULL);
+ if (id)
+ gsm_device_set_pending (NM_GSM_DEVICE (device), id);
+ else
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ } else {
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ }
}
static void
@@ -201,7 +211,11 @@
guint id;
const char terminators[] = { '\r', '\n', '\0' };
- nm_serial_device_send_command_string (device, "AT+COPS?");
+ if (!nm_serial_device_send_command_string (device, "AT+COPS?")) {
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ return;
+ }
+
id = nm_serial_device_get_reply (device, 10, terminators, get_network_done, NULL);
if (id)
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
@@ -253,7 +267,11 @@
guint id;
char *responses[] = { "+CREG: 0,1", "+CREG: 0,5", "+CREG: 0,2", NULL };
- nm_serial_device_send_command_string (device, "AT+CREG?");
+ if (!nm_serial_device_send_command_string (device, "AT+CREG?")) {
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ return;
+ }
+
id = nm_serial_device_wait_for_reply (device, 60, responses, automatic_registration_response, NULL);
if (id)
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
@@ -350,16 +368,21 @@
char *command;
guint id;
char *responses[] = { "OK", "ERROR", "ERR", NULL };
+ gboolean success;
command = g_strdup_printf ("AT+CPIN=\"%s\"", secret);
- nm_serial_device_send_command_string (device, command);
+ success = nm_serial_device_send_command_string (device, command);
g_free (command);
- id = nm_serial_device_wait_for_reply (device, 3, responses, enter_pin_done, NULL);
- if (id)
- gsm_device_set_pending (NM_GSM_DEVICE (device), id);
- else
+ if (success) {
+ id = nm_serial_device_wait_for_reply (device, 3, responses, enter_pin_done, NULL);
+ if (id)
+ gsm_device_set_pending (NM_GSM_DEVICE (device), id);
+ else
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ } else {
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ }
} else {
nm_info ("%s required", secret_setting_name);
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_NEED_AUTH);
@@ -403,7 +426,10 @@
guint id;
char *responses[] = { "READY", "SIM PIN", "SIM PUK", "ERROR", "ERR", NULL };
- nm_serial_device_send_command_string (device, "AT+CPIN?");
+ if (!nm_serial_device_send_command_string (device, "AT+CPIN?")) {
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ return;
+ }
id = nm_serial_device_wait_for_reply (device, 3, responses, check_pin_done, NULL);
if (id)
@@ -440,9 +466,12 @@
guint id;
char *responses[] = { "OK", "ERR", NULL };
- nm_serial_device_send_command_string (device, "ATZ E0");
- id = nm_serial_device_wait_for_reply (device, 10, responses, init_done, NULL);
+ if (!nm_serial_device_send_command_string (device, "ATZ E0")) {
+ nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
+ return;
+ }
+ id = nm_serial_device_wait_for_reply (device, 10, responses, init_done, NULL);
if (id)
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]