From: Luiz Augusto von Dentz Date: Wed, 20 Apr 2022 20:08:59 +0000 (-0700) Subject: hog-lib: Check if Report ID is set before prepending it X-Git-Tag: accepted/tizen/unified/20230608.164325~273 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74564c2fe0089f293944202fb7d335dca7a4e087;p=platform%2Fupstream%2Fbluez.git 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 Signed-off-by: Manika Shrivastava Signed-off-by: Ayush Garg --- diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c index 1a33ad0..875af88 100755 --- 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);