[RFC 7/8] HoG: print the report map on debug output

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

 



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

diff --git a/input/hog_device.c b/input/hog_device.c
index 3a767cd..7a757f4 100644
--- a/input/hog_device.c
+++ b/input/hog_device.c
@@ -93,6 +93,31 @@ static void report_ccc_written_cb(guint8 status, const guint8 *pdu,
 								hogdev, NULL);
 }
 
+static void report_map_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+							gpointer user_data)
+{
+	uint8_t value[ATT_MAX_MTU];
+	int vlen, i;
+
+	if (status != 0) {
+		error("Report Map read failed: %s", att_ecode2str(status));
+		return;
+	}
+
+	if (!dec_read_resp(pdu, plen, value, &vlen)) {
+		error("ATT protocol error");
+		return;
+	}
+
+	DBG("Report MAP:");
+	for (i = 0; i < vlen; i += 2) {
+		if (i + 1 == vlen)
+			DBG("\t %02x", value[i]);
+		else
+			DBG("\t %02x %02x", value[i], value[i + 1]);
+	}
+}
+
 static void char_discovered_cb(GSList *chars, guint8 status, gpointer user_data)
 {
 	struct hog_device *hogdev = user_data;
@@ -133,6 +158,8 @@ static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
 	gatt_write_char(hogdev->attrib, 0x000c, value, 2,
 						report_ccc_written_cb, hogdev);
 
+	gatt_read_char(hogdev->attrib, 0x0015, 0, report_map_read_cb, hogdev);
+
 	gatt_discover_char(hogdev->attrib, prim->range.start, prim->range.end,
 					NULL, char_discovered_cb, hogdev);
 }
-- 
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