summaryrefslogtreecommitdiff
path: root/attrib
diff options
context:
space:
mode:
authorMichael Janssen <jamuraa@chromium.org>2014-10-31 11:14:56 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-11-03 17:17:10 +0200
commitaa6c286ce155e7ef556d7c58c381357247678801 (patch)
tree6d2ab9a65133efbd544d7d74cce1a80139f3876a /attrib
parent84be78a05b55d47b709c1b94c2885e50b0d65ded (diff)
downloadbluez-aa6c286ce155e7ef556d7c58c381357247678801.tar.gz
attrib: fix GATTRIB_ALL_REQS behavior
g_attrib_register(..., GATTRIB_ALL_REQS, ...) behavior would previously include indications, this fixes it to only include requests and commands.
Diffstat (limited to 'attrib')
-rw-r--r--attrib/gattrib.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index a65d1ca22..f67843534 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -147,6 +147,27 @@ static bool is_response(guint8 opcode)
return false;
}
+static bool is_request(guint8 opcode)
+{
+ switch (opcode) {
+ case ATT_OP_MTU_REQ:
+ case ATT_OP_FIND_INFO_REQ:
+ case ATT_OP_FIND_BY_TYPE_REQ:
+ case ATT_OP_READ_BY_TYPE_REQ:
+ case ATT_OP_READ_REQ:
+ case ATT_OP_READ_BLOB_REQ:
+ case ATT_OP_READ_MULTI_REQ:
+ case ATT_OP_READ_BY_GROUP_REQ:
+ case ATT_OP_WRITE_REQ:
+ case ATT_OP_WRITE_CMD:
+ case ATT_OP_PREP_WRITE_REQ:
+ case ATT_OP_EXEC_WRITE_REQ:
+ return true;
+ }
+
+ return false;
+}
+
GAttrib *g_attrib_ref(GAttrib *attrib)
{
int refs;
@@ -373,7 +394,7 @@ static bool match_event(struct event *evt, const uint8_t *pdu, gsize len)
if (evt->expected == GATTRIB_ALL_EVENTS)
return true;
- if (!is_response(pdu[0]) && evt->expected == GATTRIB_ALL_REQS)
+ if (is_request(pdu[0]) && evt->expected == GATTRIB_ALL_REQS)
return true;
if (evt->expected == pdu[0] && evt->handle == GATTRIB_ALL_HANDLES)