diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-04-20 13:08:59 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-04-22 13:03:34 -0700 |
commit | c535623a713c340031daf56d0798829644a92532 (patch) | |
tree | c78fb8ef9b272476b9f3167c19443eaeab0b7420 /profiles/input | |
parent | a1939bd51e0faba9a8550eea2590d99cb63a33c1 (diff) | |
download | bluez-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.c | 9 |
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); |