[PATCH 13/15] device-bt, device-modem: listen for data port changes in the `NMModem'
- From: Aleksander Morgado <aleksander lanedo com>
- To: networkmanager-list gnome org
- Subject: [PATCH 13/15] device-bt, device-modem: listen for data port changes in the `NMModem'
- Date: Wed, 24 Oct 2012 19:27:12 +0200
The new ModemManager1-based `NMModemBroadband' objects will set the data port
information only after having created the bearer as part of the connection
process. The devices, therefore, need to listen to changes in the `data-port'
property, so that the `ip-iface' in the `NMDevice' is set before finishing the
stage1 of the activation. This is required in order to have a proper ifup of the
data port.
---
src/nm-device-bt.c | 15 ++++++++++++++-
src/nm-device-modem.c | 15 +++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/src/nm-device-bt.c b/src/nm-device-bt.c
index 8dce2f9..b0f42e1 100644
--- a/src/nm-device-bt.c
+++ b/src/nm-device-bt.c
@@ -578,6 +578,14 @@ modem_ip4_config_result (NMModem *self,
}
}
+static void
+data_port_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
+{
+ NMDevice *self = NM_DEVICE (user_data);
+
+ nm_device_set_ip_iface (self, nm_modem_get_data_port (modem));
+}
+
static gboolean
modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *reason)
{
@@ -672,7 +680,12 @@ nm_device_bt_modem_added (NMDeviceBt *self,
g_signal_connect (modem, NM_MODEM_AUTH_REQUESTED, G_CALLBACK (modem_auth_requested), self);
g_signal_connect (modem, NM_MODEM_AUTH_RESULT, G_CALLBACK (modem_auth_result), self);
- nm_device_set_ip_iface (NM_DEVICE (self), modem_data_port);
+ /* In the old ModemManager the data port is known from the very beginning;
+ * while in the new ModemManager the data port is set afterwards when the bearer gets
+ * created */
+ if (modem_data_port)
+ nm_device_set_ip_iface (NM_DEVICE (self), modem_data_port);
+ g_signal_connect (modem, "notify::" NM_MODEM_DATA_PORT, G_CALLBACK (data_port_changed_cb), self);
/* Kick off the modem connection */
if (!modem_stage1 (self, modem, &reason))
diff --git a/src/nm-device-modem.c b/src/nm-device-modem.c
index 02c9a4a..4a3e978 100644
--- a/src/nm-device-modem.c
+++ b/src/nm-device-modem.c
@@ -162,6 +162,16 @@ modem_ip4_config_result (NMModem *self,
}
static void
+data_port_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
+{
+ NMDevice *self = NM_DEVICE (user_data);
+
+ /* We set the IP iface in the device as soon as we know it, so that we
+ * properly ifup it if needed */
+ nm_device_set_ip_iface (self, nm_modem_get_data_port (modem));
+}
+
+static void
modem_enabled_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
{
NMDeviceModem *self = NM_DEVICE_MODEM (user_data);
@@ -416,6 +426,11 @@ set_modem (NMDeviceModem *self, NMModem *modem)
g_signal_connect (modem, NM_MODEM_AUTH_RESULT, G_CALLBACK (modem_auth_result), self);
g_signal_connect (modem, "notify::" NM_MODEM_ENABLED, G_CALLBACK (modem_enabled_cb), self);
g_signal_connect (modem, "notify::" NM_MODEM_CONNECTED, G_CALLBACK (modem_connected_cb), self);
+
+ /* In the old ModemManager the data port is known from the very beginning;
+ * while in the new ModemManager the data port is set afterwards when the bearer gets
+ * created */
+ g_signal_connect (modem, "notify::" NM_MODEM_DATA_PORT, G_CALLBACK (data_port_changed_cb), self);
}
static void
--
1.7.11.7
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]