Retrieve saved config name using adapter_get_config_name() instead of reading it from storage file. --- plugins/adaptername.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/adaptername.c b/plugins/adaptername.c index f58fb0f..46dbbe8 100644 --- a/plugins/adaptername.c +++ b/plugins/adaptername.c @@ -198,7 +198,8 @@ static void set_pretty_name(struct btd_adapter *adapter, static int adaptername_probe(struct btd_adapter *adapter) { int current_id; - char name[MAX_NAME_LENGTH + 1]; + char *name; + char str[MAX_NAME_LENGTH + 1]; char *pretty_hostname; pretty_hostname = read_pretty_host_name(); @@ -211,8 +212,10 @@ static int adaptername_probe(struct btd_adapter *adapter) adapter_set_allow_name_changes(adapter, TRUE); current_id = adapter_get_dev_id(adapter); - if (read_local_name(adapter_get_address(adapter), name) < 0) - expand_name(name, MAX_NAME_LENGTH, main_opts.name, current_id); + if (adapter_get_config_name(adapter, &name) < 0) { + expand_name(str, MAX_NAME_LENGTH, main_opts.name, current_id); + name = str; + } DBG("Setting name '%s' for device 'hci%d'", name, current_id); adapter_set_name(adapter, name); -- 1.7.9.5 -- 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