From f48070d99f3e13acf1f0abab9a6988d2e2043367 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Wed, 20 Sep 2006 13:35:15 +0000 Subject: DiscoveryCompleted was not being sent properly: unregistering path, stopping device, initiated by non D-Bus --- hcid/dbus.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/hcid/dbus.c b/hcid/dbus.c index 2541ef47..3e5b5bf5 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -399,7 +399,7 @@ static void reply_pending_requests(const char *path, struct hci_dbus_data *pdata pdata->discovery_cancel = NULL; } - if (pdata->discovery_requestor) { + if (pdata->disc_active) { /* Send discovery completed signal if there isn't name to resolve */ message = dbus_message_new_signal(path, ADAPTER_INTERFACE, "DiscoveryCompleted"); @@ -665,13 +665,6 @@ int hcid_dbus_stop_device(uint16_t id) error("Getting %s path data failed!", path); return -1; } - - message = dev_signal_factory(pdata->dev_id, "ModeChanged", - DBUS_TYPE_STRING, &scan_mode, - DBUS_TYPE_INVALID); - - send_reply_and_unref(connection, message); - /* cancel pending timeout */ if (pdata->timeout_id) { g_timeout_remove(pdata->timeout_id); @@ -681,6 +674,13 @@ int hcid_dbus_stop_device(uint16_t id) /* check pending requests */ reply_pending_requests(path, pdata); + message = dev_signal_factory(pdata->dev_id, "ModeChanged", + DBUS_TYPE_STRING, &scan_mode, + DBUS_TYPE_INVALID); + + send_reply_and_unref(connection, message); + + cancel_passkey_agent_requests(pdata->passkey_agents, path, NULL); release_passkey_agents(pdata, NULL); @@ -1030,17 +1030,17 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local) pdata->discovery_cancel = NULL; } - if (pdata->disc_active) { - /* Send discovery completed signal if there isn't name to resolve */ - message = dbus_message_new_signal(path, ADAPTER_INTERFACE, - "DiscoveryCompleted"); - send_reply_and_unref(connection, message); - } - /* reset the discover type for standard inquiry only */ pdata->discover_type &= ~STD_INQUIRY; } + if (pdata->disc_active) { + /* Send discovery completed signal if there isn't name to resolve */ + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, + "DiscoveryCompleted"); + send_reply_and_unref(connection, message); + } + /* tracks D-Bus and NON D-Bus */ pdata->disc_active = 0; done: -- cgit