svn commit: r224485 - projects/hid/usr.bin/usbhidaction
Alexander Motin
mav at FreeBSD.org
Thu Jul 28 19:24:34 UTC 2011
Author: mav
Date: Thu Jul 28 19:24:33 2011
New Revision: 224485
URL: http://svn.freebsd.org/changeset/base/224485
Log:
Fix Array items support: check all reports, not only the first.
Modified:
projects/hid/usr.bin/usbhidaction/usbhidaction.c
Modified: projects/hid/usr.bin/usbhidaction/usbhidaction.c
==============================================================================
--- projects/hid/usr.bin/usbhidaction/usbhidaction.c Thu Jul 28 18:42:10 2011 (r224484)
+++ projects/hid/usr.bin/usbhidaction/usbhidaction.c Thu Jul 28 19:24:33 2011 (r224485)
@@ -203,7 +203,20 @@ main(int argc, char **argv)
if (cmd->item.report_ID != 0 &&
buf[0] != cmd->item.report_ID)
continue;
- val = hid_get_data(buf, &cmd->item);
+ if (cmd->item.flags & HIO_VARIABLE)
+ val = hid_get_data(buf, &cmd->item);
+ else {
+ uint32_t pos = cmd->item.pos;
+ for (i = 0; i < cmd->item.report_count; i++) {
+ val = hid_get_data(buf, &cmd->item);
+ if (val == cmd->value)
+ break;
+ cmd->item.pos += cmd->item.report_size;
+ }
+ cmd->item.pos = pos;
+ val = (i < cmd->item.report_count) ?
+ cmd->value : -1;
+ }
if (cmd->value != val && cmd->anyvalue == 0)
goto next;
if ((cmd->debounce == 0) ||
@@ -417,7 +430,6 @@ parse_conf(const char *conf, report_desc
}
foundhid:
- hid_end_parse(d);
cmd->lastseen = -1;
cmd->lastused = -1;
cmd->item = h;
@@ -429,6 +441,7 @@ parse_conf(const char *conf, report_desc
else
cmd->value = -1;
}
+ hid_end_parse(d);
if (verbose)
printf("PARSE:%d %s, %d, '%s'\n", cmd->line, name,
More information about the svn-src-projects
mailing list