aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mm-plugin-anydata.c11
-rw-r--r--plugins/mm-plugin-generic.c11
-rw-r--r--plugins/mm-plugin-gobi.c11
-rw-r--r--plugins/mm-plugin-hso.c11
-rw-r--r--plugins/mm-plugin-huawei.c11
-rw-r--r--plugins/mm-plugin-longcheer.c11
-rw-r--r--plugins/mm-plugin-mbm.c34
-rw-r--r--plugins/mm-plugin-moto-c.c11
-rw-r--r--plugins/mm-plugin-nokia.c11
-rw-r--r--plugins/mm-plugin-novatel.c11
-rw-r--r--plugins/mm-plugin-option.c11
-rw-r--r--plugins/mm-plugin-sierra.c11
-rw-r--r--plugins/mm-plugin-zte.c11
13 files changed, 46 insertions, 120 deletions
diff --git a/plugins/mm-plugin-anydata.c b/plugins/mm-plugin-anydata.c
index fb6f84c6..94f4f105 100644
--- a/plugins/mm-plugin-anydata.c
+++ b/plugins/mm-plugin-anydata.c
@@ -106,7 +106,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
@@ -120,14 +120,6 @@ grab_port (MMPluginBase *base,
return NULL;
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
@@ -137,6 +129,7 @@ grab_port (MMPluginBase *base,
return NULL;
}
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & CAP_CDMA) {
modem = mm_modem_anydata_cdma_new (sysfs_path,
diff --git a/plugins/mm-plugin-generic.c b/plugins/mm-plugin-generic.c
index 377273e5..cdf2c66e 100644
--- a/plugins/mm-plugin-generic.c
+++ b/plugins/mm-plugin-generic.c
@@ -108,7 +108,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path, *driver;
guint32 caps;
@@ -133,15 +133,8 @@ grab_port (MMPluginBase *base,
}
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_generic_gsm_new (sysfs_path,
diff --git a/plugins/mm-plugin-gobi.c b/plugins/mm-plugin-gobi.c
index a504085f..fbe38783 100644
--- a/plugins/mm-plugin-gobi.c
+++ b/plugins/mm-plugin-gobi.c
@@ -102,7 +102,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *sysfs_path;
guint32 caps;
@@ -110,18 +110,11 @@ grab_port (MMPluginBase *base,
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_modem_gobi_gsm_new (sysfs_path,
diff --git a/plugins/mm-plugin-hso.c b/plugins/mm-plugin-hso.c
index 8493c9c1..dc0a8fcb 100644
--- a/plugins/mm-plugin-hso.c
+++ b/plugins/mm-plugin-hso.c
@@ -100,7 +100,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *sysfs_path;
char *devfile;
@@ -131,18 +131,11 @@ grab_port (MMPluginBase *base,
}
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- goto out;
- }
-
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
if (!(caps & MM_PLUGIN_BASE_PORT_CAP_GSM) && strcmp (subsys, "net"))
goto out;
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
modem = mm_modem_hso_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
diff --git a/plugins/mm-plugin-huawei.c b/plugins/mm-plugin-huawei.c
index ab17139b..b4c97d6e 100644
--- a/plugins/mm-plugin-huawei.c
+++ b/plugins/mm-plugin-huawei.c
@@ -264,7 +264,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
@@ -279,14 +279,6 @@ grab_port (MMPluginBase *base,
return NULL;
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
@@ -296,6 +288,7 @@ grab_port (MMPluginBase *base,
}
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_modem_huawei_gsm_new (sysfs_path,
diff --git a/plugins/mm-plugin-longcheer.c b/plugins/mm-plugin-longcheer.c
index 941238cb..f1b43ecf 100644
--- a/plugins/mm-plugin-longcheer.c
+++ b/plugins/mm-plugin-longcheer.c
@@ -107,7 +107,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *sysfs_path;
guint32 caps;
@@ -133,18 +133,11 @@ grab_port (MMPluginBase *base,
&& g_udev_device_get_property_as_boolean (port, "ID_MM_LONGCHEER_TAGGED"))
ptype = MM_PORT_TYPE_IGNORED;
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_generic_gsm_new (sysfs_path,
diff --git a/plugins/mm-plugin-mbm.c b/plugins/mm-plugin-mbm.c
index a80bd913..5554d84f 100644
--- a/plugins/mm-plugin-mbm.c
+++ b/plugins/mm-plugin-mbm.c
@@ -62,9 +62,12 @@ supports_port (MMPluginBase *base,
MMModem *existing,
MMPluginBaseSupportsTask *task)
{
+ GUdevClient *client;
+ const char *sys[] = { "tty", "net", NULL };
GUdevDevice *port, *physdev;
guint32 cached = 0, level;
- const char *driver, *subsys;
+ const char *driver, *subsys, *physdev_path;
+ gboolean is_mbm;
/* Can't do anything with non-serial ports */
port = mm_plugin_base_supports_task_get_port (task);
@@ -79,9 +82,23 @@ supports_port (MMPluginBase *base,
if (!driver)
return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
- physdev = mm_plugin_base_supports_task_get_physdev (task);
+ client = g_udev_client_new (sys);
+ if (!client) {
+ g_warning ("mbm: could not get udev client.");
+ return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
+ }
+
+ /* Look up the port's physical device and see if this port is really an
+ * 'mbm' modem, since we have no other way of telling.
+ */
+ physdev_path = mm_plugin_base_supports_task_get_physdev_path (task);
+ physdev = g_udev_client_query_by_sysfs_path (client, physdev_path);
g_assert (physdev);
- if (!g_udev_device_get_property_as_boolean (physdev, "ID_MM_ERICSSON_MBM"))
+
+ is_mbm = g_udev_device_get_property_as_boolean (physdev, "ID_MM_ERICSSON_MBM");
+ g_object_unref (client);
+
+ if (!is_mbm)
return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
if (!strcmp (subsys, "net")) {
@@ -111,7 +128,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *sysfs_path;
guint32 caps;
@@ -119,14 +136,6 @@ grab_port (MMPluginBase *base,
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
@@ -134,6 +143,7 @@ grab_port (MMPluginBase *base,
if (!(caps & MM_PLUGIN_BASE_PORT_CAP_GSM) && strcmp (subsys, "net"))
return NULL;
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
modem = mm_modem_mbm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
diff --git a/plugins/mm-plugin-moto-c.c b/plugins/mm-plugin-moto-c.c
index 4f2a49c1..d798af4c 100644
--- a/plugins/mm-plugin-moto-c.c
+++ b/plugins/mm-plugin-moto-c.c
@@ -102,7 +102,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
@@ -115,17 +115,10 @@ grab_port (MMPluginBase *base,
return NULL;
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
modem = mm_modem_moto_c_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
diff --git a/plugins/mm-plugin-nokia.c b/plugins/mm-plugin-nokia.c
index 0bcf3945..2d0d6aff 100644
--- a/plugins/mm-plugin-nokia.c
+++ b/plugins/mm-plugin-nokia.c
@@ -105,7 +105,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
@@ -119,18 +119,11 @@ grab_port (MMPluginBase *base,
return NULL;
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_modem_nokia_new (sysfs_path,
diff --git a/plugins/mm-plugin-novatel.c b/plugins/mm-plugin-novatel.c
index 3b594818..a968836a 100644
--- a/plugins/mm-plugin-novatel.c
+++ b/plugins/mm-plugin-novatel.c
@@ -111,7 +111,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
@@ -125,18 +125,11 @@ grab_port (MMPluginBase *base,
return NULL;
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_modem_novatel_gsm_new (sysfs_path,
diff --git a/plugins/mm-plugin-option.c b/plugins/mm-plugin-option.c
index 694eebf3..101f9bd4 100644
--- a/plugins/mm-plugin-option.c
+++ b/plugins/mm-plugin-option.c
@@ -101,7 +101,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
@@ -117,14 +117,6 @@ grab_port (MMPluginBase *base,
return NULL;
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
@@ -138,6 +130,7 @@ grab_port (MMPluginBase *base,
ptype = MM_PORT_TYPE_PRIMARY;
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_modem_option_new (sysfs_path,
diff --git a/plugins/mm-plugin-sierra.c b/plugins/mm-plugin-sierra.c
index 2b646674..8ace6532 100644
--- a/plugins/mm-plugin-sierra.c
+++ b/plugins/mm-plugin-sierra.c
@@ -123,7 +123,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
@@ -138,14 +138,6 @@ grab_port (MMPluginBase *base,
return NULL;
}
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
@@ -154,6 +146,7 @@ grab_port (MMPluginBase *base,
ptype = MM_PORT_TYPE_SECONDARY;
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if ((caps & MM_PLUGIN_BASE_PORT_CAP_GSM) || (ptype != MM_PORT_TYPE_UNKNOWN)) {
modem = mm_modem_sierra_gsm_new (sysfs_path,
diff --git a/plugins/mm-plugin-zte.c b/plugins/mm-plugin-zte.c
index 486c4361..e943bbfe 100644
--- a/plugins/mm-plugin-zte.c
+++ b/plugins/mm-plugin-zte.c
@@ -116,7 +116,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
- GUdevDevice *port = NULL, *physdev = NULL;
+ GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *sysfs_path;
guint32 caps;
@@ -131,18 +131,11 @@ grab_port (MMPluginBase *base,
else if (g_udev_device_get_property_as_boolean (port, "ID_MM_ZTE_PORT_TYPE_AUX"))
ptype = MM_PORT_TYPE_SECONDARY;
- physdev = mm_plugin_base_supports_task_get_physdev (task);
- g_assert (physdev);
- sysfs_path = g_udev_device_get_sysfs_path (physdev);
- if (!sysfs_path) {
- g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
- return NULL;
- }
-
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
+ sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_modem_zte_new (sysfs_path,