[PATCH/RFC] HID: rdesc parser: remove local item size limit

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

 



The HID report descriptor parser requires local items, except "delimiters",
to have data. I.e. to have non-zero size. This removes the restriction.

The HID specification doesn't seem to have such restriction and, for
example, a "usage" item could have zero size if the usage ID is zero.
At least one usage page - Keyboard/Keypad lists zero ID as valid.

This doesn't seem to happen in the wild, probably because the official tool
for authoring report descriptors always puts data even for zero values for
some items, including "usage" items.

However, this makes little sense and at least one open source tool for
descriptor authoring generates zero data size "usage" items, which saves
some space, especially if many such items are used in a descriptor.

Signed-off-by: Nikolai Kondrashov <spbnick@xxxxxxxxx>
---

To be honest, the open source tool mentioned is my hidrd-convert tool [1]
and the patch could simplify report descriptor fixing in the tablet drivers
I'm working on.

 drivers/hid/hid-core.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

[1] http://digimend.sourceforge.net/#proj-hidrd

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 0c52899..d40a9f2 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -388,12 +388,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
 	__u32 data;
 	unsigned n;
 
-	/* Local delimiter could have value 0, which allows size to be 0 */
-	if (item->size == 0 && item->tag != HID_LOCAL_ITEM_TAG_DELIMITER) {
-		dbg_hid("item data expected for local item\n");
-		return -1;
-	}
-
 	data = item_udata(item);
 
 	switch (item->tag) {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux