summaryrefslogtreecommitdiff
path: root/profiles/input
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-04-20 13:08:59 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-04-22 13:03:34 -0700
commitc535623a713c340031daf56d0798829644a92532 (patch)
treec78fb8ef9b272476b9f3167c19443eaeab0b7420 /profiles/input
parenta1939bd51e0faba9a8550eea2590d99cb63a33c1 (diff)
downloadbluez-c535623a713c340031daf56d0798829644a92532.tar.gz
hog-lib: Check if Report ID is set before prepending it
Before prepending the Report ID check if it is non-zero: BLUETOOTH SPECIFICATION Page 16 of 26 HID Service Specification Report ID shall be nonzero in a Report Reference characteristic descriptor where there is more than one instance of the Report characteristic for any given Report Type. Fixes: https://www.spinics.net/lists/linux-bluetooth/msg97262.html
Diffstat (limited to 'profiles/input')
-rw-r--r--profiles/input/hog-lib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c
index b611f6b4a..e69ea1ba4 100644
--- a/profiles/input/hog-lib.c
+++ b/profiles/input/hog-lib.c
@@ -348,7 +348,14 @@ static void report_value_cb(const guint8 *pdu, guint16 len, gpointer user_data)
ev.type = UHID_INPUT;
buf = ev.u.input.data;
- if (report->numbered) {
+ /* BLUETOOTH SPECIFICATION Page 16 of 26
+ * HID Service Specification
+ *
+ * Report ID shall be nonzero in a Report Reference characteristic
+ * descriptor where there is more than one instance of the Report
+ * characteristic for any given Report Type.
+ */
+ if (report->numbered && report->id) {
buf[0] = report->id;
len = MIN(len, sizeof(ev.u.input.data) - 1);
memcpy(buf + 1, pdu, len);