svn commit: r224484 - projects/hid/usr.bin/usbhidaction
Alexander Motin
mav at FreeBSD.org
Thu Jul 28 18:42:10 UTC 2011
Author: mav
Date: Thu Jul 28 18:42:10 2011
New Revision: 224484
URL: http://svn.freebsd.org/changeset/base/224484
Log:
Fix support for multiple Report IDs.
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:39:47 2011 (r224483)
+++ projects/hid/usr.bin/usbhidaction/usbhidaction.c Thu Jul 28 18:42:10 2011 (r224484)
@@ -92,12 +92,12 @@ main(int argc, char **argv)
char buf[100];
char devnamebuf[PATH_MAX];
struct command *cmd;
- int reportid;
+ int reportid = -1;
demon = 1;
ignore = 0;
dieearly = 0;
- while ((ch = getopt(argc, argv, "c:def:ip:t:v")) != -1) {
+ while ((ch = getopt(argc, argv, "c:def:ip:r:t:v")) != -1) {
switch(ch) {
case 'c':
conf = optarg;
@@ -117,6 +117,9 @@ main(int argc, char **argv)
case 'p':
pidfile = optarg;
break;
+ case 'r':
+ reportid = atoi(optarg);
+ break;
case 't':
table = optarg;
break;
@@ -146,14 +149,13 @@ main(int argc, char **argv)
fd = open(dev, O_RDWR);
if (fd < 0)
err(1, "%s", dev);
- reportid = hid_get_report_id(fd);
repd = hid_get_report_desc(fd);
if (repd == NULL)
err(1, "hid_get_report_desc() failed");
commands = parse_conf(conf, repd, reportid, ignore);
- sz = (size_t)hid_report_size(repd, hid_input, reportid);
+ sz = (size_t)hid_report_size(repd, hid_input, -1);
if (verbose)
printf("report size %zu\n", sz);
@@ -198,6 +200,9 @@ main(int argc, char **argv)
}
#endif
for (cmd = commands; cmd; cmd = cmd->next) {
+ if (cmd->item.report_ID != 0 &&
+ buf[0] != cmd->item.report_ID)
+ continue;
val = hid_get_data(buf, &cmd->item);
if (cmd->value != val && cmd->anyvalue == 0)
goto next;
More information about the svn-src-projects
mailing list