summary refs log tree commit diff
path: root/src/devices/wwan
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-07-14 19:38:58 +0200
committerMichael Biebl <biebl@debian.org>2015-07-14 19:38:58 +0200
commit50a58f0fabd8a34c1b6108a107e08abe3c1ccd24 (patch)
tree6790165f39daee79e2b6c6617483320613493367 /src/devices/wwan
parentf408e27bccfacf347605a8d98649975a68f38a17 (diff)
Imported Upstream version 1.0.4 upstream/1.0.4
Diffstat (limited to 'src/devices/wwan')
-rw-r--r--src/devices/wwan/Makefile.in2
-rw-r--r--src/devices/wwan/nm-device-modem.c31
-rw-r--r--src/devices/wwan/nm-modem.c9
-rw-r--r--src/devices/wwan/nm-wwan-factory.c19
4 files changed, 39 insertions, 22 deletions
diff --git a/src/devices/wwan/Makefile.in b/src/devices/wwan/Makefile.in
index 1a8aef3b..227c622f 100644
--- a/src/devices/wwan/Makefile.in
+++ b/src/devices/wwan/Makefile.in
@@ -232,6 +232,7 @@ ACLOCAL = @ACLOCAL@
 ALL_LINGUAS = @ALL_LINGUAS@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TESTS_FD_REDIRECT = @AM_TESTS_FD_REDIRECT@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -345,6 +346,7 @@ LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@
 LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
 LN_S = @LN_S@
+LOG_DRIVER = @LOG_DRIVER@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBOBJS = @LTLIBOBJS@
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index f819d1d7..ca724c04 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -300,19 +300,9 @@ modem_state_cb (NMModem *modem,
 		nm_device_recheck_available_connections (device);
 	}
 
-	if ((dev_state >= NM_DEVICE_STATE_DISCONNECTED) && !nm_device_is_available (device, NM_DEVICE_CHECK_DEV_AVAILABLE_NONE)) {
-		nm_device_state_changed (device,
-		                         NM_DEVICE_STATE_UNAVAILABLE,
-		                         NM_DEVICE_STATE_REASON_MODEM_FAILED);
-		return;
-	}
-
-	if ((dev_state == NM_DEVICE_STATE_UNAVAILABLE) && nm_device_is_available (device, NM_DEVICE_CHECK_DEV_AVAILABLE_NONE)) {
-		nm_device_state_changed (device,
-		                         NM_DEVICE_STATE_DISCONNECTED,
-		                         NM_DEVICE_STATE_REASON_MODEM_AVAILABLE);
-		return;
-	}
+	nm_device_queue_recheck_available (device,
+	                                   NM_DEVICE_STATE_REASON_MODEM_AVAILABLE,
+	                                   NM_DEVICE_STATE_REASON_MODEM_FAILED);
 }
 
 static void
@@ -376,12 +366,24 @@ device_state_changed (NMDevice *device,
 	}
 }
 
-static guint32
+static NMDeviceCapabilities
 get_generic_capabilities (NMDevice *device)
 {
 	return NM_DEVICE_CAP_IS_NON_KERNEL;
 }
 
+static const char *
+get_type_description (NMDevice *device)
+{
+	NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device);
+
+	if (NM_FLAGS_HAS (priv->current_caps, NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS))
+		return "gsm";
+	if (NM_FLAGS_HAS (priv->current_caps, NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO))
+		return "cdma";
+	return NM_DEVICE_CLASS (nm_device_modem_parent_class)->get_type_description (device);
+}
+
 static gboolean
 check_connection_compatible (NMDevice *device, NMConnection *connection)
 {
@@ -751,6 +753,7 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass)
 	object_class->constructed = constructed;
 
 	device_class->get_generic_capabilities = get_generic_capabilities;
+	device_class->get_type_description = get_type_description;
 	device_class->check_connection_compatible = check_connection_compatible;
 	device_class->check_connection_available = check_connection_available;
 	device_class->complete_connection = complete_connection;
diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c
index 69eaddf3..3385a6fd 100644
--- a/src/devices/wwan/nm-modem.c
+++ b/src/devices/wwan/nm-modem.c
@@ -32,6 +32,7 @@
 #include "nm-device-private.h"
 #include "nm-dbus-glib-types.h"
 #include "nm-modem-enum-types.h"
+#include "nm-route-manager.h"
 
 G_DEFINE_TYPE (NMModem, nm_modem, G_TYPE_OBJECT)
 
@@ -615,7 +616,7 @@ nm_modem_ip4_pre_commit (NMModem *modem,
 
 		g_assert (address);
 		if (address->plen == 32)
-			nm_platform_link_set_noarp (nm_device_get_ip_ifindex (device));
+			nm_platform_link_set_noarp (NM_PLATFORM_GET, nm_device_get_ip_ifindex (device));
 	}
 }
 
@@ -912,9 +913,9 @@ deactivate_cleanup (NMModem *self, NMDevice *device)
 		    priv->ip6_method == NM_MODEM_IP_METHOD_AUTO) {
 			ifindex = nm_device_get_ip_ifindex (device);
 			if (ifindex > 0) {
-				nm_platform_route_flush (ifindex);
-				nm_platform_address_flush (ifindex);
-				nm_platform_link_set_down (ifindex);
+				nm_route_manager_route_flush (nm_route_manager_get (), ifindex);
+				nm_platform_address_flush (NM_PLATFORM_GET, ifindex);
+				nm_platform_link_set_down (NM_PLATFORM_GET, ifindex);
 			}
 		}
 	}
diff --git a/src/devices/wwan/nm-wwan-factory.c b/src/devices/wwan/nm-wwan-factory.c
index 2b9c3d4d..49b0b0af 100644
--- a/src/devices/wwan/nm-wwan-factory.c
+++ b/src/devices/wwan/nm-wwan-factory.c
@@ -25,9 +25,12 @@
 
 #include "nm-device-factory.h"
 #include "nm-wwan-factory.h"
+#include "nm-setting-gsm.h"
+#include "nm-setting-cdma.h"
 #include "nm-modem-manager.h"
 #include "nm-device-modem.h"
 #include "nm-logging.h"
+#include "nm-platform.h"
 
 static GType nm_wwan_factory_get_type (void);
 
@@ -87,10 +90,17 @@ modem_added_cb (NMModemManager *manager,
 }
 
 
-static NMDeviceType
-get_device_type (NMDeviceFactory *factory)
+NM_DEVICE_FACTORY_DECLARE_TYPES (
+	NM_DEVICE_FACTORY_DECLARE_LINK_TYPES    (NM_LINK_TYPE_WWAN_ETHERNET)
+	NM_DEVICE_FACTORY_DECLARE_SETTING_TYPES (NM_SETTING_GSM_SETTING_NAME, NM_SETTING_CDMA_SETTING_NAME)
+)
+
+static NMDevice *
+new_link (NMDeviceFactory *factory, NMPlatformLink *plink, gboolean *out_ignore, GError **error)
 {
-	return NM_DEVICE_TYPE_MODEM;
+	g_warn_if_fail (plink->type == NM_LINK_TYPE_WWAN_ETHERNET);
+	*out_ignore = TRUE;
+	return NULL;
 }
 
 static void
@@ -115,7 +125,8 @@ nm_wwan_factory_init (NMWwanFactory *self)
 static void
 device_factory_interface_init (NMDeviceFactory *factory_iface)
 {
-	factory_iface->get_device_type = get_device_type;
+	factory_iface->get_supported_types = get_supported_types;
+	factory_iface->new_link = new_link;
 	factory_iface->start = start;
 }