Blob Blame History Raw
From 71f6fa90a353605bf25c36417c9ae529ac1a9a8d Mon Sep 17 00:00:00 2001
From: "Song, Hongyan" <hongyan.song@intel.com>
Date: Fri, 3 Aug 2018 14:45:59 +0800
Subject: [PATCH] HID: increase maximum global item tag report size to 256
Mime-version: 1.0
Content-type: text/plain; charset=UTF-8
Content-transfer-encoding: 8bit
Git-commit: 71f6fa90a353605bf25c36417c9ae529ac1a9a8d
Patch-mainline: v4.20-rc1
References: jsc#SLE-5241

The maximum globale report size has changed from 32->...->96->128 in the past
years.  With the development usage of HID, the report_size max value 128 cannot
satisfy all requirements.

There are applications need to expose intrinsic metadata to camera stabilizing
applications such as 3DFE application. 3DFE intrinsic is designed to express
environmental information about sensor that may dynamically change while the
sensor is running (such data include noise spectral density, bias standard
deviation)

A sensor data field is SENSOR_VALUE_PAIR that consists of a PROPERTYKEY and
PROPVARIANT pair. It need to report a unique PROPERTYKEY for each data field.

Take “Noise Spectral Density” as an example, it report count will be
defined as below:

	"Size of Property key GUID(16 Byte) + property key index(4 Byte) +
	size of Noise Spectral Density value(4 Byte)"

In this case, the data report max is totally 192(24Byte), which is larger than
128, while max size 128 blocked it as illegal length. So increase the report
size to satisfy it and more demands in the future.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3da354af7a0a..ef009db512ee 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -406,7 +406,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
 
 	case HID_GLOBAL_ITEM_TAG_REPORT_SIZE:
 		parser->global.report_size = item_udata(item);
-		if (parser->global.report_size > 128) {
+		if (parser->global.report_size > 256) {
 			hid_err(parser->device, "invalid report_size %d\n",
 					parser->global.report_size);
 			return -1;
-- 
2.16.4