From 81fdab9c7eb725146a6de14b12cbd3fab2903625 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 12 Feb 2009 16:41:23 -0300 Subject: Fix not handling properly local name changes. Changing adapter name via dbus was emitting PropertyChanged right away. This not only can cause consistency problems but also makes bluetoothd to not emit a PropertyChanged when a third application such as hciconfig changes the adapter name. --- src/dbus-hci.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/dbus-hci.c') diff --git a/src/dbus-hci.c b/src/dbus-hci.c index ff89043f..6d6696f2 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -1047,20 +1047,20 @@ int set_major_and_minor_class(int dd, const uint8_t *cls, void hcid_dbus_setname_complete(bdaddr_t *local) { + struct btd_adapter *adapter; int id, dd = -1; read_local_name_rp rp; struct hci_request rq; const char *pname = (char *) rp.name; - char local_addr[18], name[249]; - - ba2str(local, local_addr); + char name[249]; - id = hci_devid(local_addr); - if (id < 0) { - error("No matching device id for %s", local_addr); + adapter = manager_find_adapter(local); + if (!adapter) { + error("No matching adapter found"); return; } + id = adapter_get_dev_id(adapter); dd = hci_open_dev(id); if (dd < 0) { error("HCI device open failed: hci%d", id); @@ -1088,6 +1088,8 @@ void hcid_dbus_setname_complete(bdaddr_t *local) strncpy(name, pname, sizeof(name) - 1); name[248] = '\0'; pname = name; + + adapter_name_changed(adapter, pname); } void hcid_dbus_setscan_enable_complete(bdaddr_t *local) -- cgit