summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-20 14:31:32 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-20 14:31:32 +0000
commitbdad9f66c2e7341a73b19e1b2b7ad6dfd0a13df5 (patch)
treead34b0a0f35a07ef1c42e0f1fb400ec061c68e3b
parent0d02f462e60a4bc0bbe26f8a597dd30eb0bf4b24 (diff)
Cancel/Stop inquiry when unregistering path or if DEV_DOWN is received
-rw-r--r--hcid/dbus.c12
1 files 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;