aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorIan Dowse <iedowse@FreeBSD.org>2006-03-22 02:04:12 +0000
committerIan Dowse <iedowse@FreeBSD.org>2006-03-22 02:04:12 +0000
commit3ee42667a4bc832b8e246fc708c54d4a93196c91 (patch)
treef54f283cc5de5da9dd6a5c9df82dd5288a5ea268 /sys/dev/usb
parent0fa274524ae4e828eb84b6b9ae18a3238f79c83d (diff)
Notes
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/hid.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/usb/hid.c b/sys/dev/usb/hid.c
index ba78ec2d7c5b9..acd86bfba558c 100644
--- a/sys/dev/usb/hid.c
+++ b/sys/dev/usb/hid.c
@@ -371,14 +371,22 @@ hid_report_size(void *buf, int len, enum hid_kind k, u_int8_t *idp)
{
struct hid_data *d;
struct hid_item h;
- int size, id;
+ int hi, lo, size, id;
id = 0;
+ hi = lo = -1;
for (d = hid_start_parse(buf, len, 1<<k); hid_get_item(d, &h); )
- if (h.report_ID != 0 && !id)
- id = h.report_ID;
+ if (h.kind == k) {
+ if (h.report_ID != 0 && !id)
+ id = h.report_ID;
+ if (h.report_ID == id) {
+ if (lo < 0)
+ lo = h.loc.pos;
+ hi = h.loc.pos + h.loc.size * h.loc.count;
+ }
+ }
hid_end_parse(d);
- size = h.loc.pos;
+ size = hi - lo;
if (id != 0) {
size += 8;
*idp = id; /* XXX wrong */