summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deymo <deymo@chromium.org>2013-05-06 20:31:57 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2013-05-08 10:19:38 +0300
commitd3ae2d6f7e6070921e70febca795f5e621195b04 (patch)
tree890ade2433208a21de2347291d1caad54644d7c4 /src
parent7bd3626b6715ac6a117d56b95b455960f7cf34de (diff)
downloadbluez-d3ae2d6f7e6070921e70febca795f5e621195b04.tar.gz
core: Don't update a known long name with a short name.
update_found_devices() could attempt to update a device with new information containing only a short verstion of the name. If the struct eir_data passed has a short or NULL name, it will never update a previous name and will also trigger a "HCI Command: Remote Name Request" if the previous name was unknown.
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/adapter.c b/src/adapter.c
index 1252e74ae..b952ea16a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -4060,6 +4060,7 @@ static void update_found_devices(struct btd_adapter *adapter,
char addr[18];
int err;
GSList *list;
+ bool name_known;
memset(&eir_data, 0, sizeof(eir_data));
err = eir_parse(&eir_data, data, data_len);
@@ -4116,7 +4117,11 @@ static void update_found_devices(struct btd_adapter *adapter,
if (eir_data.appearance != 0)
device_set_appearance(dev, eir_data.appearance);
- if (eir_data.name)
+ /* Report an unknown name to the kernel even if there is a short name
+ * known, but still update the name with the known short name. */
+ name_known = device_name_known(dev);
+
+ if (eir_data.name && (eir_data.name_complete || !name_known))
device_set_name(dev, eir_data.name);
if (eir_data.class != 0)
@@ -4139,8 +4144,7 @@ static void update_found_devices(struct btd_adapter *adapter,
return;
if (confirm)
- confirm_name(adapter, bdaddr, bdaddr_type,
- device_name_known(dev));
+ confirm_name(adapter, bdaddr, bdaddr_type, name_known);
adapter->discovery_found = g_slist_prepend(adapter->discovery_found,
dev);