core: allow identifying devices by a user-provided 'uid'

All ports of the same modem reported by the kernel will all be associated with
a common 'uid' (unique id), which uniquely identifies the physical device. This
logic was already in place, what we do now is avoid calling it  the 'sysfs
path' of the physical device, because we may not want to use that to identify
a device.

This logic now also enables the possibility of "naming" the modems in a unique
way by setting the "ID_MM_PHYSDEV_UID" property in the "usb_device" that owns
all the ports.

E.g. a custom device has 4 modems in 4 different USB ports. The device path of
each USB device will always be the same, so the naming rules could go like this:

    $ vim /usr/lib/udev/rules.d/78-mm-naming.rules

    ACTION!="add|change|move", GOTO="mm_naming_rules_end"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.1", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-1"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.2", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-2"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.3", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-3"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.4", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-4"
    LABEL="mm_naming_rules_end"

Each of the modems found will have a unique UID retrieved from the previous list
of rules. Then, "mmcli" has also been updated to allow using the UID instead of
the modem DBus path or index, e.g.:

    $ sudo mmcli -m USB-MODEM-1
    /org/freedesktop/ModemManager1/Modem/0 (device id '988d83252c0598f670c2d69d5f41e077204a92fd')
      -------------------------
      Hardware |   manufacturer: 'ZTE CORPORATION'
               |          model: 'MF637'
               |       revision: 'BD_W7P673A3F3V1.0.0B04'
               |      supported: 'gsm-umts'
               |        current: 'gsm-umts'
               |   equipment id: '356516027657837'
      -------------------------
      System   |         device: 'USB-MODEM-1'
               |        drivers: 'option'
               |         plugin: 'ZTE'
               |   primary port: 'ttyUSB5'
               |          ports: 'ttyUSB5 (at)'
    ...

    $ sudo mmcli -m USB-MODEM-1 --enable
    ...
This commit is contained in:
Aleksander Morgado
2016-09-29 15:41:21 +02:00
parent e5fa0233bb
commit 1f813c4e96
38 changed files with 225 additions and 178 deletions
+70 -28
View File
@@ -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;
if (g_str_equal (mm_object_get_path (modem), modem_path)) {
found = g_object_ref (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 (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;
}
return modem_path;
/* 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;
}
/* 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;
}
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+3 -3
View File
@@ -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,
+3 -3
View File
@@ -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,
+7 -7
View File
@@ -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,
+4 -4
View File
@@ -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,
+2 -2
View File
@@ -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,
+4 -4
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+3 -3
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+3 -3
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+3 -3
View File
@@ -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,
+2 -2
View File
@@ -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,
+3 -3
View File
@@ -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,
+4 -4
View File
@@ -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,
+3 -3
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+3 -3
View File
@@ -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,
+5 -5
View File
@@ -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,
+31 -35
View File
@@ -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
+32 -23
View File
@@ -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,
+3 -3
View File
@@ -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);
+3 -3
View File
@@ -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,
+1 -1
View File
@@ -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),
+1 -1
View File
@@ -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,