aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-09-28 20:34:48 +0200
committerAleksander Morgado <aleksander@aleksander.es>2016-09-29 15:43:05 +0200
commitae9ede926a1747216b54e22398edde203ec9a03c (patch)
treec6d1c405982051497ed78fbbfc7cbb6a3f16e5e4 /plugins
parentc4a584416ab4af81b6cae653625c78f9158de1e6 (diff)
core: use the kernel device object in the port object and the plugin interface
The mm_base_modem_grab_port() now receives a MMKernelDevice directly from the plugin, which is then stored in the MMPort corresponding to the port. This means that we have direct access to e.g. all properties set by udev rules everywhere, and we don't need additional GUdevClient objects (e.g. like the one used in the Huawei plugin to detect NDISDUP support during runtime). For virtual ports (e.g. generated during unit tests), we have a new 'generic' kernel device object which just provides the values from the kernel device properties given during its creation.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/cinterion/mm-plugin-cinterion.c4
-rw-r--r--plugins/dell/mm-plugin-dell.c4
-rw-r--r--plugins/haier/mm-plugin-haier.c4
-rw-r--r--plugins/huawei/mm-broadband-modem-huawei.c29
-rw-r--r--plugins/huawei/mm-plugin-huawei.c4
-rw-r--r--plugins/longcheer/mm-plugin-longcheer.c4
-rw-r--r--plugins/mbm/mm-plugin-mbm.c4
-rw-r--r--plugins/mtk/mm-plugin-mtk.c4
-rw-r--r--plugins/nokia/mm-plugin-nokia-icera.c4
-rw-r--r--plugins/option/mm-plugin-hso.c4
-rw-r--r--plugins/option/mm-plugin-option.c4
-rw-r--r--plugins/pantech/mm-plugin-pantech.c4
-rw-r--r--plugins/sierra/mm-common-sierra.c4
-rw-r--r--plugins/simtech/mm-plugin-simtech.c4
-rw-r--r--plugins/telit/mm-common-telit.c4
-rw-r--r--plugins/x22x/mm-plugin-x22x.c4
-rw-r--r--plugins/zte/mm-plugin-zte.c4
17 files changed, 23 insertions, 70 deletions
diff --git a/plugins/cinterion/mm-plugin-cinterion.c b/plugins/cinterion/mm-plugin-cinterion.c
index 4492cdac..3bf19d1d 100644
--- a/plugins/cinterion/mm-plugin-cinterion.c
+++ b/plugins/cinterion/mm-plugin-cinterion.c
@@ -187,9 +187,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ mm_port_probe_peek_port (probe),
ptype,
pflags,
error);
diff --git a/plugins/dell/mm-plugin-dell.c b/plugins/dell/mm-plugin-dell.c
index 290faa83..5efcb192 100644
--- a/plugins/dell/mm-plugin-dell.c
+++ b/plugins/dell/mm-plugin-dell.c
@@ -450,9 +450,7 @@ grab_port (MMPlugin *self,
return telit_grab_port (self, modem, probe, error);
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ mm_port_probe_peek_port (probe),
mm_port_probe_get_port_type (probe),
MM_PORT_SERIAL_AT_FLAG_NONE,
error);
diff --git a/plugins/haier/mm-plugin-haier.c b/plugins/haier/mm-plugin-haier.c
index eb0d284f..84ad8d59 100644
--- a/plugins/haier/mm-plugin-haier.c
+++ b/plugins/haier/mm-plugin-haier.c
@@ -66,9 +66,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
mm_port_probe_get_port_type (probe),
pflags,
error);
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c
index 2a7c821e..ac6964ae 100644
--- a/plugins/huawei/mm-broadband-modem-huawei.c
+++ b/plugins/huawei/mm-broadband-modem-huawei.c
@@ -26,7 +26,6 @@
#include <unistd.h>
#include <ctype.h>
#include <time.h>
-#include <gudev/gudev.h>
#include <ModemManager.h>
#define _LIBMM_INSIDE_MM
@@ -2311,7 +2310,7 @@ peek_port_at_for_data (MMBroadbandModemHuawei *self,
const gchar *net_port_parent_path;
g_warn_if_fail (mm_port_get_subsys (port) == MM_PORT_SUBSYS_NET);
- net_port_parent_path = mm_port_get_parent_path (port);
+ net_port_parent_path = mm_kernel_device_get_parent_sysfs_path (mm_port_peek_kernel_device (port));
if (!net_port_parent_path) {
mm_warn ("(%s) no parent path for net port", mm_port_get_device (port));
return NULL;
@@ -2326,7 +2325,7 @@ peek_port_at_for_data (MMBroadbandModemHuawei *self,
const gchar *wdm_port_parent_path;
g_assert (MM_IS_PORT_SERIAL_AT (l->data));
- wdm_port_parent_path = mm_port_get_parent_path (MM_PORT (l->data));
+ wdm_port_parent_path = mm_kernel_device_get_parent_sysfs_path (mm_port_peek_kernel_device (MM_PORT (l->data)));
if (wdm_port_parent_path && g_str_equal (wdm_port_parent_path, net_port_parent_path))
return MM_PORT_SERIAL_AT (l->data);
}
@@ -2354,44 +2353,30 @@ static void
ensure_ndisdup_support_checked (MMBroadbandModemHuawei *self,
MMPort *port)
{
- GUdevClient *client;
- GUdevDevice *data_device;
-
/* Check NDISDUP support the first time we need it */
if (self->priv->ndisdup_support != FEATURE_SUPPORT_UNKNOWN)
return;
/* First, check for devices which support NDISDUP on any AT port. These
* devices are tagged by udev */
- client = g_udev_client_new (NULL);
- data_device = (g_udev_client_query_by_subsystem_and_name (
- client,
- "net",
- mm_port_get_device (port)));
- if (data_device && g_udev_device_get_property_as_boolean (data_device, "ID_MM_HUAWEI_NDISDUP_SUPPORTED")) {
+ if (mm_kernel_device_get_property_as_boolean (mm_port_peek_kernel_device (port), "ID_MM_HUAWEI_NDISDUP_SUPPORTED")) {
mm_dbg ("This device (%s) can support ndisdup feature", mm_port_get_device (port));
self->priv->ndisdup_support = FEATURE_SUPPORTED;
- goto out;
}
-
/* Then, look for devices which have both a net port and a cdc-wdm
* AT-capable port. We assume that these devices allow NDISDUP only
* when issued in the cdc-wdm port. */
- if (peek_port_at_for_data (self, port)) {
+ else if (peek_port_at_for_data (self, port)) {
mm_dbg ("This device (%s) can support ndisdup feature on non-serial AT port",
mm_port_get_device (port));
self->priv->ndisdup_support = FEATURE_SUPPORTED;
- goto out;
}
+ if (self->priv->ndisdup_support != FEATURE_SUPPORT_UNKNOWN)
+ return;
+
mm_dbg ("This device (%s) can not support ndisdup feature", mm_port_get_device (port));
self->priv->ndisdup_support = FEATURE_NOT_SUPPORTED;
-
-out:
- if (data_device)
- g_object_unref (data_device);
- if (client)
- g_object_unref (client);
}
static void
diff --git a/plugins/huawei/mm-plugin-huawei.c b/plugins/huawei/mm-plugin-huawei.c
index 2ec2ca66..f63360ca 100644
--- a/plugins/huawei/mm-plugin-huawei.c
+++ b/plugins/huawei/mm-plugin-huawei.c
@@ -560,9 +560,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
port_type,
pflags,
error);
diff --git a/plugins/longcheer/mm-plugin-longcheer.c b/plugins/longcheer/mm-plugin-longcheer.c
index 1b692c15..63bc7c61 100644
--- a/plugins/longcheer/mm-plugin-longcheer.c
+++ b/plugins/longcheer/mm-plugin-longcheer.c
@@ -236,9 +236,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
ptype,
pflags,
error);
diff --git a/plugins/mbm/mm-plugin-mbm.c b/plugins/mbm/mm-plugin-mbm.c
index af9b163a..9223f51b 100644
--- a/plugins/mbm/mm-plugin-mbm.c
+++ b/plugins/mbm/mm-plugin-mbm.c
@@ -86,9 +86,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
port_type,
pflags,
error);
diff --git a/plugins/mtk/mm-plugin-mtk.c b/plugins/mtk/mm-plugin-mtk.c
index 93b4c0c9..04033b5b 100644
--- a/plugins/mtk/mm-plugin-mtk.c
+++ b/plugins/mtk/mm-plugin-mtk.c
@@ -77,9 +77,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
mm_port_probe_get_port_type (probe),
pflags,
error);
diff --git a/plugins/nokia/mm-plugin-nokia-icera.c b/plugins/nokia/mm-plugin-nokia-icera.c
index e875cf4c..43c63a1b 100644
--- a/plugins/nokia/mm-plugin-nokia-icera.c
+++ b/plugins/nokia/mm-plugin-nokia-icera.c
@@ -84,9 +84,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
mm_port_probe_get_port_type (probe),
pflags,
error);
diff --git a/plugins/option/mm-plugin-hso.c b/plugins/option/mm-plugin-hso.c
index c606cc9a..3633cfd4 100644
--- a/plugins/option/mm-plugin-hso.c
+++ b/plugins/option/mm-plugin-hso.c
@@ -160,9 +160,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- subsys,
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ mm_port_probe_peek_port (probe),
port_type,
pflags,
error);
diff --git a/plugins/option/mm-plugin-option.c b/plugins/option/mm-plugin-option.c
index 6040e3d9..fa22899a 100644
--- a/plugins/option/mm-plugin-option.c
+++ b/plugins/option/mm-plugin-option.c
@@ -78,9 +78,7 @@ grab_port (MMPlugin *self,
pflags = MM_PORT_SERIAL_AT_FLAG_PRIMARY | MM_PORT_SERIAL_AT_FLAG_PPP;
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
MM_PORT_TYPE_AT, /* we only allow AT ports here */
pflags,
error);
diff --git a/plugins/pantech/mm-plugin-pantech.c b/plugins/pantech/mm-plugin-pantech.c
index 734a41a0..66eb6453 100644
--- a/plugins/pantech/mm-plugin-pantech.c
+++ b/plugins/pantech/mm-plugin-pantech.c
@@ -119,9 +119,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ mm_port_probe_peek_port (probe),
ptype,
pflags,
error);
diff --git a/plugins/sierra/mm-common-sierra.c b/plugins/sierra/mm-common-sierra.c
index fe569571..75cb5078 100644
--- a/plugins/sierra/mm-common-sierra.c
+++ b/plugins/sierra/mm-common-sierra.c
@@ -53,9 +53,7 @@ mm_common_sierra_grab_port (MMPlugin *self,
pflags = MM_PORT_SERIAL_AT_FLAG_PRIMARY;
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ mm_port_probe_peek_port (probe),
ptype,
pflags,
error);
diff --git a/plugins/simtech/mm-plugin-simtech.c b/plugins/simtech/mm-plugin-simtech.c
index b573d6ed..54544aa0 100644
--- a/plugins/simtech/mm-plugin-simtech.c
+++ b/plugins/simtech/mm-plugin-simtech.c
@@ -103,9 +103,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
ptype,
pflags,
error);
diff --git a/plugins/telit/mm-common-telit.c b/plugins/telit/mm-common-telit.c
index eaa06b06..14bf599b 100644
--- a/plugins/telit/mm-common-telit.c
+++ b/plugins/telit/mm-common-telit.c
@@ -90,9 +90,7 @@ telit_grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
ptype,
pflags,
error);
diff --git a/plugins/x22x/mm-plugin-x22x.c b/plugins/x22x/mm-plugin-x22x.c
index a1372739..6ebabdb3 100644
--- a/plugins/x22x/mm-plugin-x22x.c
+++ b/plugins/x22x/mm-plugin-x22x.c
@@ -252,9 +252,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
ptype,
pflags,
error);
diff --git a/plugins/zte/mm-plugin-zte.c b/plugins/zte/mm-plugin-zte.c
index 09eb27d0..172f275e 100644
--- a/plugins/zte/mm-plugin-zte.c
+++ b/plugins/zte/mm-plugin-zte.c
@@ -149,9 +149,7 @@ grab_port (MMPlugin *self,
}
return mm_base_modem_grab_port (modem,
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe),
- mm_port_probe_get_parent_path (probe),
+ port,
ptype,
pflags,
error);