summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2010-09-03 18:34:33 -0300
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2010-10-04 17:38:23 -0300
commitf8181aba596190b8ab8972184f15d235df3c692c (patch)
treeed008e84acffbd5950dca12aef409b4ebd3c6500
parent6aef2f4bdf3465e7ddbf57b83eb84a6cbddaafcd (diff)
downloadbluez-f8181aba596190b8ab8972184f15d235df3c692c.tar.gz
Fix periodic inquiry signals
Discovering=TRUE/FALSE property is not being sent to indicate when a new periodic inquiry window starts/ends.
-rw-r--r--src/dbus-hci.c17
-rw-r--r--src/security.c22
2 files changed, 8 insertions, 31 deletions
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index 60870c0a2..a28e352f2 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -388,9 +388,7 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class,
struct remote_dev_info *dev, match;
uint8_t name_type = 0x00;
name_status_t name_status;
-#if 0
int state;
-#endif
dbus_bool_t legacy;
unsigned char features[8];
@@ -406,19 +404,18 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class,
if (data)
write_remote_eir(local, peer, data);
-#if 0
- /* FIXME: Use HCI flags to identify this scenario */
+
/*
- * workaround to identify situation when the daemon started and
- * a standard inquiry or periodic inquiry was already running
+ * Workaround to identify periodic inquiry: inquiry complete event is
+ * sent after each window, however there isn't an event to indicate the
+ * beginning of a new periodic inquiry window.
*/
- if (!(adapter_get_state(adapter) & STD_INQUIRY) &&
- !(adapter_get_state(adapter) & PERIODIC_INQUIRY)) {
- state = adapter_get_state(adapter);
+ state = adapter_get_state(adapter);
+ if (!(state & (STD_INQUIRY | LE_SCAN | PERIODIC_INQUIRY))) {
state |= PERIODIC_INQUIRY;
adapter_set_state(adapter, state);
}
-#endif
+
memset(&match, 0, sizeof(struct remote_dev_info));
bacpy(&match.bdaddr, peer);
match.name_status = NAME_SENT;
diff --git a/src/security.c b/src/security.c
index 3bb0532b4..a6801e17e 100644
--- a/src/security.c
+++ b/src/security.c
@@ -615,28 +615,8 @@ static void inquiry_complete(bdaddr_t *local, uint8_t status, gboolean periodic)
return;
}
- /*
- * The following scenarios can happen:
- * 1. standard inquiry: always send discovery completed signal
- * 2. standard inquiry + name resolving: send discovery completed
- * after name resolving
- * 3. periodic inquiry: skip discovery completed signal
- * 4. periodic inquiry + standard inquiry: always send discovery
- * completed signal
- *
- * Keep in mind that non D-Bus requests can arrive.
- */
-
state = adapter_get_state(adapter);
- DBG("adapter->state %#x", state);
-
- if (periodic) {
- state &= ~PERIODIC_INQUIRY;
- adapter_set_state(adapter, state);
- return;
- }
-
- state &= ~STD_INQUIRY;
+ state &= ~(STD_INQUIRY | PERIODIC_INQUIRY);
adapter_set_state(adapter, state);
}