manager: don't try to export already exported modems
This commit is contained in:
@@ -161,9 +161,11 @@ static void
|
|||||||
check_export_modem (MMManager *self,
|
check_export_modem (MMManager *self,
|
||||||
MMBaseModem *modem)
|
MMBaseModem *modem)
|
||||||
{
|
{
|
||||||
|
static guint32 id = 0;
|
||||||
const gchar *modem_physdev;
|
const gchar *modem_physdev;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
const gchar *subsys;
|
const gchar *subsys;
|
||||||
|
gchar *path;
|
||||||
|
|
||||||
/* A modem is only exported to D-Bus when both of the following are true:
|
/* A modem is only exported to D-Bus when both of the following are true:
|
||||||
*
|
*
|
||||||
@@ -192,11 +194,23 @@ check_export_modem (MMManager *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No outstanding port tasks, so if the modem is valid we can export it */
|
/* If modem not yet valid, don't export it */
|
||||||
if (mm_base_modem_get_valid (modem)) {
|
if (!mm_base_modem_get_valid (modem)) {
|
||||||
gchar *path;
|
mm_dbg ("Not exporting invalid modem '%s'", modem_physdev);
|
||||||
static guint32 id = 0;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't export already exported modems */
|
||||||
|
g_object_get (modem,
|
||||||
|
"g-object-path", &path,
|
||||||
|
NULL);
|
||||||
|
if (path) {
|
||||||
|
g_free (path);
|
||||||
|
mm_dbg ("Modem '%s' already exported", modem_physdev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No outstanding port tasks, so if the modem is valid we can export it */
|
||||||
path = g_strdup_printf (MM_DBUS_PATH"/Modems/%d", id++);
|
path = g_strdup_printf (MM_DBUS_PATH"/Modems/%d", id++);
|
||||||
g_object_set (modem,
|
g_object_set (modem,
|
||||||
"g-object-path", path,
|
"g-object-path", path,
|
||||||
@@ -209,10 +223,6 @@ check_export_modem (MMManager *self,
|
|||||||
|
|
||||||
/* Once connected, dump additional debug info about the modem */
|
/* Once connected, dump additional debug info about the modem */
|
||||||
debug_modem_info (self, modem);
|
debug_modem_info (self, modem);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mm_dbg ("Not exporting invalid modem '%s'", modem_physdev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user