From bdad9f66c2e7341a73b19e1b2b7ad6dfd0a13df5 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Wed, 20 Sep 2006 14:31:32 +0000 Subject: Cancel/Stop inquiry when unregistering path or if DEV_DOWN is received --- hcid/dbus.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hcid/dbus.c b/hcid/dbus.c index 40b5d6a2..8b7bec84 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -404,6 +404,10 @@ static void reply_pending_requests(const char *path, struct hci_dbus_data *pdata message = dbus_message_new_signal(path, ADAPTER_INTERFACE, "DiscoveryCompleted"); send_reply_and_unref(connection, message); + + /* Cancel inquiry initiated by D-Bus client */ + if (pdata->discovery_requestor) + cancel_discovery(pdata); } if (pdata->pdisc_active) { @@ -411,6 +415,10 @@ static void reply_pending_requests(const char *path, struct hci_dbus_data *pdata message = dbus_message_new_signal(path, ADAPTER_INTERFACE, "PeriodicDiscoveryStopped"); send_reply_and_unref(connection, message); + + /* Stop periodic inquiry initiated by D-Bus client */ + if (pdata->pdiscovery_requestor) + cancel_periodic_discovery(pdata); } } @@ -2248,11 +2256,11 @@ int cancel_periodic_discovery(struct hci_dbus_data *pdata) dev = l->data; - bacpy(&cp.bdaddr, &dev->bdaddr); - memset(&rq, 0, sizeof(rq)); memset(&cp, 0, sizeof(cp)); + bacpy(&cp.bdaddr, &dev->bdaddr); + rq.ogf = OGF_LINK_CTL; rq.ocf = OCF_REMOTE_NAME_REQ_CANCEL; rq.cparam = &cp; -- cgit