aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/mmcli-common.c98
-rw-r--r--cli/mmcli-common.h4
-rw-r--r--plugins/altair/mm-plugin-altair-lte.c4
-rw-r--r--plugins/anydata/mm-plugin-anydata.c6
-rw-r--r--plugins/cinterion/mm-plugin-cinterion.c6
-rw-r--r--plugins/dell/mm-plugin-dell.c14
-rw-r--r--plugins/generic/mm-plugin-generic.c8
-rw-r--r--plugins/haier/mm-plugin-haier.c4
-rw-r--r--plugins/huawei/mm-plugin-huawei.c8
-rw-r--r--plugins/iridium/mm-plugin-iridium.c4
-rw-r--r--plugins/linktop/mm-plugin-linktop.c4
-rw-r--r--plugins/longcheer/mm-plugin-longcheer.c4
-rw-r--r--plugins/mbm/mm-plugin-mbm.c6
-rw-r--r--plugins/motorola/mm-plugin-motorola.c4
-rw-r--r--plugins/mtk/mm-plugin-mtk.c4
-rw-r--r--plugins/nokia/mm-plugin-nokia-icera.c4
-rw-r--r--plugins/nokia/mm-plugin-nokia.c4
-rw-r--r--plugins/novatel/mm-plugin-novatel-lte.c4
-rw-r--r--plugins/novatel/mm-plugin-novatel.c6
-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.c6
-rw-r--r--plugins/samsung/mm-plugin-samsung.c4
-rw-r--r--plugins/sierra/mm-plugin-sierra-legacy.c6
-rw-r--r--plugins/sierra/mm-plugin-sierra.c8
-rw-r--r--plugins/simtech/mm-plugin-simtech.c6
-rw-r--r--plugins/telit/mm-plugin-telit.c4
-rw-r--r--plugins/thuraya/mm-plugin-thuraya.c4
-rw-r--r--plugins/via/mm-plugin-via.c4
-rw-r--r--plugins/wavecom/mm-plugin-wavecom.c4
-rw-r--r--plugins/x22x/mm-plugin-x22x.c6
-rw-r--r--plugins/zte/mm-plugin-zte.c10
-rw-r--r--src/mm-base-manager.c66
-rw-r--r--src/mm-device.c55
-rw-r--r--src/mm-device.h6
-rw-r--r--src/mm-plugin-manager.c6
-rw-r--r--src/mm-plugin.c2
-rw-r--r--src/mm-plugin.h2
38 files changed, 225 insertions, 178 deletions
diff --git a/cli/mmcli-common.c b/cli/mmcli-common.c
index f9908e94..f48dd9c2 100644
--- a/cli/mmcli-common.c
+++ b/cli/mmcli-common.c
@@ -114,25 +114,41 @@ mmcli_get_manager_sync (GDBusConnection *connection)
static MMObject *
find_modem (MMManager *manager,
- const gchar *modem_path)
+ const gchar *modem_path,
+ const gchar *modem_uid)
{
GList *modems;
GList *l;
MMObject *found = NULL;
+ g_assert (modem_path || modem_uid);
+ g_assert (!(modem_path && modem_uid));
+
modems = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (manager));
for (l = modems; l; l = g_list_next (l)) {
- MMObject *modem = MM_OBJECT (l->data);
+ MMObject *obj;
+ MMModem *modem;
+
+ obj = MM_OBJECT (l->data);
+ modem = MM_MODEM (mm_object_get_modem (obj));
+
+ if (modem_path && g_str_equal (mm_object_get_path (obj), modem_path)) {
+ found = g_object_ref (obj);
+ break;
+ }
- if (g_str_equal (mm_object_get_path (modem), modem_path)) {
- found = g_object_ref (modem);
+ if (modem_uid && g_str_equal (mm_modem_get_device (modem), modem_uid)) {
+ found = g_object_ref (obj);
break;
}
}
g_list_free_full (modems, (GDestroyNotify) g_object_unref);
if (!found) {
- g_printerr ("error: couldn't find modem at '%s'\n", modem_path);
+ if (modem_path)
+ g_printerr ("error: couldn't find modem at '%s'\n", modem_path);
+ else if (modem_uid)
+ g_printerr ("error: couldn't find modem identified by uid '%s'\n", modem_uid);
exit (EXIT_FAILURE);
}
@@ -145,6 +161,7 @@ typedef struct {
GSimpleAsyncResult *result;
GCancellable *cancellable;
gchar *modem_path;
+ gchar *modem_uid;
} GetModemContext;
typedef struct {
@@ -168,6 +185,7 @@ get_modem_context_complete_and_free (GetModemContext *ctx)
if (ctx->cancellable)
g_object_unref (ctx->cancellable);
g_free (ctx->modem_path);
+ g_free (ctx->modem_uid);
g_free (ctx);
}
@@ -193,7 +211,7 @@ get_manager_ready (GDBusConnection *connection,
results = g_new (GetModemResults, 1);
results->manager = mmcli_get_manager_finish (res);
- results->object = find_modem (results->manager, ctx->modem_path);
+ results->object = find_modem (results->manager, ctx->modem_path, ctx->modem_uid);
/* Set operation results */
g_simple_async_result_set_op_res_gpointer (
@@ -204,37 +222,57 @@ get_manager_ready (GDBusConnection *connection,
get_modem_context_complete_and_free (ctx);
}
-static gchar *
-get_modem_path (const gchar *path_or_index)
+static void
+get_modem_path_or_uid (const gchar *str,
+ gchar **modem_path,
+ gchar **modem_uid)
{
- gchar *modem_path;
+ gboolean all_numeric;
+ guint i;
/* We must have a given modem specified */
- if (!path_or_index) {
+ if (!str || !str[0]) {
g_printerr ("error: no modem was specified\n");
exit (EXIT_FAILURE);
}
- /* Modem path may come in two ways: full DBus path or just modem index.
- * If it is a modem index, we'll need to generate the DBus path ourselves */
- if (g_str_has_prefix (path_or_index, MM_DBUS_MODEM_PREFIX)) {
- g_debug ("Assuming '%s' is the full modem path", path_or_index);
- modem_path = g_strdup (path_or_index);
- } else if (g_ascii_isdigit (path_or_index[0])) {
- g_debug ("Assuming '%s' is the modem index", path_or_index);
- modem_path = g_strdup_printf (MM_DBUS_MODEM_PREFIX "/%s", path_or_index);
- } else {
- g_printerr ("error: invalid path or index string specified: '%s'\n",
- path_or_index);
- exit (EXIT_FAILURE);
+ /* Modem path may come in three ways:
+ * a) full DBus path
+ * b) modem index
+ * c) uid
+ */
+
+ *modem_path = NULL;
+ *modem_uid = NULL;
+
+ /* If we have DBus prefix, we have the modem DBus path */
+ if (g_str_has_prefix (str, MM_DBUS_MODEM_PREFIX)) {
+ g_debug ("Assuming '%s' is the full modem path", str);
+ *modem_path = g_strdup (str);
+ return;
+ }
+
+ /* If all numeric, we have the modem index */
+ all_numeric = TRUE;
+ for (i = 0; str[i]; i++) {
+ if (!g_ascii_isdigit (str[i])) {
+ all_numeric = FALSE;
+ break;
+ }
+ }
+ if (all_numeric) {
+ g_debug ("Assuming '%s' is the modem index", str);
+ *modem_path = g_strdup_printf (MM_DBUS_MODEM_PREFIX "/%s", str);
+ return;
}
- return modem_path;
+ /* Otherwise we have the UID */
+ *modem_uid = g_strdup (str);
}
void
mmcli_get_modem (GDBusConnection *connection,
- const gchar *path_or_index,
+ const gchar *modem_str,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -242,7 +280,8 @@ mmcli_get_modem (GDBusConnection *connection,
GetModemContext *ctx;
ctx = g_new0 (GetModemContext, 1);
- ctx->modem_path = get_modem_path (path_or_index);
+ get_modem_path_or_uid (modem_str, &ctx->modem_path, &ctx->modem_uid);
+ g_assert (ctx->modem_path || ctx->modem_uid);
ctx->result = g_simple_async_result_new (G_OBJECT (connection),
callback,
user_data,
@@ -261,17 +300,20 @@ mmcli_get_modem_sync (GDBusConnection *connection,
{
MMManager *manager;
MMObject *found;
- gchar *modem_path;
+ gchar *modem_path = NULL;
+ gchar *modem_uid = NULL;
manager = mmcli_get_manager_sync (connection);
- modem_path = get_modem_path (modem_str);
- found = find_modem (manager, modem_path);
+ get_modem_path_or_uid (modem_str, &modem_path, &modem_uid);
+ g_assert (modem_path || modem_uid);
+ found = find_modem (manager, modem_path, modem_uid);
if (o_manager)
*o_manager = manager;
else
g_object_unref (manager);
g_free (modem_path);
+ g_free (modem_uid);
return found;
}
diff --git a/cli/mmcli-common.h b/cli/mmcli-common.h
index fec19203..f38429b7 100644
--- a/cli/mmcli-common.h
+++ b/cli/mmcli-common.h
@@ -35,14 +35,14 @@ MMManager *mmcli_get_manager_sync (GDBusConnection *connection);
void mmcli_get_modem (GDBusConnection *connection,
- const gchar *path_or_index,
+ const gchar *modem_str,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
MMObject *mmcli_get_modem_finish (GAsyncResult *res,
MMManager **o_manager);
MMObject *mmcli_get_modem_sync (GDBusConnection *connection,
- const gchar *path_or_index,
+ const gchar *modem_str,
MMManager **o_manager);
void mmcli_get_bearer (GDBusConnection *connection,
diff --git a/plugins/altair/mm-plugin-altair-lte.c b/plugins/altair/mm-plugin-altair-lte.c
index 751a6dfb..7f6a7c0b 100644
--- a/plugins/altair/mm-plugin-altair-lte.c
+++ b/plugins/altair/mm-plugin-altair-lte.c
@@ -51,14 +51,14 @@ static const MMPortProbeAtCommand custom_at_probe[] = {
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_altair_lte_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_altair_lte_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/anydata/mm-plugin-anydata.c b/plugins/anydata/mm-plugin-anydata.c
index ff766977..8037fb7a 100644
--- a/plugins/anydata/mm-plugin-anydata.c
+++ b/plugins/anydata/mm-plugin-anydata.c
@@ -38,7 +38,7 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -48,7 +48,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered AnyDATA modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -56,7 +56,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_anydata_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_anydata_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/cinterion/mm-plugin-cinterion.c b/plugins/cinterion/mm-plugin-cinterion.c
index 2ee561a8..d65ad53d 100644
--- a/plugins/cinterion/mm-plugin-cinterion.c
+++ b/plugins/cinterion/mm-plugin-cinterion.c
@@ -130,7 +130,7 @@ cinterion_custom_init (MMPortProbe *probe,
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -140,7 +140,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Cinterion modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_cinterion_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_cinterion_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -148,7 +148,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_cinterion_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_cinterion_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/dell/mm-plugin-dell.c b/plugins/dell/mm-plugin-dell.c
index 2ed43758..87add676 100644
--- a/plugins/dell/mm-plugin-dell.c
+++ b/plugins/dell/mm-plugin-dell.c
@@ -367,7 +367,7 @@ port_probe_list_has_manufacturer_port (GList *probes,
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -381,7 +381,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Dell-branded modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -392,7 +392,7 @@ create_modem (MMPlugin *self,
#if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) {
mm_dbg ("MBIM-powered Dell-branded modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_mbim_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -402,7 +402,7 @@ create_modem (MMPlugin *self,
if (port_probe_list_has_manufacturer_port (probes, DELL_MANUFACTURER_NOVATEL)) {
mm_dbg ("Novatel-powered Dell-branded modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_novatel_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_novatel_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -411,7 +411,7 @@ create_modem (MMPlugin *self,
if (port_probe_list_has_manufacturer_port (probes, DELL_MANUFACTURER_SIERRA)) {
mm_dbg ("Sierra-powered Dell-branded modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_sierra_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_sierra_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -420,7 +420,7 @@ create_modem (MMPlugin *self,
if (port_probe_list_has_manufacturer_port (probes, DELL_MANUFACTURER_TELIT)) {
mm_dbg ("Telit-powered Dell-branded modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_telit_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_telit_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -428,7 +428,7 @@ create_modem (MMPlugin *self,
}
mm_dbg ("Dell-branded generic modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/generic/mm-plugin-generic.c b/plugins/generic/mm-plugin-generic.c
index 8fd0bdc1..8f429302 100644
--- a/plugins/generic/mm-plugin-generic.c
+++ b/plugins/generic/mm-plugin-generic.c
@@ -50,7 +50,7 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -60,7 +60,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered generic modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -71,7 +71,7 @@ create_modem (MMPlugin *self,
#if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) {
mm_dbg ("MBIM-powered generic modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_mbim_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -79,7 +79,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/haier/mm-plugin-haier.c b/plugins/haier/mm-plugin-haier.c
index ccc26b00..c56a148b 100644
--- a/plugins/haier/mm-plugin-haier.c
+++ b/plugins/haier/mm-plugin-haier.c
@@ -32,14 +32,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/huawei/mm-plugin-huawei.c b/plugins/huawei/mm-plugin-huawei.c
index 5d556e7c..3bb303ac 100644
--- a/plugins/huawei/mm-plugin-huawei.c
+++ b/plugins/huawei/mm-plugin-huawei.c
@@ -481,7 +481,7 @@ propagate_port_mode_results (GList *probes)
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -493,7 +493,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Huawei modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -504,7 +504,7 @@ create_modem (MMPlugin *self,
#if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) {
mm_dbg ("MBIM-powered Huawei modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_mbim_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -512,7 +512,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_huawei_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_huawei_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/iridium/mm-plugin-iridium.c b/plugins/iridium/mm-plugin-iridium.c
index d79df0fc..08c05515 100644
--- a/plugins/iridium/mm-plugin-iridium.c
+++ b/plugins/iridium/mm-plugin-iridium.c
@@ -38,14 +38,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_iridium_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_iridium_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/linktop/mm-plugin-linktop.c b/plugins/linktop/mm-plugin-linktop.c
index 7fb41a3e..771f335f 100644
--- a/plugins/linktop/mm-plugin-linktop.c
+++ b/plugins/linktop/mm-plugin-linktop.c
@@ -33,14 +33,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_linktop_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_linktop_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/longcheer/mm-plugin-longcheer.c b/plugins/longcheer/mm-plugin-longcheer.c
index 59f2d8ed..ea110703 100644
--- a/plugins/longcheer/mm-plugin-longcheer.c
+++ b/plugins/longcheer/mm-plugin-longcheer.c
@@ -186,14 +186,14 @@ longcheer_custom_init (MMPortProbe *probe,
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_longcheer_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_longcheer_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/mbm/mm-plugin-mbm.c b/plugins/mbm/mm-plugin-mbm.c
index 20004444..b4b27526 100644
--- a/plugins/mbm/mm-plugin-mbm.c
+++ b/plugins/mbm/mm-plugin-mbm.c
@@ -40,7 +40,7 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -50,7 +50,7 @@ create_modem (MMPlugin *self,
#if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) {
mm_dbg ("MBIM-powered Ericsson modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_mbim_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -58,7 +58,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_mbm_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_mbm_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/motorola/mm-plugin-motorola.c b/plugins/motorola/mm-plugin-motorola.c
index 96d7e4fb..68c8d483 100644
--- a/plugins/motorola/mm-plugin-motorola.c
+++ b/plugins/motorola/mm-plugin-motorola.c
@@ -34,14 +34,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_motorola_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_motorola_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/mtk/mm-plugin-mtk.c b/plugins/mtk/mm-plugin-mtk.c
index 5d3ea7dc..080aef25 100644
--- a/plugins/mtk/mm-plugin-mtk.c
+++ b/plugins/mtk/mm-plugin-mtk.c
@@ -35,14 +35,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
/* MTK done */
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_mtk_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_mtk_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/nokia/mm-plugin-nokia-icera.c b/plugins/nokia/mm-plugin-nokia-icera.c
index 58428e7c..151a4ecd 100644
--- a/plugins/nokia/mm-plugin-nokia-icera.c
+++ b/plugins/nokia/mm-plugin-nokia-icera.c
@@ -43,14 +43,14 @@ static const MMPortProbeAtCommand custom_at_probe[] = {
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_icera_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_icera_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/nokia/mm-plugin-nokia.c b/plugins/nokia/mm-plugin-nokia.c
index a3e4749d..cb3374ce 100644
--- a/plugins/nokia/mm-plugin-nokia.c
+++ b/plugins/nokia/mm-plugin-nokia.c
@@ -44,14 +44,14 @@ static const MMPortProbeAtCommand custom_at_probe[] = {
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_nokia_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_nokia_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/novatel/mm-plugin-novatel-lte.c b/plugins/novatel/mm-plugin-novatel-lte.c
index 0a7d2fbe..9182c579 100644
--- a/plugins/novatel/mm-plugin-novatel-lte.c
+++ b/plugins/novatel/mm-plugin-novatel-lte.c
@@ -35,14 +35,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_novatel_lte_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_novatel_lte_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/novatel/mm-plugin-novatel.c b/plugins/novatel/mm-plugin-novatel.c
index ccbd9a87..292f758e 100644
--- a/plugins/novatel/mm-plugin-novatel.c
+++ b/plugins/novatel/mm-plugin-novatel.c
@@ -46,7 +46,7 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -56,7 +56,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Novatel modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -64,7 +64,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_novatel_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_novatel_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/option/mm-plugin-hso.c b/plugins/option/mm-plugin-hso.c
index df5d34f0..5b9bcbd5 100644
--- a/plugins/option/mm-plugin-hso.c
+++ b/plugins/option/mm-plugin-hso.c
@@ -115,14 +115,14 @@ hso_custom_init (MMPortProbe *probe,
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_hso_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_hso_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/option/mm-plugin-option.c b/plugins/option/mm-plugin-option.c
index 77f8d768..90184ccf 100644
--- a/plugins/option/mm-plugin-option.c
+++ b/plugins/option/mm-plugin-option.c
@@ -34,14 +34,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_option_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_option_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/pantech/mm-plugin-pantech.c b/plugins/pantech/mm-plugin-pantech.c
index b7b1791d..734a41a0 100644
--- a/plugins/pantech/mm-plugin-pantech.c
+++ b/plugins/pantech/mm-plugin-pantech.c
@@ -76,7 +76,7 @@ static const MMPortProbeAtCommand custom_at_probe[] = {
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -86,7 +86,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Pantech modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -94,7 +94,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_pantech_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_pantech_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/samsung/mm-plugin-samsung.c b/plugins/samsung/mm-plugin-samsung.c
index 5434ad14..157d286c 100644
--- a/plugins/samsung/mm-plugin-samsung.c
+++ b/plugins/samsung/mm-plugin-samsung.c
@@ -36,14 +36,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_samsung_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_samsung_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/sierra/mm-plugin-sierra-legacy.c b/plugins/sierra/mm-plugin-sierra-legacy.c
index ac488cd0..47bdf113 100644
--- a/plugins/sierra/mm-plugin-sierra-legacy.c
+++ b/plugins/sierra/mm-plugin-sierra-legacy.c
@@ -37,7 +37,7 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -45,13 +45,13 @@ create_modem (MMPlugin *self,
GError **error)
{
if (mm_common_sierra_port_probe_list_is_icera (probes))
- return MM_BASE_MODEM (mm_broadband_modem_sierra_icera_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_sierra_icera_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
- return MM_BASE_MODEM (mm_broadband_modem_sierra_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_sierra_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/sierra/mm-plugin-sierra.c b/plugins/sierra/mm-plugin-sierra.c
index b6eabc4c..03a06bd8 100644
--- a/plugins/sierra/mm-plugin-sierra.c
+++ b/plugins/sierra/mm-plugin-sierra.c
@@ -43,7 +43,7 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -53,7 +53,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Sierra modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -64,7 +64,7 @@ create_modem (MMPlugin *self,
#if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) {
mm_dbg ("MBIM-powered Sierra modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_mbim_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -73,7 +73,7 @@ create_modem (MMPlugin *self,
#endif
/* Fallback to default modem in the worst case */
- return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/simtech/mm-plugin-simtech.c b/plugins/simtech/mm-plugin-simtech.c
index b7361857..aa22414c 100644
--- a/plugins/simtech/mm-plugin-simtech.c
+++ b/plugins/simtech/mm-plugin-simtech.c
@@ -38,7 +38,7 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -48,7 +48,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered SimTech modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -56,7 +56,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_simtech_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_simtech_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/telit/mm-plugin-telit.c b/plugins/telit/mm-plugin-telit.c
index 5a44ba69..caf3ef01 100644
--- a/plugins/telit/mm-plugin-telit.c
+++ b/plugins/telit/mm-plugin-telit.c
@@ -37,14 +37,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_telit_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_telit_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/thuraya/mm-plugin-thuraya.c b/plugins/thuraya/mm-plugin-thuraya.c
index 1c0782de..ce1da626 100644
--- a/plugins/thuraya/mm-plugin-thuraya.c
+++ b/plugins/thuraya/mm-plugin-thuraya.c
@@ -40,14 +40,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_thuraya_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_thuraya_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/via/mm-plugin-via.c b/plugins/via/mm-plugin-via.c
index d3e67625..a6cf5b37 100644
--- a/plugins/via/mm-plugin-via.c
+++ b/plugins/via/mm-plugin-via.c
@@ -36,14 +36,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_via_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_via_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/wavecom/mm-plugin-wavecom.c b/plugins/wavecom/mm-plugin-wavecom.c
index 9d3307c6..8ed217bd 100644
--- a/plugins/wavecom/mm-plugin-wavecom.c
+++ b/plugins/wavecom/mm-plugin-wavecom.c
@@ -40,14 +40,14 @@ MM_PLUGIN_DEFINE_MINOR_VERSION
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
- return MM_BASE_MODEM (mm_broadband_modem_wavecom_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_wavecom_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/x22x/mm-plugin-x22x.c b/plugins/x22x/mm-plugin-x22x.c
index 68b897f8..8e210756 100644
--- a/plugins/x22x/mm-plugin-x22x.c
+++ b/plugins/x22x/mm-plugin-x22x.c
@@ -189,7 +189,7 @@ x22x_custom_init (MMPortProbe *probe,
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -199,7 +199,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered X22X modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -207,7 +207,7 @@ create_modem (MMPlugin *self,
}
#endif
- return MM_BASE_MODEM (mm_broadband_modem_x22x_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_x22x_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/plugins/zte/mm-plugin-zte.c b/plugins/zte/mm-plugin-zte.c
index 075c3147..239ee6b6 100644
--- a/plugins/zte/mm-plugin-zte.c
+++ b/plugins/zte/mm-plugin-zte.c
@@ -61,7 +61,7 @@ static const MMPortProbeAtCommand custom_at_probe[] = {
static MMBaseModem *
create_modem (MMPlugin *self,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,
@@ -71,7 +71,7 @@ create_modem (MMPlugin *self,
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered ZTE modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -82,7 +82,7 @@ create_modem (MMPlugin *self,
#if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) {
mm_dbg ("MBIM-powered ZTE modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_mbim_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
@@ -91,13 +91,13 @@ create_modem (MMPlugin *self,
#endif
if (mm_port_probe_list_is_icera (probes))
- return MM_BASE_MODEM (mm_broadband_modem_zte_icera_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_zte_icera_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
- return MM_BASE_MODEM (mm_broadband_modem_zte_new (sysfs_path,
+ return MM_BASE_MODEM (mm_broadband_modem_zte_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
diff --git a/src/mm-base-manager.c b/src/mm-base-manager.c
index 275a855f..cdc5d54a 100644
--- a/src/mm-base-manager.c
+++ b/src/mm-base-manager.c
@@ -111,18 +111,17 @@ find_device_by_port (MMBaseManager *manager,
}
static MMDevice *
-find_device_by_sysfs_path (MMBaseManager *self,
- const gchar *sysfs_path)
+find_device_by_physdev_uid (MMBaseManager *self,
+ const gchar *physdev_uid)
{
- return g_hash_table_lookup (self->priv->devices,
- sysfs_path);
+ return g_hash_table_lookup (self->priv->devices, physdev_uid);
}
static MMDevice *
find_device_by_udev_device (MMBaseManager *manager,
GUdevDevice *udev_device)
{
- return find_device_by_sysfs_path (manager, g_udev_device_get_sysfs_path (udev_device));
+ return find_device_by_physdev_uid (manager, g_udev_device_get_sysfs_path (udev_device));
}
/*****************************************************************************/
@@ -151,8 +150,8 @@ device_support_check_ready (MMPluginManager *plugin_manager,
/* Receive plugin result from the plugin manager */
plugin = mm_plugin_manager_device_support_check_finish (plugin_manager, res, &error);
if (!plugin) {
- mm_info ("Couldn't check support for device at '%s': %s",
- mm_device_get_path (ctx->device), error->message);
+ mm_info ("Couldn't check support for device '%s': %s",
+ mm_device_get_uid (ctx->device), error->message);
g_error_free (error);
find_device_support_context_free (ctx);
return;
@@ -163,16 +162,16 @@ device_support_check_ready (MMPluginManager *plugin_manager,
g_object_unref (plugin);
if (!mm_device_create_modem (ctx->device, ctx->self->priv->object_manager, &error)) {
- mm_warn ("Couldn't create modem for device at '%s': %s",
- mm_device_get_path (ctx->device), error->message);
+ mm_warn ("Couldn't create modem for device '%s': %s",
+ mm_device_get_uid (ctx->device), error->message);
g_error_free (error);
find_device_support_context_free (ctx);
return;
}
/* Modem now created */
- mm_info ("Modem for device at '%s' successfully created",
- mm_device_get_path (ctx->device));
+ mm_info ("Modem for device '%s' successfully created",
+ mm_device_get_uid (ctx->device));
find_device_support_context_free (ctx);
}
@@ -268,19 +267,16 @@ device_removed (MMBaseManager *self,
/* Handle tty/net/wdm port removal */
device = find_device_by_port (self, udev_device);
if (device) {
- mm_info ("(%s/%s): released by modem %s",
- subsys,
- name,
- g_udev_device_get_sysfs_path (mm_device_peek_udev_device (device)));
+ mm_info ("(%s/%s): released by device '%s'", subsys, name, mm_device_get_uid (device));
mm_device_release_port (device, udev_device);
/* If port probe list gets empty, remove the device object iself */
if (!mm_device_peek_port_probe_list (device)) {
- mm_dbg ("Removing empty device '%s'", mm_device_get_path (device));
+ mm_dbg ("Removing empty device '%s'", mm_device_get_uid (device));
if (mm_plugin_manager_device_support_check_cancel (self->priv->plugin_manager, device))
mm_dbg ("Device support check has been cancelled");
mm_device_remove_modem (device);
- g_hash_table_remove (self->priv->devices, mm_device_get_path (device));
+ g_hash_table_remove (self->priv->devices, mm_device_get_uid (device));
}
}
@@ -297,9 +293,9 @@ device_removed (MMBaseManager *self,
*/
device = find_device_by_udev_device (self, udev_device);
if (device) {
- mm_dbg ("Removing device '%s'", mm_device_get_path (device));
+ mm_dbg ("Removing device '%s'", mm_device_get_uid (device));
mm_device_remove_modem (device);
- g_hash_table_remove (self->priv->devices, mm_device_get_path (device));
+ g_hash_table_remove (self->priv->devices, mm_device_get_uid (device));
return;
}
@@ -314,7 +310,7 @@ device_added (MMBaseManager *manager,
gboolean manual_scan)
{
MMDevice *device;
- const char *subsys, *name, *physdev_path, *physdev_subsys;
+ const char *subsys, *name, *physdev_uid, *physdev_subsys;
gboolean is_candidate;
GUdevDevice *physdev = NULL;
@@ -389,21 +385,21 @@ device_added (MMBaseManager *manager,
goto out;
}
- physdev_path = g_udev_device_get_sysfs_path (physdev);
- if (!physdev_path) {
+ physdev_uid = g_udev_device_get_sysfs_path (physdev);
+ if (!physdev_uid) {
mm_dbg ("(%s/%s): could not get port's parent device sysfs path", subsys, name);
goto out;
}
/* See if we already created an object to handle ports in this device */
- device = find_device_by_sysfs_path (manager, physdev_path);
+ device = find_device_by_physdev_uid (manager, physdev_uid);
if (!device) {
FindDeviceSupportContext *ctx;
/* Keep the device listed in the Manager */
device = mm_device_new (physdev, hotplugged);
g_hash_table_insert (manager->priv->devices,
- g_strdup (physdev_path),
+ g_strdup (physdev_uid),
device);
/* Launch device support check */
@@ -754,15 +750,15 @@ handle_set_profile (MmGdbusTest *skeleton,
{
MMPlugin *plugin;
MMDevice *device;
- gchar *physdev;
+ gchar *physdev_uid;
GError *error = NULL;
mm_info ("Test profile set to: '%s'", id);
/* Create device and keep it listed in the Manager */
- physdev = g_strdup_printf ("/virtual/%s", id);
- device = mm_device_virtual_new (physdev, TRUE);
- g_hash_table_insert (self->priv->devices, physdev, device);
+ physdev_uid = g_strdup_printf ("/virtual/%s", id);
+ device = mm_device_virtual_new (physdev_uid, TRUE);
+ g_hash_table_insert (self->priv->devices, physdev_uid, device);
/* Grab virtual ports */
mm_device_virtual_grab_ports (device, (const gchar **)ports);
@@ -774,8 +770,8 @@ handle_set_profile (MmGdbusTest *skeleton,
MM_CORE_ERROR_NOT_FOUND,
"Requested plugin '%s' not found",
plugin_name);
- mm_warn ("Couldn't set plugin for virtual device at '%s': %s",
- mm_device_get_path (device),
+ mm_warn ("Couldn't set plugin for virtual device '%s': %s",
+ mm_device_get_uid (device),
error->message);
goto out;
}
@@ -783,20 +779,20 @@ handle_set_profile (MmGdbusTest *skeleton,
/* Create modem */
if (!mm_device_create_modem (device, self->priv->object_manager, &error)) {
- mm_warn ("Couldn't create modem for virtual device at '%s': %s",
- mm_device_get_path (device),
+ mm_warn ("Couldn't create modem for virtual device '%s': %s",
+ mm_device_get_uid (device),
error->message);
goto out;
}
- mm_info ("Modem for virtual device at '%s' successfully created",
- mm_device_get_path (device));
+ mm_info ("Modem for virtual device '%s' successfully created",
+ mm_device_get_uid (device));
out:
if (error) {
mm_device_remove_modem (device);
- g_hash_table_remove (self->priv->devices, mm_device_get_path (device));
+ g_hash_table_remove (self->priv->devices, mm_device_get_uid (device));
g_dbus_method_invocation_return_gerror (invocation, error);
g_error_free (error);
} else
diff --git a/src/mm-device.c b/src/mm-device.c
index b9ffdf83..a293149f 100644
--- a/src/mm-device.c
+++ b/src/mm-device.c
@@ -31,7 +31,7 @@ G_DEFINE_TYPE (MMDevice, mm_device, G_TYPE_OBJECT);
enum {
PROP_0,
- PROP_PATH,
+ PROP_UID,
PROP_UDEV_DEVICE,
PROP_PLUGIN,
PROP_MODEM,
@@ -53,8 +53,8 @@ struct _MMDevicePrivate {
/* Whether the device is real or virtual */
gboolean virtual;
- /* Device path */
- gchar *path;
+ /* Unique id */
+ gchar *uid;
/* Parent UDev device */
GUdevDevice *udev_device;
@@ -324,7 +324,7 @@ mm_device_grab_port (MMDevice *self,
&self->priv->vendor,
&self->priv->product)) {
mm_dbg ("(%s) could not get vendor/product ID",
- self->priv->path);
+ self->priv->uid);
}
}
@@ -447,7 +447,7 @@ export_modem (MMDevice *self)
mm_dbg ("Exported modem '%s' at path '%s'",
(self->priv->virtual ?
- self->priv->path :
+ self->priv->uid :
g_udev_device_get_sysfs_path (self->priv->udev_device)),
path);
@@ -496,12 +496,12 @@ modem_valid (MMBaseModem *modem,
GError *error = NULL;
if (!mm_device_create_modem (self, self->priv->object_manager, &error)) {
- mm_warn ("Could not recreate modem for device at '%s': %s",
- mm_device_get_path (self),
- error ? error->message : "unknown");
+ mm_warn ("Could not recreate modem for device '%s': %s",
+ self->priv->uid,
+ error ? error->message : "unknown");
g_error_free (error);
} else {
- mm_dbg ("Modem recreated for device '%s'", mm_device_get_path (self));
+ mm_dbg ("Modem recreated for device '%s'", self->priv->uid);
}
}
} else {
@@ -568,9 +568,9 @@ mm_device_create_modem (MMDevice *self,
/*****************************************************************************/
const gchar *
-mm_device_get_path (MMDevice *self)
+mm_device_get_uid (MMDevice *self)
{
- return self->priv->path;
+ return self->priv->uid;
}
const gchar **
@@ -726,23 +726,29 @@ MMDevice *
mm_device_new (GUdevDevice *udev_device,
gboolean hotplugged)
{
+ const gchar *uid;
+
g_return_val_if_fail (udev_device != NULL, NULL);
+ uid = g_udev_device_get_property (udev_device, "ID_MM_PHYSDEV_UID");
+ if (uid)
+ mm_dbg ("device with an explicit physdev UID: %s", uid);
+
return MM_DEVICE (g_object_new (MM_TYPE_DEVICE,
MM_DEVICE_UDEV_DEVICE, udev_device,
- MM_DEVICE_PATH, g_udev_device_get_sysfs_path (udev_device),
+ MM_DEVICE_UID, uid ? uid : g_udev_device_get_sysfs_path (udev_device),
MM_DEVICE_HOTPLUGGED, hotplugged,
NULL));
}
MMDevice *
-mm_device_virtual_new (const gchar *path,
+mm_device_virtual_new (const gchar *uid,
gboolean hotplugged)
{
- g_return_val_if_fail (path != NULL, NULL);
+ g_return_val_if_fail (uid != NULL, NULL);
return MM_DEVICE (g_object_new (MM_TYPE_DEVICE,
- MM_DEVICE_PATH, path,
+ MM_DEVICE_UID, uid,
MM_DEVICE_HOTPLUGGED, hotplugged,
MM_DEVICE_VIRTUAL, TRUE,
NULL));
@@ -766,9 +772,9 @@ set_property (GObject *object,
MMDevice *self = MM_DEVICE (object);
switch (prop_id) {
- case PROP_PATH:
+ case PROP_UID:
/* construct only */
- self->priv->path = g_value_dup_string (value);
+ self->priv->uid = g_value_dup_string (value);
break;
case PROP_UDEV_DEVICE:
/* construct only */
@@ -803,6 +809,9 @@ get_property (GObject *object,
MMDevice *self = MM_DEVICE (object);
switch (prop_id) {
+ case PROP_UID:
+ g_value_set_string (value, self->priv->uid);
+ break;
case PROP_UDEV_DEVICE:
g_value_set_object (value, self->priv->udev_device);
break;
@@ -843,7 +852,7 @@ finalize (GObject *object)
{
MMDevice *self = MM_DEVICE (object);
- g_free (self->priv->path);
+ g_free (self->priv->uid);
g_strfreev (self->priv->drivers);
g_strfreev (self->priv->virtual_ports);
@@ -863,13 +872,13 @@ mm_device_class_init (MMDeviceClass *klass)
object_class->finalize = finalize;
object_class->dispose = dispose;
- properties[PROP_PATH] =
- g_param_spec_string (MM_DEVICE_PATH,
- "Path",
- "Device path",
+ properties[PROP_UID] =
+ g_param_spec_string (MM_DEVICE_UID,
+ "Unique ID",
+ "Unique device id, e.g. the physical device sysfs path",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_PATH, properties[PROP_PATH]);
+ g_object_class_install_property (object_class, PROP_UID, properties[PROP_UID]);
properties[PROP_UDEV_DEVICE] =
g_param_spec_object (MM_DEVICE_UDEV_DEVICE,
diff --git a/src/mm-device.h b/src/mm-device.h
index 2da82223..57726e6c 100644
--- a/src/mm-device.h
+++ b/src/mm-device.h
@@ -34,7 +34,7 @@ typedef struct _MMDevice MMDevice;
typedef struct _MMDeviceClass MMDeviceClass;
typedef struct _MMDevicePrivate MMDevicePrivate;
-#define MM_DEVICE_PATH "path"
+#define MM_DEVICE_UID "uid"
#define MM_DEVICE_UDEV_DEVICE "udev-device"
#define MM_DEVICE_PLUGIN "plugin"
#define MM_DEVICE_MODEM "modem"
@@ -78,7 +78,7 @@ gboolean mm_device_create_modem (MMDevice *self,
GError **error);
void mm_device_remove_modem (MMDevice *self);
-const gchar *mm_device_get_path (MMDevice *self);
+const gchar *mm_device_get_uid (MMDevice *self);
const gchar **mm_device_get_drivers (MMDevice *self);
guint16 mm_device_get_vendor (MMDevice *self);
guint16 mm_device_get_product (MMDevice *self);
@@ -104,7 +104,7 @@ gboolean mm_device_get_hotplugged (MMDevice *self);
/* For testing purposes */
-MMDevice *mm_device_virtual_new (const gchar *path,
+MMDevice *mm_device_virtual_new (const gchar *uid,
gboolean hotplugged);
void mm_device_virtual_grab_ports (MMDevice *self,
const gchar **ports);
diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c
index 22965fdb..8408dc33 100644
--- a/src/mm-plugin-manager.c
+++ b/src/mm-plugin-manager.c
@@ -1355,7 +1355,7 @@ plugin_manager_peek_device_context (MMPluginManager *self,
device_context = (DeviceContext *)(l->data);
if ((device == device_context->device) ||
- (! g_strcmp0 (mm_device_get_path (device_context->device), mm_device_get_path (device))))
+ (!g_strcmp0 (mm_device_get_uid (device_context->device), mm_device_get_uid (device))))
return device_context;
}
return NULL;
@@ -1427,7 +1427,7 @@ mm_plugin_manager_device_support_check (MMPluginManager *self,
if (device_context) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS,
"Device support check task already available for device '%s'",
- mm_device_get_path (device));
+ mm_device_get_uid (device));
g_object_unref (task);
return;
}
@@ -1439,7 +1439,7 @@ mm_plugin_manager_device_support_check (MMPluginManager *self,
self->priv->device_contexts = g_list_prepend (self->priv->device_contexts, device_context);
mm_dbg ("[plugin manager] task %s: new support task for device: %s",
- device_context->name, mm_device_get_path (device_context->device));
+ device_context->name, mm_device_get_uid (device_context->device));
/* Run device context */
device_context_run (self,
diff --git a/src/mm-plugin.c b/src/mm-plugin.c
index 78b767d8..0d9b4087 100644
--- a/src/mm-plugin.c
+++ b/src/mm-plugin.c
@@ -865,7 +865,7 @@ mm_plugin_create_modem (MMPlugin *self,
/* Let the plugin create the modem from the port probe results */
modem = MM_PLUGIN_GET_CLASS (self)->create_modem (MM_PLUGIN (self),
- mm_device_get_path (device),
+ mm_device_get_uid (device),
mm_device_get_drivers (device),
mm_device_get_vendor (device),
mm_device_get_product (device),
diff --git a/src/mm-plugin.h b/src/mm-plugin.h
index 04916794..afe300ad 100644
--- a/src/mm-plugin.h
+++ b/src/mm-plugin.h
@@ -104,7 +104,7 @@ struct _MMPluginClass {
/* Plugins need to provide a method to create a modem object given
* a list of port probes (Mandatory) */
MMBaseModem *(*create_modem) (MMPlugin *plugin,
- const gchar *sysfs_path,
+ const gchar *uid,
const gchar **drivers,
guint16 vendor,
guint16 product,