diff options
author | Dan Winship <danw@redhat.com> | 2015-01-27 17:07:49 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-27 17:07:49 -0500 |
commit | 8bbda5cdff0f7f04d3b5863edfdba335dab4c7f8 (patch) | |
tree | 593ae770975df5605f5ed6085023198f9f40ca9e /libnm/nm-device.c | |
parent | 9d3e0cff9fc894120b4c5c2370997af00ec4fa15 (diff) | |
download | NetworkManager-8bbda5cdff0f7f04d3b5863edfdba335dab4c7f8.tar.gz |
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.)
Diffstat (limited to 'libnm/nm-device.c')
-rw-r--r-- | libnm/nm-device.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libnm/nm-device.c b/libnm/nm-device.c index e80ac707d8..96322e6392 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. */ |