[RFC 3/8] HoG: enable report characteristic notification

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

 



From: João Paulo Rechi Vita <jprvita@xxxxxxxxx>

---
 input/hog_device.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/input/hog_device.c b/input/hog_device.c
index 2228a76..80df978 100644
--- a/input/hog_device.c
+++ b/input/hog_device.c
@@ -31,6 +31,7 @@
 #include <unistd.h>
 
 #include <bluetooth/bluetooth.h>
+#include <bluetooth/uuid.h>
 
 #include <glib.h>
 
@@ -41,8 +42,10 @@
 
 #include "hog_device.h"
 
+#include "att.h"
 #include "gattrib.h"
 #include "attio.h"
+#include "gatt.h"
 
 struct hog_device {
 	char			*path;
@@ -53,11 +56,27 @@ struct hog_device {
 
 static GSList *devices = NULL;
 
+static void report_ccc_written_cb(guint8 status, const guint8 *pdu,
+					guint16 plen, gpointer user_data)
+{
+	if (status != 0) {
+		error("Write report characteristic descriptor failed: %s",
+							att_ecode2str(status));
+		return;
+	}
+
+	DBG("Report characteristic descriptor written: notification enabled");
+}
+
 static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
 {
 	struct hog_device *hogdev = user_data;
+	uint8_t value[] = { 0x01, 0x00 };
 
 	hogdev->attrib = g_attrib_ref(attrib);
+
+	gatt_write_char(hogdev->attrib, 0x000c, value, 2,
+						report_ccc_written_cb, hogdev);
 }
 
 static void attio_disconnected_cb(gpointer user_data)
-- 
1.7.7.6

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