When discovering, write the EIR "complete" name first before to read the name. Only names retrieved from EIR "complete" name and HCI Remote Name Request Complete event are stored. This patch doesn't change the final result: the value of the name sent in the signal. --- src/adapter.c | 19 +++++-------------- 1 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index a274f26..6d5fdc9 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -3012,7 +3012,6 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr, char *name; gboolean new_dev, legacy, le; name_status_t name_status = NAME_NOT_REQUIRED; - const char *dev_name; int err; memset(&eir_data, 0, sizeof(eir_data)); @@ -3022,6 +3021,9 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr, return; } + if (eir_data.name != NULL && eir_data.name_complete) + write_device_name(&adapter->bdaddr, bdaddr, eir_data.name); + name = read_stored_data(&adapter->bdaddr, bdaddr, "names"); if (eir_data.flags < 0) { @@ -3042,23 +3044,12 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr, legacy = FALSE; } - /* Complete EIR names are always used. Shortened EIR names are only - * used if there is no name already in storage. */ - dev_name = name; - if (eir_data.name != NULL) { - if (eir_data.name_complete) { - write_device_name(&adapter->bdaddr, bdaddr, - eir_data.name); - name_status = NAME_NOT_REQUIRED; - dev_name = eir_data.name; - } else if (name == NULL) - dev_name = eir_data.name; - } - dev = get_found_dev(adapter, bdaddr, &new_dev); if (new_dev) { + const char *dev_name = (name ? name : eir_data.name); char *alias; + if (dev_name) dev->name = g_strdup(dev_name); -- 1.7.5.rc3 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html