[PATCH BlueZ 2/4] Fix the attrib server trying to handle responses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxxxxxx>

The attribute server should only try to handle ATT requests, responses
and events should be handled by the client.
---
 attrib/gattrib.c    |    4 +++-
 attrib/gattrib.h    |    1 +
 src/attrib-server.c |    2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index 8c15e52..4d901f1 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -346,7 +346,9 @@ static gboolean received_data(GIOChannel *io, GIOCondition cond, gpointer data)
 		struct event *evt = l->data;
 
 		if (evt->expected == buf[0] ||
-					evt->expected == GATTRIB_ALL_EVENTS)
+				evt->expected == GATTRIB_ALL_EVENTS ||
+				(is_response(buf[0]) == FALSE &&
+						evt->expected == GATTRIB_ALL_REQS))
 			evt->func(buf, len, evt->user_data);
 	}
 
diff --git a/attrib/gattrib.h b/attrib/gattrib.h
index 4c49879..47c0d60 100644
--- a/attrib/gattrib.h
+++ b/attrib/gattrib.h
@@ -29,6 +29,7 @@ extern "C" {
 #endif
 
 #define GATTRIB_ALL_EVENTS 0xFF
+#define GATTRIB_ALL_REQS 0xFE
 
 struct _GAttrib;
 typedef struct _GAttrib GAttrib;
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 6c40681..af9c291 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -947,7 +947,7 @@ int attrib_channel_attach(GAttrib *attrib, gboolean out)
 
 
 	channel->attrib = g_attrib_ref(attrib);
-	channel->id = g_attrib_register(channel->attrib, GATTRIB_ALL_EVENTS,
+	channel->id = g_attrib_register(channel->attrib, GATTRIB_ALL_REQS,
 					channel_handler, channel, NULL);
 
 	if (out == FALSE)
-- 
1.7.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux