aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-04-09 17:33:22 -0700
committerDan Williams <dcbw@redhat.com>2010-04-09 17:33:22 -0700
commit41ca10e92d08c06602ae08790329878c2152b9b3 (patch)
treeabda0de6d02d0dc67dc3a4ad4eeef42ec1b463cb
parentda74f6d8ec1c6dbec227f3c0679eb3e25a510277 (diff)
core: get correct PCMCIA master device
The master device of PCMCIA-provided ports is typically the last device in the PCMCIA subsystem, because the PCMCIA controller is usually a PCI device or some other subsystem.
-rw-r--r--src/mm-manager.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/mm-manager.c b/src/mm-manager.c
index 6a01cbd0..434dc37e 100644
--- a/src/mm-manager.c
+++ b/src/mm-manager.c
@@ -636,7 +636,7 @@ find_physical_device (GUdevDevice *child)
GUdevDevice *physdev = NULL;
const char *subsys, *type;
guint32 i = 0;
- gboolean is_usb = FALSE, is_pci = FALSE;
+ gboolean is_usb = FALSE, is_pci = FALSE, is_pcmcia = FALSE;
g_return_val_if_fail (child != NULL, NULL);
@@ -651,6 +651,26 @@ find_physical_device (GUdevDevice *child)
physdev = iter;
break;
}
+ } else if (is_pcmcia || !strcmp (subsys, "pcmcia")) {
+ GUdevDevice *pcmcia_parent;
+ const char *tmp_subsys;
+
+ is_pcmcia = TRUE;
+
+ /* If the parent of this PCMCIA device is no longer part of
+ * the PCMCIA subsystem, we want to stop since we're looking
+ * for the base PCMCIA device, not the PCMCIA controller which
+ * is usually PCI or some other bus type.
+ */
+ pcmcia_parent = g_udev_device_get_parent (iter);
+ if (pcmcia_parent) {
+ tmp_subsys = g_udev_device_get_subsystem (pcmcia_parent);
+ if (tmp_subsys && strcmp (tmp_subsys, "pcmcia"))
+ physdev = iter;
+ g_object_unref (pcmcia_parent);
+ if (physdev)
+ break;
+ }
} else if (is_pci || !strcmp (subsys, "pci")) {
is_pci = TRUE;
physdev = iter;