svn commit: r224481 - projects/hid/lib/libusbhid
Alexander Motin
mav at FreeBSD.org
Thu Jul 28 17:31:50 UTC 2011
Author: mav
Date: Thu Jul 28 17:31:49 2011
New Revision: 224481
URL: http://svn.freebsd.org/changeset/base/224481
Log:
Make hid_report_size() handle negative id argument value as wildcard.
Modified:
projects/hid/lib/libusbhid/parse.c
Modified: projects/hid/lib/libusbhid/parse.c
==============================================================================
--- projects/hid/lib/libusbhid/parse.c Thu Jul 28 13:49:32 2011 (r224480)
+++ projects/hid/lib/libusbhid/parse.c Thu Jul 28 17:31:49 2011 (r224481)
@@ -512,13 +512,14 @@ hid_report_size(report_desc_t r, enum hi
uint32_t temp;
uint32_t hpos;
uint32_t lpos;
+ int report_id = 0;
hpos = 0;
lpos = 0xFFFFFFFF;
memset(&h, 0, sizeof h);
for (d = hid_start_parse(r, 1 << k, id); hid_get_item(d, &h); ) {
- if (h.report_ID == id && h.kind == k) {
+ if ((h.report_ID == id || id < 0) && h.kind == k) {
/* compute minimum */
if (lpos > h.pos)
lpos = h.pos;
@@ -527,6 +528,8 @@ hid_report_size(report_desc_t r, enum hi
/* compute maximum */
if (hpos < temp)
hpos = temp;
+ if (h.report_ID != 0)
+ report_id = 1;
}
}
hid_end_parse(d);
@@ -537,11 +540,8 @@ hid_report_size(report_desc_t r, enum hi
else
temp = hpos - lpos;
- if (id)
- temp += 8;
-
/* return length in bytes rounded up */
- return ((temp + 7) / 8);
+ return ((temp + 7) / 8 + report_id);
}
int
More information about the svn-src-projects
mailing list