diff options
author | Kai Wang <kaiw@FreeBSD.org> | 2008-08-18 16:48:53 +0000 |
---|---|---|
committer | Kai Wang <kaiw@FreeBSD.org> | 2008-08-18 16:48:53 +0000 |
commit | fef8fd9505c8e0090af865dfc40639d3f39c1a7e (patch) | |
tree | d283c6bb5373584097c4a0f3ade188d6c3ed0041 | |
parent | 51b93e474de3a605dfc89385edac97a02e0f5204 (diff) | |
download | src-fef8fd9505c8e0090af865dfc40639d3f39c1a7e.tar.gz src-fef8fd9505c8e0090af865dfc40639d3f39c1a7e.zip |
In the hid parser, if a INPUT/OUTPUT/FEATURE item is skipped, its
corresponding USAGE should be skipped as well.
For example, below is a report desc fragment of some mouse:
COLLECTION
...
USAGE TWHEEL
FEATURE ...
...
USAGE WHEEL
INPUT ...
...
END COLLECTION
"USAGE TWHEEL" should be consumed after the FEATURE item is skipped,
otherwise, the INPUT item will be assigned to "USAGE TWHEEL" later,
other than "USAGE WHEEL".
Tested by: Grzegorz Blach
PR: usb/125941
Notes
Notes:
svn path=/head/; revision=181841
-rw-r--r-- | sys/dev/usb/hid.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/usb/hid.c b/sys/dev/usb/hid.c index 6a9589e956ef..b4f0cb506122 100644 --- a/sys/dev/usb/hid.c +++ b/sys/dev/usb/hid.c @@ -193,8 +193,11 @@ hid_get_item(struct hid_data *s, struct hid_item *h) case 0: /* Main */ switch (bTag) { case 8: /* Input */ - if (!(s->kindset & (1 << hid_input))) + if (!(s->kindset & (1 << hid_input))) { + if (s->nu > 0) + s->nu--; continue; + } c->kind = hid_input; c->flags = dval; ret: @@ -223,8 +226,11 @@ hid_get_item(struct hid_data *s, struct hid_item *h) return (1); } case 9: /* Output */ - if (!(s->kindset & (1 << hid_output))) + if (!(s->kindset & (1 << hid_output))) { + if (s->nu > 0) + s->nu--; continue; + } c->kind = hid_output; c->flags = dval; goto ret; @@ -237,8 +243,11 @@ hid_get_item(struct hid_data *s, struct hid_item *h) s->nu = 0; return (1); case 11: /* Feature */ - if (!(s->kindset & (1 << hid_feature))) + if (!(s->kindset & (1 << hid_feature))) { + if (s->nu > 0) + s->nu--; continue; + } c->kind = hid_feature; c->flags = dval; goto ret; |