diff options
-rw-r--r-- | src/nm-hal-manager.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c index 8d8ac09333..39f3cd3b18 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); } |