[PATCH BlueZ v4 11/12] android/hog: Enable notifications only for Input Reports

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

HoG spec has the following statement:

  "The Report Host shall enable notifications, via the Client
   Characteristic Configuration descriptor, of the Report characteristic
   for all instances of the Report characteristic where the Report Type
   as defined in the Report Reference characteristic descriptor
   refers to an Input Report."
---
 android/hog.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/android/hog.c b/android/hog.c
index ad4eee5..83f5d53 100644
--- a/android/hog.c
+++ b/android/hog.c
@@ -102,6 +102,7 @@ struct report {
 	struct bt_hog		*hog;
 	uint8_t			id;
 	uint8_t			type;
+	uint16_t		ccc_handle;
 	guint			notifyid;
 	struct gatt_char	*decl;
 };
@@ -195,6 +196,10 @@ static void report_reference_cb(guint8 status, const guint8 *pdu,
 	report->id = pdu[1];
 	report->type = pdu[2];
 	DBG("Report ID: 0x%02x Report type: 0x%02x", pdu[1], pdu[2]);
+
+	/* Enable notifications only for Input Reports */
+	if (report->type == 0x01)
+		write_ccc(report->hog->attrib, report->ccc_handle, report);
 }
 
 static void external_report_reference_cb(guint8 status, const guint8 *pdu,
@@ -248,7 +253,7 @@ static void discover_report_cb(uint8_t status, GSList *descs, void *user_data)
 
 		switch (desc->uuid16) {
 		case GATT_CLIENT_CHARAC_CFG_UUID:
-			write_ccc(hog->attrib, desc->handle, report);
+			report->ccc_handle = desc->handle;
 			break;
 		case GATT_REPORT_REFERENCE:
 			gatt_read_char(hog->attrib, desc->handle,
-- 
1.9.3

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