From 8bbda5cdff0f7f04d3b5863edfdba335dab4c7f8 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 27 Jan 2015 17:07:49 -0500 Subject: [PATCH] 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.) --- libnm/nm-device.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libnm/nm-device.c b/libnm/nm-device.c index e80ac707d..96322e639 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -1813,6 +1813,25 @@ nm_device_disambiguate_names (NMDevice **devices, if (!find_duplicates (names, duplicates, num_devices)) 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 * them by interface name. */