Add support using an alternate table file to usbhidaction(1).
Submitted by: Michael Haro PR: 61234 Approved by: re (bmah)
This commit is contained in:
parent
006bd3063f
commit
986bd8412b
|
@ -47,6 +47,7 @@
|
|||
.Fl c Ar config-file
|
||||
.Fl f Ar device
|
||||
.Op Fl p Ar pidfile
|
||||
.Op Fl t Ar tablefile
|
||||
.Ar arg ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
|
@ -73,6 +74,8 @@ Ignore HID items in the configuration file that do not exist in the device.
|
|||
Be verbose, and do not become a daemon.
|
||||
.It Fl c Ar config-file
|
||||
Specify a path name for the configuration file.
|
||||
.It Fl t Ar tablefile
|
||||
Specify a path name for the HID usage table file.
|
||||
.It Fl f Ar device
|
||||
Specify a path name for the device to operate on.
|
||||
If
|
||||
|
|
|
@ -93,6 +93,7 @@ main(int argc, char **argv)
|
|||
{
|
||||
const char *conf = NULL;
|
||||
const char *dev = NULL;
|
||||
const char *table = NULL;
|
||||
int fd, fp, ch, n, val, i;
|
||||
size_t sz, sz1;
|
||||
int demon, ignore, dieearly;
|
||||
|
@ -105,7 +106,7 @@ main(int argc, char **argv)
|
|||
demon = 1;
|
||||
ignore = 0;
|
||||
dieearly = 0;
|
||||
while ((ch = getopt(argc, argv, "c:def:ip:v")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "c:def:ip:t:v")) != -1) {
|
||||
switch(ch) {
|
||||
case 'c':
|
||||
conf = optarg;
|
||||
|
@ -125,6 +126,9 @@ main(int argc, char **argv)
|
|||
case 'p':
|
||||
pidfile = optarg;
|
||||
break;
|
||||
case 't':
|
||||
table = optarg;
|
||||
break;
|
||||
case 'v':
|
||||
demon = 0;
|
||||
verbose++;
|
||||
|
@ -140,7 +144,7 @@ main(int argc, char **argv)
|
|||
if (conf == NULL || dev == NULL)
|
||||
usage();
|
||||
|
||||
hid_init(NULL);
|
||||
hid_init(table);
|
||||
|
||||
if (dev[0] != '/') {
|
||||
snprintf(devnamebuf, sizeof(devnamebuf), "/dev/%s%s",
|
||||
|
@ -245,7 +249,7 @@ usage(void)
|
|||
{
|
||||
|
||||
fprintf(stderr, "Usage: %s [-deiv] -c config_file -f hid_dev "
|
||||
"[-p pidfile]\n", getprogname());
|
||||
"[-p pidfile] [-t tablefile]\n", getprogname());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue