Update NetworkManager and nm-applet patches.

This commit is contained in:
Tambet Ingo
2008-10-29 12:15:43 +02:00
parent d7c7ab2732
commit 65992e69c3
2 changed files with 131 additions and 83 deletions

View File

@@ -120,7 +120,7 @@ index 3c4ce75..3f24eb5 100644
$(top_builddir)/libnm-util/libnm-util.la $(top_builddir)/libnm-util/libnm-util.la
diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c
index 5f09704..bad6a34 100644 index 21b24cd..78312ca 100644
--- a/src/NetworkManagerPolicy.c --- a/src/NetworkManagerPolicy.c
+++ b/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c
@@ -35,9 +35,6 @@ @@ -35,9 +35,6 @@
@@ -197,10 +197,10 @@ index 0000000..5331f65
+CLEANFILES = $(BUILT_SOURCES) +CLEANFILES = $(BUILT_SOURCES)
diff --git a/src/modem-manager/nm-cdma-modem.c b/src/modem-manager/nm-cdma-modem.c diff --git a/src/modem-manager/nm-cdma-modem.c b/src/modem-manager/nm-cdma-modem.c
new file mode 100644 new file mode 100644
index 0000000..8e94fa1 index 0000000..85532c0
--- /dev/null --- /dev/null
+++ b/src/modem-manager/nm-cdma-modem.c +++ b/src/modem-manager/nm-cdma-modem.c
@@ -0,0 +1,261 @@ @@ -0,0 +1,264 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+ +
+#include <string.h> +#include <string.h>
@@ -307,7 +307,7 @@ index 0000000..8e94fa1
+ dbus_g_proxy_begin_call (nm_modem_device_get_proxy (NM_MODEM_DEVICE (modem), NULL), + dbus_g_proxy_begin_call (nm_modem_device_get_proxy (NM_MODEM_DEVICE (modem), NULL),
+ "Connect", state_machine, + "Connect", state_machine,
+ modem, NULL, + modem, NULL,
+ G_TYPE_STRING, setting->number, + G_TYPE_STRING, nm_setting_cdma_get_number (setting),
+ G_TYPE_INVALID); + G_TYPE_INVALID);
+ break; + break;
+ case MODEM_STATE_CONNECT: + case MODEM_STATE_CONNECT:
@@ -345,10 +345,10 @@ index 0000000..8e94fa1
+ s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION); + s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+ g_assert (s_con); + g_assert (s_con);
+ +
+ if (!s_con->autoconnect) + if (!nm_setting_connection_get_autoconnect (s_con))
+ continue; + continue;
+ +
+ if (strcmp (s_con->type, NM_SETTING_CDMA_SETTING_NAME)) + if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_CDMA_SETTING_NAME))
+ continue; + continue;
+ +
+ return connection; + return connection;
@@ -382,10 +382,13 @@ index 0000000..8e94fa1
+ NULL, + NULL,
+ "missing CDMA setting; no secrets could be found."); + "missing CDMA setting; no secrets could be found.");
+ } else { + } else {
+ const char *username = nm_setting_cdma_get_username (s_cdma);
+ const char *password = nm_setting_cdma_get_password (s_cdma);
+
+ nm_ppp_manager_update_secrets (ppp_manager, + nm_ppp_manager_update_secrets (ppp_manager,
+ nm_device_get_iface (dev), + nm_device_get_iface (dev),
+ s_cdma->username ? s_cdma->username : "", + username ? username : "",
+ s_cdma->password ? s_cdma->password : "", + password ? password : "",
+ NULL); + NULL);
+ } + }
+ return; + return;
@@ -422,7 +425,7 @@ index 0000000..8e94fa1
+ s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA); + s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
+ g_assert (s_cdma); + g_assert (s_cdma);
+ +
+ return s_cdma->username; + return nm_setting_cdma_get_username (s_cdma);
+} +}
+ +
+/*****************************************************************************/ +/*****************************************************************************/
@@ -506,10 +509,10 @@ index 0000000..5dc3c14
+#endif /* NM_CDMA_MODEM_H */ +#endif /* NM_CDMA_MODEM_H */
diff --git a/src/modem-manager/nm-gsm-modem-hso.c b/src/modem-manager/nm-gsm-modem-hso.c diff --git a/src/modem-manager/nm-gsm-modem-hso.c b/src/modem-manager/nm-gsm-modem-hso.c
new file mode 100644 new file mode 100644
index 0000000..2c28752 index 0000000..bea0d31
--- /dev/null --- /dev/null
+++ b/src/modem-manager/nm-gsm-modem-hso.c +++ b/src/modem-manager/nm-gsm-modem-hso.c
@@ -0,0 +1,342 @@ @@ -0,0 +1,346 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+ +
+#include "nm-gsm-modem-hso.h" +#include "nm-gsm-modem-hso.h"
@@ -635,14 +638,18 @@ index 0000000..2c28752
+do_hso_auth (NMGsmModemHso *device) +do_hso_auth (NMGsmModemHso *device)
+{ +{
+ NMSettingGsm *s_gsm; + NMSettingGsm *s_gsm;
+ const char *username;
+ const char *password;
+ +
+ s_gsm = NM_SETTING_GSM (get_setting (device, NM_TYPE_SETTING_GSM)); + s_gsm = NM_SETTING_GSM (get_setting (device, NM_TYPE_SETTING_GSM));
+ username = nm_setting_gsm_get_username (s_gsm);
+ password = nm_setting_gsm_get_password (s_gsm);
+ +
+ dbus_g_proxy_begin_call (nm_modem_device_get_proxy (NM_MODEM_DEVICE (device), MM_DBUS_INTERFACE_MODEM_GSM_HSO), + dbus_g_proxy_begin_call (nm_modem_device_get_proxy (NM_MODEM_DEVICE (device), MM_DBUS_INTERFACE_MODEM_GSM_HSO),
+ "Authenticate", hso_auth_done, + "Authenticate", hso_auth_done,
+ device, NULL, + device, NULL,
+ G_TYPE_STRING, s_gsm->username ? s_gsm->username : "", + G_TYPE_STRING, username ? username : "",
+ G_TYPE_STRING, s_gsm->password ? s_gsm->password : "", + G_TYPE_STRING, password ? password : "",
+ G_TYPE_INVALID); + G_TYPE_INVALID);
+} +}
+ +
@@ -1219,10 +1226,10 @@ index 0000000..1f49fda
+#endif /* NM_GSM_MODEM_MBM_H */ +#endif /* NM_GSM_MODEM_MBM_H */
diff --git a/src/modem-manager/nm-gsm-modem.c b/src/modem-manager/nm-gsm-modem.c diff --git a/src/modem-manager/nm-gsm-modem.c b/src/modem-manager/nm-gsm-modem.c
new file mode 100644 new file mode 100644
index 0000000..9a77abf index 0000000..047e76c
--- /dev/null --- /dev/null
+++ b/src/modem-manager/nm-gsm-modem.c +++ b/src/modem-manager/nm-gsm-modem.c
@@ -0,0 +1,342 @@ @@ -0,0 +1,354 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+ +
+#include <string.h> +#include <string.h>
@@ -1301,8 +1308,10 @@ index 0000000..9a77abf
+ NMSettingGsm *setting; + NMSettingGsm *setting;
+ const char *secret = NULL; + const char *secret = NULL;
+ const char *secret_name = NULL; + const char *secret_name = NULL;
+ gboolean retry_secret = FALSE; + const char *str;
+ GError *error = NULL; + GError *error = NULL;
+ int i;
+ gboolean retry_secret = FALSE;
+ +
+ setting = NM_SETTING_GSM (get_setting (modem, NM_TYPE_SETTING_GSM)); + setting = NM_SETTING_GSM (get_setting (modem, NM_TYPE_SETTING_GSM));
+ +
@@ -1313,16 +1322,15 @@ index 0000000..9a77abf
+ g_debug ("%s", dbus_g_error_get_name (error)); + g_debug ("%s", dbus_g_error_get_name (error));
+ +
+ if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PIN)) { + if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PIN)) {
+ secret = setting->pin; + secret = nm_setting_gsm_get_pin (setting);
+ secret_name = NM_SETTING_GSM_PIN; + secret_name = NM_SETTING_GSM_PIN;
+ priv->modem_state = MODEM_STATE_SET_PIN; + priv->modem_state = MODEM_STATE_SET_PIN;
+ } else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PUK)) { + } else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PUK)) {
+ secret = setting->puk; + secret = nm_setting_gsm_get_puk (setting);
+ secret_name = NM_SETTING_GSM_PUK; + secret_name = NM_SETTING_GSM_PUK;
+ priv->modem_state = MODEM_STATE_SET_PIN; + priv->modem_state = MODEM_STATE_SET_PIN;
+ } else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_WRONG)) { + } else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_WRONG)) {
+ g_free (setting->pin); + g_object_set (setting, NM_SETTING_GSM_PIN, NULL, NULL);
+ setting->pin = NULL;
+ secret_name = NM_SETTING_GSM_PIN; + secret_name = NM_SETTING_GSM_PIN;
+ retry_secret = TRUE; + retry_secret = TRUE;
+ priv->modem_state = MODEM_STATE_SET_PIN; + priv->modem_state = MODEM_STATE_SET_PIN;
@@ -1379,11 +1387,13 @@ index 0000000..9a77abf
+ +
+ case MODEM_STATE_ENABLE: + case MODEM_STATE_ENABLE:
+ priv->modem_state = MODEM_STATE_SET_APN; + priv->modem_state = MODEM_STATE_SET_APN;
+ if (setting->apn) + str = nm_setting_gsm_get_apn (setting);
+
+ if (str)
+ dbus_g_proxy_begin_call (get_proxy (modem, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK), + dbus_g_proxy_begin_call (get_proxy (modem, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK),
+ "SetApn", state_machine, + "SetApn", state_machine,
+ modem, NULL, + modem, NULL,
+ G_TYPE_STRING, setting->apn, + G_TYPE_STRING, str,
+ G_TYPE_INVALID); + G_TYPE_INVALID);
+ else + else
+ goto again; + goto again;
@@ -1391,11 +1401,13 @@ index 0000000..9a77abf
+ break; + break;
+ case MODEM_STATE_SET_APN: + case MODEM_STATE_SET_APN:
+ priv->modem_state = MODEM_STATE_SET_BAND; + priv->modem_state = MODEM_STATE_SET_BAND;
+ if (setting->band) + i = nm_setting_gsm_get_band (setting);
+
+ if (i)
+ dbus_g_proxy_begin_call (get_proxy (modem, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK), + dbus_g_proxy_begin_call (get_proxy (modem, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK),
+ "SetBand", state_machine, + "SetBand", state_machine,
+ modem, NULL, + modem, NULL,
+ G_TYPE_UINT, (guint32) setting->band, + G_TYPE_UINT, (guint32) i,
+ G_TYPE_INVALID); + G_TYPE_INVALID);
+ else + else
+ goto again; + goto again;
@@ -1404,11 +1416,13 @@ index 0000000..9a77abf
+ +
+ case MODEM_STATE_SET_BAND: + case MODEM_STATE_SET_BAND:
+ priv->modem_state = MODEM_STATE_SET_NETWORK_MODE; + priv->modem_state = MODEM_STATE_SET_NETWORK_MODE;
+ if (setting->network_type) + i = nm_setting_gsm_get_network_type (setting);
+
+ if (i)
+ dbus_g_proxy_begin_call (get_proxy (modem, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK), + dbus_g_proxy_begin_call (get_proxy (modem, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK),
+ "SetNetworkMode", state_machine, + "SetNetworkMode", state_machine,
+ modem, NULL, + modem, NULL,
+ G_TYPE_UINT, (guint32) setting->network_type, + G_TYPE_UINT, (guint32) i,
+ G_TYPE_INVALID); + G_TYPE_INVALID);
+ else + else
+ goto again; + goto again;
@@ -1417,15 +1431,17 @@ index 0000000..9a77abf
+ +
+ case MODEM_STATE_SET_NETWORK_MODE: + case MODEM_STATE_SET_NETWORK_MODE:
+ priv->modem_state = MODEM_STATE_REGISTER; + priv->modem_state = MODEM_STATE_REGISTER;
+
+ str = nm_setting_gsm_get_network_id (setting);
+ dbus_g_proxy_begin_call_with_timeout (get_proxy (modem, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK), + dbus_g_proxy_begin_call_with_timeout (get_proxy (modem, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK),
+ "Register", state_machine, + "Register", state_machine,
+ modem, NULL, 120000, + modem, NULL, 120000,
+ G_TYPE_STRING, setting->network_id ? setting->network_id : "", + G_TYPE_STRING, str ? str : "",
+ G_TYPE_INVALID); + G_TYPE_INVALID);
+ break; + break;
+ +
+ case MODEM_STATE_REGISTER: + case MODEM_STATE_REGISTER:
+ nm_modem_device_connect (NM_MODEM_DEVICE (modem), setting->number); + nm_modem_device_connect (NM_MODEM_DEVICE (modem), nm_setting_gsm_get_number (setting));
+ break; + break;
+ case MODEM_STATE_FAILED: + case MODEM_STATE_FAILED:
+ default: + default:
@@ -1459,10 +1475,10 @@ index 0000000..9a77abf
+ s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION); + s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+ g_assert (s_con); + g_assert (s_con);
+ +
+ if (!s_con->autoconnect) + if (!nm_setting_connection_get_autoconnect (s_con))
+ continue; + continue;
+ +
+ if (strcmp (s_con->type, NM_SETTING_GSM_SETTING_NAME)) + if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_GSM_SETTING_NAME))
+ continue; + continue;
+ +
+ return connection; + return connection;
@@ -1496,10 +1512,13 @@ index 0000000..9a77abf
+ NULL, + NULL,
+ "missing GSM setting; no secrets could be found."); + "missing GSM setting; no secrets could be found.");
+ } else { + } else {
+ const char *username = nm_setting_gsm_get_username (s_gsm);
+ const char *password = nm_setting_gsm_get_password (s_gsm);
+
+ nm_ppp_manager_update_secrets (ppp_manager, + nm_ppp_manager_update_secrets (ppp_manager,
+ nm_device_get_iface (dev), + nm_device_get_iface (dev),
+ s_gsm->username ? s_gsm->username : "", + username ? username : "",
+ s_gsm->password ? s_gsm->password : "", + password ? password : "",
+ NULL); + NULL);
+ } + }
+ return; + return;
@@ -1536,7 +1555,7 @@ index 0000000..9a77abf
+ s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM); + s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
+ g_assert (s_gsm); + g_assert (s_gsm);
+ +
+ return s_gsm->username; + return nm_setting_gsm_get_username (s_gsm);
+} +}
+ +
+/*****************************************************************************/ +/*****************************************************************************/
@@ -2671,10 +2690,10 @@ index 0000000..de1d2de
+#endif /* NM_MODEM_TYPES_H */ +#endif /* NM_MODEM_TYPES_H */
diff --git a/src/nm-cdma-device.c b/src/nm-cdma-device.c diff --git a/src/nm-cdma-device.c b/src/nm-cdma-device.c
deleted file mode 100644 deleted file mode 100644
index 63e4883..0000000 index 628a9b7..0000000
--- a/src/nm-cdma-device.c --- a/src/nm-cdma-device.c
+++ /dev/null +++ /dev/null
@@ -1,571 +0,0 @@ @@ -1,574 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
- -
-#include <stdio.h> -#include <stdio.h>
@@ -2804,7 +2823,7 @@ index 63e4883..0000000
- -
- setting = NM_SETTING_CDMA (cdma_device_get_setting (NM_CDMA_DEVICE (device), NM_TYPE_SETTING_CDMA)); - setting = NM_SETTING_CDMA (cdma_device_get_setting (NM_CDMA_DEVICE (device), NM_TYPE_SETTING_CDMA));
- -
- command = g_strconcat ("ATDT", setting->number, NULL); - command = g_strconcat ("ATDT", nm_setting_cdma_get_number (setting), NULL);
- if (nm_serial_device_send_command_string (device, command)) - if (nm_serial_device_send_command_string (device, command))
- id = nm_serial_device_wait_for_reply (device, 60, responses, responses, dial_done, NULL); - id = nm_serial_device_wait_for_reply (device, 60, responses, responses, dial_done, NULL);
- g_free (command); - g_free (command);
@@ -2914,10 +2933,10 @@ index 63e4883..0000000
- s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION); - s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
- g_assert (s_con); - g_assert (s_con);
- -
- if (!s_con->autoconnect) - if (!nm_setting_connection_get_autoconnect (s_con))
- continue; - continue;
- -
- if (strcmp (s_con->type, NM_SETTING_CDMA_SETTING_NAME)) - if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_CDMA_SETTING_NAME))
- continue; - continue;
- -
- return connection; - return connection;
@@ -2957,10 +2976,13 @@ index 63e4883..0000000
- NULL, - NULL,
- "missing CDMA setting; no secrets could be found."); - "missing CDMA setting; no secrets could be found.");
- } else { - } else {
- const char *cdma_username = nm_setting_cdma_get_username (s_cdma);
- const char *cdma_password = nm_setting_cdma_get_password (s_cdma);
-
- nm_ppp_manager_update_secrets (ppp_manager, - nm_ppp_manager_update_secrets (ppp_manager,
- nm_device_get_iface (dev), - nm_device_get_iface (dev),
- s_cdma->username ? s_cdma->username : "", - cdma_username ? cdma_username : "",
- s_cdma->password ? s_cdma->password : "", - cdma_password ? cdma_password : "",
- NULL); - NULL);
- } - }
- return; - return;
@@ -3001,7 +3023,7 @@ index 63e4883..0000000
- s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA); - s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
- g_assert (s_cdma); - g_assert (s_cdma);
- -
- return s_cdma->username; - return nm_setting_cdma_get_username (s_cdma);
-} -}
- -
-/*****************************************************************************/ -/*****************************************************************************/
@@ -3469,10 +3491,10 @@ index 32cb705..8cf41e1 100644
static void static void
diff --git a/src/nm-hso-gsm-device.c b/src/nm-hso-gsm-device.c diff --git a/src/nm-hso-gsm-device.c b/src/nm-hso-gsm-device.c
deleted file mode 100644 deleted file mode 100644
index 30fd8d9..0000000 index 49b6084..0000000
--- a/src/nm-hso-gsm-device.c --- a/src/nm-hso-gsm-device.c
+++ /dev/null +++ /dev/null
@@ -1,560 +0,0 @@ @@ -1,565 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
- -
-#include <stdio.h> -#include <stdio.h>
@@ -3653,6 +3675,8 @@ index 30fd8d9..0000000
- NMActRequest *req; - NMActRequest *req;
- const char *responses[] = { "OK", "ERROR", "ERR", NULL }; - const char *responses[] = { "OK", "ERROR", "ERR", NULL };
- char *command; - char *command;
- const char *gsm_username;
- const char *gsm_password;
- guint cid; - guint cid;
- -
- req = nm_device_get_act_request (NM_DEVICE (device)); - req = nm_device_get_act_request (NM_DEVICE (device));
@@ -3662,10 +3686,13 @@ index 30fd8d9..0000000
- -
- s_gsm = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM)); - s_gsm = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
- -
- gsm_username = nm_setting_gsm_get_username (s_gsm);
- gsm_password = nm_setting_gsm_get_password (s_gsm);
-
- command = g_strdup_printf ("AT$QCPDPP=%d,1,\"%s\",\"%s\"", - command = g_strdup_printf ("AT$QCPDPP=%d,1,\"%s\",\"%s\"",
- cid, - cid,
- s_gsm->password ? s_gsm->password : "", - gsm_password ? gsm_password : "",
- s_gsm->username ? s_gsm->username : ""); - gsm_username ? gsm_username : "");
- modem_wait_for_reply (NM_GSM_DEVICE (device), command, 5, responses, responses, hso_auth_done, GUINT_TO_POINTER (cid)); - modem_wait_for_reply (NM_GSM_DEVICE (device), command, 5, responses, responses, hso_auth_done, GUINT_TO_POINTER (cid));
- g_free (command); - g_free (command);
-} -}
@@ -4078,7 +4105,7 @@ index a7498c8..0000000
- -
-#endif /* NM_HSO_GSM_DEVICE_H */ -#endif /* NM_HSO_GSM_DEVICE_H */
diff --git a/src/nm-manager.c b/src/nm-manager.c diff --git a/src/nm-manager.c b/src/nm-manager.c
index 74345b0..828dd5e 100644 index def60e1..797c7b4 100644
--- a/src/nm-manager.c --- a/src/nm-manager.c
+++ b/src/nm-manager.c +++ b/src/nm-manager.c
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
@@ -4178,7 +4205,7 @@ index 74345b0..828dd5e 100644
g_object_unref (priv->dbus_mgr); g_object_unref (priv->dbus_mgr);
g_object_unref (priv->hal_mgr); g_object_unref (priv->hal_mgr);
@@ -1614,58 +1669,66 @@ next: @@ -1623,58 +1678,66 @@ next:
} }
static void static void
@@ -4272,10 +4299,10 @@ index 74345b0..828dd5e 100644
gpointer user_data) gpointer user_data)
diff --git a/src/nm-serial-device.c b/src/nm-serial-device.c diff --git a/src/nm-serial-device.c b/src/nm-serial-device.c
deleted file mode 100644 deleted file mode 100644
index b6f97d4..0000000 index 4b3c102..0000000
--- a/src/nm-serial-device.c --- a/src/nm-serial-device.c
+++ /dev/null +++ /dev/null
@@ -1,1144 +0,0 @@ @@ -1,1146 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
- -
-#define _GNU_SOURCE /* for strcasestr() */ -#define _GNU_SOURCE /* for strcasestr() */
@@ -4609,10 +4636,10 @@ index b6f97d4..0000000
- int parity; - int parity;
- int stopbits; - int stopbits;
- -
- speed = parse_baudrate (setting->baud); - speed = parse_baudrate (nm_setting_serial_get_baud (setting));
- bits = parse_bits (setting->bits); - bits = parse_bits (nm_setting_serial_get_bits (setting));
- parity = parse_parity (setting->parity); - parity = parse_parity (nm_setting_serial_get_parity (setting));
- stopbits = parse_stopbits (setting->stopbits); - stopbits = parse_stopbits (nm_setting_serial_get_stopbits (setting));
- -
- ioctl (priv->fd, TCGETA, &stbuf); - ioctl (priv->fd, TCGETA, &stbuf);
- -
@@ -4716,15 +4743,17 @@ index b6f97d4..0000000
- NMSettingSerial *setting; - NMSettingSerial *setting;
- int i, eagain_count = 1000; - int i, eagain_count = 1000;
- ssize_t written; - ssize_t written;
- guint32 send_delay = G_USEC_PER_SEC / 1000; - guint32 send_delay = 0;
- -
- g_return_val_if_fail (NM_IS_SERIAL_DEVICE (device), FALSE); - g_return_val_if_fail (NM_IS_SERIAL_DEVICE (device), FALSE);
- g_return_val_if_fail (command != NULL, FALSE); - g_return_val_if_fail (command != NULL, FALSE);
- -
- fd = NM_SERIAL_DEVICE_GET_PRIVATE (device)->fd; - fd = NM_SERIAL_DEVICE_GET_PRIVATE (device)->fd;
- setting = NM_SETTING_SERIAL (serial_device_get_setting (device, NM_TYPE_SETTING_SERIAL)); - setting = NM_SETTING_SERIAL (serial_device_get_setting (device, NM_TYPE_SETTING_SERIAL));
- if (setting && setting->send_delay) - if (setting)
- send_delay = setting->send_delay; - send_delay = nm_setting_serial_get_send_delay (setting);
- if (send_delay == 0)
- send_delay = G_USEC_PER_SEC / 1000;
- -
- nm_serial_debug ("Sending:", (char *) command->data, command->len); - nm_serial_debug ("Sending:", (char *) command->data, command->len);
- -

View File

@@ -31,7 +31,7 @@ index de8ccb4..2be2217 100644
nm_applet_LDADD = \ nm_applet_LDADD = \
diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c
index 90c5e5e..e28d13c 100644 index aff002f..760234a 100644
--- a/src/applet-device-gsm.c --- a/src/applet-device-gsm.c
+++ b/src/applet-device-gsm.c +++ b/src/applet-device-gsm.c
@@ -24,6 +24,9 @@ @@ -24,6 +24,9 @@
@@ -53,7 +53,7 @@ index 90c5e5e..e28d13c 100644
#include "utils.h" #include "utils.h"
typedef struct { typedef struct {
@@ -165,6 +170,50 @@ add_default_connection_item (NMDevice *device, @@ -174,6 +179,50 @@ add_default_connection_item (NMDevice *device,
} }
static void static void
@@ -104,7 +104,7 @@ index 90c5e5e..e28d13c 100644
gsm_menu_item_deactivate (GtkMenuItem *item, gpointer user_data) gsm_menu_item_deactivate (GtkMenuItem *item, gpointer user_data)
{ {
GSMMenuItemInfo *info = (GSMMenuItemInfo *) user_data; GSMMenuItemInfo *info = (GSMMenuItemInfo *) user_data;
@@ -264,37 +313,68 @@ gsm_add_menu_item (NMDevice *device, @@ -273,40 +322,68 @@ gsm_add_menu_item (NMDevice *device,
add_connection_items (device, connections, active, menu, applet); add_connection_items (device, connections, active, menu, applet);
else else
add_default_connection_item (device, menu, applet); add_default_connection_item (device, menu, applet);
@@ -136,9 +136,12 @@ index 90c5e5e..e28d13c 100644
- -
- connection = applet_find_active_connection_for_device (device, applet, NULL); - connection = applet_find_active_connection_for_device (device, applet, NULL);
- if (connection) { - if (connection) {
- const char *id;
-
- s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); - s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
- if (s_con && s_con->id) - id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
- str = g_strdup_printf (_("You are now connected to '%s'."), s_con->id); - if (id)
- str = g_strdup_printf (_("You are now connected to '%s'."), id);
- } - }
+ NMAGsmModem *modem; + NMAGsmModem *modem;
+ char *oper_code; + char *oper_code;
@@ -189,7 +192,7 @@ index 90c5e5e..e28d13c 100644
} }
static GdkPixbuf * static GdkPixbuf *
@@ -304,6 +384,7 @@ gsm_get_icon (NMDevice *device, @@ -316,6 +393,7 @@ gsm_get_icon (NMDevice *device,
char **tip, char **tip,
NMApplet *applet) NMApplet *applet)
{ {
@@ -197,13 +200,17 @@ index 90c5e5e..e28d13c 100644
GdkPixbuf *pixbuf = NULL; GdkPixbuf *pixbuf = NULL;
const char *iface; const char *iface;
NMSettingConnection *s_con = NULL; NMSettingConnection *s_con = NULL;
@@ -323,11 +404,40 @@ gsm_get_icon (NMDevice *device, @@ -335,15 +413,40 @@ gsm_get_icon (NMDevice *device,
*tip = g_strdup_printf (_("Waiting for user authentication on device '%s'..."), iface); *tip = g_strdup_printf (_("Waiting for user authentication on device '%s'..."), iface);
break; break;
case NM_DEVICE_STATE_ACTIVATED: case NM_DEVICE_STATE_ACTIVATED:
- if (s_con && s_con->id) - if (s_con) {
- *tip = g_strdup_printf (_("Mobile broadband connection '%s'"), s_con->id); - const char *id;
- else -
- id = nm_setting_connection_get_id (s_con);
- if (id)
- *tip = g_strdup_printf (_("Mobile broadband connection '%s'"), id);
- } else
- *tip = g_strdup (_("Mobile broadband connection")); - *tip = g_strdup (_("Mobile broadband connection"));
- pixbuf = applet->wwan_icon; - pixbuf = applet->wwan_icon;
+ modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), "gsm-modem"); + modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), "gsm-modem");
@@ -244,7 +251,7 @@ index 90c5e5e..e28d13c 100644
default: default:
break; break;
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index ee627f5..6fd29af 100644 index 2522ff1..40f2d44 100644
--- a/src/connection-editor/page-mobile.c --- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c +++ b/src/connection-editor/page-mobile.c
@@ -107,7 +107,6 @@ populate_gsm_ui (CEPageMobile *self, NMConnection *connection) @@ -107,7 +107,6 @@ populate_gsm_ui (CEPageMobile *self, NMConnection *connection)
@@ -252,10 +259,10 @@ index ee627f5..6fd29af 100644
GHashTable *secrets; GHashTable *secrets;
GValue *value; GValue *value;
- GtkWidget *widget; - GtkWidget *widget;
const char *s;
if (setting->number) s = nm_setting_gsm_get_number (setting);
gtk_entry_set_text (priv->number, setting->number); @@ -146,17 +145,6 @@ populate_gsm_ui (CEPageMobile *self, NMConnection *connection)
@@ -141,17 +140,6 @@ populate_gsm_ui (CEPageMobile *self, NMConnection *connection)
} }
gtk_combo_box_set_active (priv->network_type, type_idx); gtk_combo_box_set_active (priv->network_type, type_idx);
@@ -272,7 +279,7 @@ index ee627f5..6fd29af 100644
- -
secrets = get_secrets (connection, nm_setting_get_name (priv->setting)); secrets = get_secrets (connection, nm_setting_get_name (priv->setting));
if (setting->password) s = nm_setting_gsm_get_password (setting);
diff --git a/src/mm-types.h b/src/mm-types.h diff --git a/src/mm-types.h b/src/mm-types.h
new file mode 100644 new file mode 100644
index 0000000..a1f9979 index 0000000..a1f9979
@@ -330,10 +337,10 @@ index 0000000..206ee52
+EXTRA_DIST = $(glade_DATA) +EXTRA_DIST = $(glade_DATA)
diff --git a/src/modems/main.c b/src/modems/main.c diff --git a/src/modems/main.c b/src/modems/main.c
new file mode 100644 new file mode 100644
index 0000000..fe531f0 index 0000000..3243a6c
--- /dev/null --- /dev/null
+++ b/src/modems/main.c +++ b/src/modems/main.c
@@ -0,0 +1,547 @@ @@ -0,0 +1,559 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+ +
+#include <string.h> +#include <string.h>
@@ -636,30 +643,42 @@ index 0000000..fe531f0
+ NMSettingPPP *s_ppp; + NMSettingPPP *s_ppp;
+ NMSettingConnection *s_con; + NMSettingConnection *s_con;
+ GConfClient *gconf_client; + GConfClient *gconf_client;
+ char *uuid;
+ +
+ connection = nm_connection_new (); + connection = nm_connection_new ();
+ +
+ s_gsm = NM_SETTING_GSM (nm_setting_gsm_new ()); + s_gsm = NM_SETTING_GSM (nm_setting_gsm_new ());
+ s_gsm->number = g_strdup ("*99#"); /* This should be a sensible default as it's seems to be quite standard */ + g_object_set (s_gsm,
+ s_gsm->network_id = g_strdup (oper_code); + NM_SETTING_GSM_NUMBER, "*99#",
+ NM_SETTING_GSM_NETWORK_ID, oper_code,
+ NULL);
+
+ nm_connection_add_setting (connection, NM_SETTING (s_gsm)); + nm_connection_add_setting (connection, NM_SETTING (s_gsm));
+ +
+ /* Serial setting */ + /* Serial setting */
+ s_serial = (NMSettingSerial *) nm_setting_serial_new (); + s_serial = (NMSettingSerial *) nm_setting_serial_new ();
+ s_serial->baud = 115200; + g_object_set (s_serial,
+ s_serial->bits = 8; + NM_SETTING_SERIAL_BAUD, 115200,
+ s_serial->parity = 'n'; + NM_SETTING_SERIAL_BITS, 8,
+ s_serial->stopbits = 1; + NM_SETTING_SERIAL_PARITY, 'n',
+ NM_SETTING_SERIAL_STOPBITS, 1,
+ NULL);
+
+ nm_connection_add_setting (connection, NM_SETTING (s_serial)); + nm_connection_add_setting (connection, NM_SETTING (s_serial));
+ +
+ s_ppp = (NMSettingPPP *) nm_setting_ppp_new (); + s_ppp = (NMSettingPPP *) nm_setting_ppp_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_ppp)); + nm_connection_add_setting (connection, NM_SETTING (s_ppp));
+ +
+ s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); + s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
+ s_con->id = g_strdup (name); + uuid = nm_utils_uuid_generate ();
+ s_con->type = g_strdup (NM_SETTING (s_gsm)->name); + g_object_set (s_con,
+ s_con->autoconnect = FALSE; + NM_SETTING_CONNECTION_ID, name,
+ s_con->uuid = nm_utils_uuid_generate (); + NM_SETTING_CONNECTION_TYPE, nm_setting_get_name (NM_SETTING (s_gsm)),
+ NM_SETTING_CONNECTION_AUTOCONNECT, FALSE,
+ NM_SETTING_CONNECTION_UUID, uuid,
+ NULL);
+
+ g_free (uuid);
+ nm_connection_add_setting (connection, NM_SETTING (s_con)); + nm_connection_add_setting (connection, NM_SETTING (s_con));
+ +
+ gconf_client = gconf_client_get_default (); + gconf_client = gconf_client_get_default ();