diff options
author | kaiw <kaiw@FreeBSD.org> | 2008-08-18 16:48:53 +0000 |
---|---|---|
committer | kaiw <kaiw@FreeBSD.org> | 2008-08-18 16:48:53 +0000 |
commit | 2c6e2da0df634c5f1f9c114b888288f6f9ededee (patch) | |
tree | d283c6bb5373584097c4a0f3ade188d6c3ed0041 /sys | |
parent | 93af8fa458ec63ac5a9145de4704c260f0d9b213 (diff) | |
download | FreeBSD-src-2c6e2da0df634c5f1f9c114b888288f6f9ededee.zip FreeBSD-src-2c6e2da0df634c5f1f9c114b888288f6f9ededee.tar.gz |
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
Diffstat (limited to 'sys')
-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 6a9589e..b4f0cb5 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; |