core: move physical device checking into the manager

It turns out that the manager needs to know about the physical
device so we can prevent multiple plugins from claiming ports on
the same modem.
This commit is contained in:
Dan Williams
2010-03-30 14:50:40 -07:00
parent 39326f2491
commit 720e38aec0
18 changed files with 164 additions and 208 deletions

View File

@@ -108,7 +108,7 @@ grab_port (MMPluginBase *base,
MMPluginBaseSupportsTask *task,
GError **error)
{
GUdevDevice *port = NULL, *physdev = NULL;
GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path, *driver;
guint32 caps;
@@ -133,15 +133,8 @@ grab_port (MMPluginBase *base,
}
}
physdev = mm_plugin_base_supports_task_get_physdev (task);
g_assert (physdev);
sysfs_path = g_udev_device_get_sysfs_path (physdev);
if (!sysfs_path) {
g_set_error (error, 0, 0, "Could not get port's physical device sysfs path.");
return NULL;
}
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_generic_gsm_new (sysfs_path,