libnm/device: use the type name for description if the product is empty

It's very likely that the product said something that was filtered out
by the fixup, such as "PCI Ethernet" or "Wi-Fi Adapter". Use a generic
type name in place of it.
This commit is contained in:
Lubomir Rintel 2018-02-23 14:52:06 +01:00
parent c17155b1b9
commit e4430e0969

View file

@ -1583,12 +1583,15 @@ ensure_description (NMDevice *device)
g_clear_pointer (&priv->description, g_free);
}
if ( !priv->short_vendor
|| !(short_product = nm_utils_fixup_product_string (nm_device_get_product (device)))) {
if (!priv->short_vendor) {
priv->description = g_strdup (nm_device_get_iface (device) ?: "");
return;
}
short_product = nm_utils_fixup_product_string (nm_device_get_product (device));
if (short_product == NULL)
short_product = g_strdup (get_type_name (device));
/* Another quick hack; if all of the fixed up vendor string
* is found in product, ignore the vendor.
*/