mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-23 11:14:29 +00:00
2008-03-07 Dan Williams <dcbw@redhat.com>
* src/nm-hal-manager.c - (nm_get_device_driver_name): use net.originating_device first, fall back to physical device. HAL has deprecated physical_device. * libnm-glib/nm-device.c - (get_product_and_vendor): use net.originating_device first, fall back to physical device. HAL has deprecated physical_device. - (nm_device_update_description): s/physical_device_udi/orig_dev_udi git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3386 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
07ec50353e
commit
593520f9a8
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2008-03-07 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-hal-manager.c
|
||||
- (nm_get_device_driver_name): use net.originating_device first, fall
|
||||
back to physical device. HAL has deprecated physical_device.
|
||||
|
||||
* libnm-glib/nm-device.c
|
||||
- (get_product_and_vendor): use net.originating_device first, fall
|
||||
back to physical device. HAL has deprecated physical_device.
|
||||
- (nm_device_update_description): s/physical_device_udi/orig_dev_udi
|
||||
|
||||
2008-03-07 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-netlink.c
|
||||
|
|
|
@ -273,7 +273,7 @@ nm_device_get_state (NMDevice *device)
|
|||
static char *
|
||||
get_product_and_vendor (DBusGConnection *connection,
|
||||
const char *udi,
|
||||
gboolean want_physdev,
|
||||
gboolean want_origdev,
|
||||
gboolean warn,
|
||||
char **product,
|
||||
char **vendor)
|
||||
|
@ -313,14 +313,38 @@ get_product_and_vendor (DBusGConnection *connection,
|
|||
err = NULL;
|
||||
}
|
||||
|
||||
if (!dbus_g_proxy_call (proxy, "GetPropertyString", &err,
|
||||
G_TYPE_STRING, want_physdev ? "net.physical_device" : "info.parent",
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_STRING, &parent,
|
||||
G_TYPE_INVALID)) {
|
||||
g_warning ("Error getting physical device info from HAL: %s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
if (want_origdev) {
|
||||
dbus_g_proxy_call (proxy, "GetPropertyString", NULL,
|
||||
G_TYPE_STRING, "net.originating_device",
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_STRING, &parent,
|
||||
G_TYPE_INVALID);
|
||||
|
||||
if (!parent) {
|
||||
/* Older HAL uses 'physical_device' */
|
||||
dbus_g_proxy_call (proxy, "GetPropertyString", &err,
|
||||
G_TYPE_STRING, "net.physical_device",
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_STRING, &parent,
|
||||
G_TYPE_INVALID);
|
||||
}
|
||||
|
||||
if (err || !parent) {
|
||||
g_warning ("Error getting originating device info from HAL: %s",
|
||||
err ? err->message : "unknown error");
|
||||
if (err)
|
||||
g_error_free (err);
|
||||
}
|
||||
} else {
|
||||
if (!dbus_g_proxy_call (proxy, "GetPropertyString", &err,
|
||||
G_TYPE_STRING, "info.parent",
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_STRING, &parent,
|
||||
G_TYPE_INVALID)) {
|
||||
g_warning ("Error getting parent device info from HAL: %s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
}
|
||||
|
||||
if (parent && tmp_product && tmp_vendor) {
|
||||
*product = tmp_product;
|
||||
|
@ -340,7 +364,7 @@ nm_device_update_description (NMDevice *device)
|
|||
NMDevicePrivate *priv;
|
||||
DBusGConnection *connection;
|
||||
char *udi;
|
||||
char *physical_device_udi = NULL;
|
||||
char *orig_dev_udi = NULL;
|
||||
char *pd_parent_udi = NULL;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE (device));
|
||||
|
@ -354,9 +378,9 @@ nm_device_update_description (NMDevice *device)
|
|||
connection = nm_object_get_connection (NM_OBJECT (device));
|
||||
g_return_if_fail (connection != NULL);
|
||||
|
||||
/* First, get the physical device info */
|
||||
/* First, get the originating device info */
|
||||
udi = nm_device_get_udi (device);
|
||||
physical_device_udi = get_product_and_vendor (connection, udi, TRUE, FALSE, &priv->product, &priv->vendor);
|
||||
orig_dev_udi = get_product_and_vendor (connection, udi, TRUE, FALSE, &priv->product, &priv->vendor);
|
||||
g_free (udi);
|
||||
|
||||
/* Ignore product and vendor for the Network Interface */
|
||||
|
@ -367,17 +391,17 @@ nm_device_update_description (NMDevice *device)
|
|||
priv->vendor = NULL;
|
||||
}
|
||||
|
||||
/* Get product and vendor off the physical device if possible */
|
||||
/* Get product and vendor off the originating device if possible */
|
||||
pd_parent_udi = get_product_and_vendor (connection,
|
||||
physical_device_udi,
|
||||
orig_dev_udi,
|
||||
FALSE,
|
||||
FALSE,
|
||||
&priv->product,
|
||||
&priv->vendor);
|
||||
g_free (physical_device_udi);
|
||||
g_free (orig_dev_udi);
|
||||
|
||||
/* If one of the product/vendor isn't found on the physical device, try the
|
||||
* parent of the physical device.
|
||||
/* If one of the product/vendor isn't found on the originating device, try the
|
||||
* parent of the originating device.
|
||||
*/
|
||||
if (!priv->product || !priv->vendor) {
|
||||
char *ignore;
|
||||
|
|
|
@ -68,16 +68,21 @@ get_creator (NMHalManager *manager, const char *udi)
|
|||
static char *
|
||||
nm_get_device_driver_name (LibHalContext *ctx, const char *udi)
|
||||
{
|
||||
char *physdev_udi;
|
||||
char *origdev_udi;
|
||||
char *driver_name = NULL;
|
||||
|
||||
physdev_udi = libhal_device_get_property_string (ctx, udi, "net.physical_device", NULL);
|
||||
if (physdev_udi && libhal_device_property_exists (ctx, physdev_udi, "info.linux.driver", NULL)) {
|
||||
char *drv = libhal_device_get_property_string (ctx, physdev_udi, "info.linux.driver", NULL);
|
||||
origdev_udi = libhal_device_get_property_string (ctx, udi, "net.originating_device", NULL);
|
||||
if (!origdev_udi) {
|
||||
/* Older HAL uses 'physical_device' */
|
||||
origdev_udi = libhal_device_get_property_string (ctx, udi, "net.physical_device", 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);
|
||||
}
|
||||
libhal_free_string (physdev_udi);
|
||||
libhal_free_string (origdev_udi);
|
||||
|
||||
return driver_name;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue