[PATCH BlueZ 2/2] Remove CCC if the device is not bonded

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

 



Changes attrib server to remove CCC entries of the device when the
connection is established if the device is not bonded.
---
 src/attrib-server.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index 523a835..8798429 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -38,10 +38,14 @@
 #include <bluetooth/sdp_lib.h>
 
 #include "log.h"
+#include "gdbus.h"
 #include "glib-helper.h"
 #include "btio.h"
 #include "sdpd.h"
 #include "hcid.h"
+#include "adapter.h"
+#include "device.h"
+#include "manager.h"
 #include "att.h"
 #include "gattrib.h"
 #include "storage.h"
@@ -834,9 +838,12 @@ done:
 
 guint attrib_channel_attach(GAttrib *attrib, gboolean out)
 {
+	struct btd_adapter *adapter;
+	struct btd_device *device;
 	struct gatt_channel *channel;
 	GIOChannel *io;
 	GError *gerr = NULL;
+	char addr[18];
 	uint16_t cid;
 
 	io = g_attrib_get_channel(attrib);
@@ -856,6 +863,14 @@ guint attrib_channel_attach(GAttrib *attrib, gboolean out)
 		return 0;
 	}
 
+	adapter = manager_find_adapter(&channel->src);
+
+	ba2str(&channel->dst, addr);
+	device = adapter_find_device(adapter, addr);
+
+	if (device_is_bonded(device) == FALSE)
+		delete_device_ccc(&channel->src, &channel->dst);
+
 	if (channel->mtu > ATT_MAX_MTU)
 		channel->mtu = ATT_MAX_MTU;
 
-- 
1.7.7

--
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