From b9bdc5da4b968ff24b12d8b37f05605153bfbd8a Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 2 Jun 2009 17:53:39 -0400 Subject: [PATCH] hal: find driver for ibmebus-type 'ehea' devices --- src/nm-hal-manager.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c index 0ed0f5d4d2..408ee02f87 100644 --- a/src/nm-hal-manager.c +++ b/src/nm-hal-manager.c @@ -128,16 +128,41 @@ 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 = libhal_device_get_property_string (ctx, origdev_udi, "info.linux.driver", NULL); - driver_name = g_strdup (drv); - libhal_free_string (drv); + if (!origdev_udi) + return NULL; + + /* 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; }