Skip to content

Commit

Permalink
HID: rdesc parser: remove local item size limit
Browse files Browse the repository at this point in the history
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@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Nikolai Kondrashov authored and Jiri Kosina committed Sep 2, 2010
1 parent cdd49a8 commit 67168fd
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 67168fd

Please sign in to comment.