summaryrefslogtreecommitdiff
authorDan Williams <dcbw@redhat.com>2009-06-02 21:53:39 (GMT)
committer Dan Williams <dcbw@redhat.com>2009-06-02 21:53:39 (GMT)
commit4c36f7c0b607813753072acf1bec14414494948c (patch) (side-by-side diff)
treeb894525446bd86eab097caa5d39e7a9dfda0dd6f
parent2f2b5989c0d3be423469de60f1e67a8c0789e8d8 (diff)
downloadNetworkManager-4c36f7c0b607813753072acf1bec14414494948c.zip
NetworkManager-4c36f7c0b607813753072acf1bec14414494948c.tar.gz
hal: find driver for ibmebus-type 'ehea' devices
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/nm-hal-manager.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c
index 8d8ac09..39f3cd3 100644
--- a/src/nm-hal-manager.c
+++ b/src/nm-hal-manager.c
@@ -124,19 +124,40 @@ get_creator (NMHalManager *self, const char *udi)
/* Common helpers for built-in device creators */
static char *
+hal_get_subsystem (LibHalContext *ctx, const char *udi)
+{
+ char *subsys;
+
+ subsys = libhal_device_get_property_string (ctx, udi, "info.subsystem", NULL);
+ if (!subsys) {
+ /* info.bus is deprecated */
+ subsys = libhal_device_get_property_string (ctx, udi, "info.bus", NULL);
+ }
+ return subsys;
+}
+
+static char *
nm_get_device_driver_name (LibHalContext *ctx, const char *origdev_udi)
{
- char *driver_name = NULL;
+ char *driver_name = NULL, *subsystem, *drv, *od_parent = NULL;
- if (origdev_udi && libhal_device_property_exists (ctx, origdev_udi, "info.linux.driver", NULL)) {
- char *drv;
+ if (!origdev_udi)
+ return NULL;
- drv = libhal_device_get_property_string (ctx, origdev_udi, "info.linux.driver", NULL);
- if (drv) {
- driver_name = g_strdup (drv);
- libhal_free_string (drv);
- }
+ /* s390 driver name is on the grandparent of the net device */
+ subsystem = hal_get_subsystem (ctx, origdev_udi);
+ if (subsystem && !strcmp (subsystem, "ibmebus")) {
+ od_parent = libhal_device_get_property_string (ctx, origdev_udi, "info.parent", NULL);
+ origdev_udi = (const char *) od_parent;
}
+
+ drv = libhal_device_get_property_string (ctx, origdev_udi, "info.linux.driver", NULL);
+ if (drv)
+ driver_name = g_strdup (drv);
+
+ libhal_free_string (drv);
+ libhal_free_string (od_parent);
+ libhal_free_string (subsystem);
return driver_name;
}
@@ -293,19 +314,6 @@ is_modem_device (NMHalManager *self, const char *udi)
}
static char *
-hal_get_subsystem (LibHalContext *ctx, const char *udi)
-{
- char *subsys;
-
- subsys = libhal_device_get_property_string (ctx, udi, "info.subsystem", NULL);
- if (!subsys) {
- /* info.bus is deprecated */
- subsys = libhal_device_get_property_string (ctx, udi, "info.bus", NULL);
- }
- return subsys;
-}
-
-static char *
hal_get_originating_device (LibHalContext *ctx, const char *udi, const char *prefix)
{
char *od_key = g_strdup_printf ("%s.originating_device", prefix);
@@ -314,7 +322,7 @@ hal_get_originating_device (LibHalContext *ctx, const char *udi, const char *pre
od = libhal_device_get_property_string (ctx, udi, od_key, NULL);
if (!od) {
- /* info.bus is deprecated */
+ /* physical_device is deprecated */
od = libhal_device_get_property_string (ctx, udi, pd_key, NULL);
}