Currently if we have two paired bluetooth devices,

nm_device_disambiguate_names() will disambiguate them by their
hardware address. This is not very helpful, so detect this case and
use the Bluetooth device name instead.

This function is used by System Settings when showing the list of
network devices.

https://bugzilla.gnome.org/show_bug.cgi?id=740553

(Port of a libnm-gtk patch written by Ryan Lortie.)
This commit is contained in:
Dan Winship
2015-01-27 17:07:49 -05:00
parent 9d3e0cff9f
commit 8bbda5cdff

View File

@@ -1813,6 +1813,25 @@ nm_device_disambiguate_names (NMDevice **devices,
if (!find_duplicates (names, duplicates, num_devices)) if (!find_duplicates (names, duplicates, num_devices))
goto done; goto done;
/* If dealing with Bluetooth devices, try to distinguish them by
* device name.
*/
for (i = 0; i < num_devices; i++) {
if (duplicates[i] && NM_IS_DEVICE_BT (devices[i])) {
const char *devname = nm_device_bt_get_name (NM_DEVICE_BT (devices[i]));
if (!devname)
continue;
g_free (names[i]);
names[i] = g_strdup_printf ("%s (%s)",
get_device_type_name_with_iface (devices[i]),
devname);
}
}
if (!find_duplicates (names, duplicates, num_devices))
goto done;
/* We have multiple identical network cards, so we have to differentiate /* We have multiple identical network cards, so we have to differentiate
* them by interface name. * them by interface name.
*/ */