manager: fix up composite modem device detection and suppression
Some modems have their ethernet interface show up only on connect, and we want NM to ignore the ethernet interface as a top-level device.
This commit is contained in:
@@ -48,26 +48,6 @@ nm_modem_manager_get (void)
|
|||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
nm_modem_manager_has_modem_for_iface (NMModemManager *manager,
|
|
||||||
const gchar *iface)
|
|
||||||
{
|
|
||||||
NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (manager);
|
|
||||||
GList *iter;
|
|
||||||
g_assert (manager);
|
|
||||||
g_assert (NM_IS_MODEM_MANAGER(manager));
|
|
||||||
g_assert (iface);
|
|
||||||
|
|
||||||
for (iter = g_hash_table_get_values(priv->modems); iter != NULL; iter = iter->next) {
|
|
||||||
NMModem *modem = NM_MODEM (iter->data);
|
|
||||||
const char *modem_iface = nm_modem_get_iface (modem);
|
|
||||||
|
|
||||||
if (!g_strcmp0 (iface, modem_iface))
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
get_modem_properties (DBusGConnection *connection,
|
get_modem_properties (DBusGConnection *connection,
|
||||||
const char *path,
|
const char *path,
|
||||||
|
@@ -30,7 +30,4 @@ GType nm_modem_manager_get_type (void);
|
|||||||
|
|
||||||
NMModemManager *nm_modem_manager_get (void);
|
NMModemManager *nm_modem_manager_get (void);
|
||||||
|
|
||||||
gboolean nm_modem_manager_has_modem_for_iface (NMModemManager *manager,
|
|
||||||
const gchar *iface);
|
|
||||||
|
|
||||||
#endif /* NM_MODEM_MANAGER_H */
|
#endif /* NM_MODEM_MANAGER_H */
|
||||||
|
@@ -127,11 +127,9 @@ static const char *internal_activate_device (NMManager *manager,
|
|||||||
gboolean assumed,
|
gboolean assumed,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
static NMDevice *
|
static NMDevice *find_device_by_iface (NMManager *self, const gchar *iface);
|
||||||
find_device_by_iface (NMManager *self, const gchar *iface);
|
|
||||||
|
|
||||||
static GSList *
|
static GSList * remove_one_device (NMManager *manager,
|
||||||
remove_one_device (NMManager *manager,
|
|
||||||
GSList *list,
|
GSList *list,
|
||||||
NMDevice *device,
|
NMDevice *device,
|
||||||
gboolean quitting,
|
gboolean quitting,
|
||||||
@@ -1214,7 +1212,7 @@ add_device (NMManager *self, NMDevice *device)
|
|||||||
iface = nm_device_get_ip_iface (device);
|
iface = nm_device_get_ip_iface (device);
|
||||||
g_assert (iface);
|
g_assert (iface);
|
||||||
|
|
||||||
if (!NM_IS_MODEM (device) && nm_modem_manager_has_modem_for_iface (priv->modem_manager, iface)) {
|
if (!NM_IS_MODEM (device) && find_device_by_iface (self, iface)) {
|
||||||
g_object_unref (device);
|
g_object_unref (device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user