Annotation of src/usr.bin/usbhidaction/usbhidaction.1, Revision 1.5
1.5 ! jmc 1: .\" $OpenBSD: usbhidaction.1,v 1.4 2003/06/10 09:12:12 jmc Exp $
1.1 nate 2: .\" $NetBSD: usbhidaction.1,v 1.6 2002/01/18 14:38:59 augustss Exp $
3: .\"
4: .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
5: .\" All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to The NetBSD Foundation
8: .\" by Lennart Augustsson (lennart@augustsson.net).
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
18: .\" 3. All advertising materials mentioning features or use of this software
19: .\" must display the following acknowledgement:
20: .\" This product includes software developed by the NetBSD
21: .\" Foundation, Inc. and its contributors.
22: .\" 4. Neither the name of The NetBSD Foundation nor the names of its
23: .\" contributors may be used to endorse or promote products derived
24: .\" from this software without specific prior written permission.
25: .\"
26: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29: .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36: .\" POSSIBILITY OF SUCH DAMAGE.
37: .\"
38: .Dd December 29, 2000
39: .Dt USBHIDACTION 1
40: .Os
41: .Sh NAME
42: .Nm usbhidaction
43: .Nd perform actions according to USB HID controls
44: .Sh SYNOPSIS
45: .Nm
1.5 ! jmc 46: .Op Fl div
1.1 nate 47: .Fl c Ar config-file
48: .Fl f Ar device
49: .Ar arg ...
50: .Sh DESCRIPTION
51: .Nm
52: can be used to execute commands when certain values appear on HID controls.
53: The normal operation for this program is to read the configuration file
54: and then become a daemon and execute commands as the HID items specify.
55: If a read from the HID device fails the program dies; this will make it
56: die when the USB device is unplugged.
57: .Pp
58: The options are as follows:
59: .Bl -tag -width Ds
60: .It Fl c Ar config-file
61: Specify a path name for the config file.
62: .It Fl d
63: Toggle the daemon flag.
64: .It Fl f Ar device
1.4 jmc 65: Specify a path name for the device to operate on.
66: If
1.1 nate 67: .Ar device
1.4 jmc 68: is numeric, it is taken to be the USB HID device number.
69: If it is a relative path, it is taken to be the name of the device under
1.1 nate 70: .Pa /dev .
71: An absolute path is taken to be the literal device pathname.
1.5 ! jmc 72: .It Fl i
! 73: Ignore HID items in the config file that do not exist in the device.
1.1 nate 74: .It Fl v
75: Be verbose, and do not become a daemon.
76: .El
77: .Pp
78: The config file will be re-read if the process gets a HUP signal.
79: .Sh CONFIGURATION
1.4 jmc 80: The configuration file has a very simple format.
81: Each line describes an action; if a line begins with a whitespace
82: it is considered a continuation of the previous line.
83: Lines beginning with `#' are considered as comments.
1.1 nate 84: .Pp
85: Each line has three parts: a name of a USB HID item, a value for that item,
1.4 jmc 86: and an action.
87: There must be whitespace between the parts.
1.1 nate 88: .Pp
89: The item names are similar to those used by
90: .Xr usbhidctl 1 ,
91: but each part must be prefixed by its page name.
92: .Pp
1.4 jmc 93: The value is simply a numeric value.
94: When the item reports this value the action will be performed.
1.1 nate 95: If the value is `*' it will match any value.
96: .Pp
97: The action is a normal command that is executed with
98: .Xr system 3 .
99: Before it is executed some substitution will occur:
100: `$n' will be replaced by the nth argument on the
101: command line, `$V' will be replaced by the numeric value
102: of the HID item, `$N' will be replaced by the name
103: of the control, and `$H' will be replaced by the name
104: of the HID device.
105: .Sh FILES
106: .Pa /usr/share/misc/usb_hid_usages
107: The HID usage table.
108: .Sh EXAMPLES
109: The following configuration file can be used to control a pair
110: of Philips USB speakers with the HID controls on the speakers.
111: .Bd -literal -offset indent
112: # Configuration for various Philips USB speakers
113: Consumer:Consumer_Control.Consumer:Volume_Up 1
114: mixerctl -f $1 -n -w fea8-i7-master++
115: Consumer:Consumer_Control.Consumer:Volume_Down 1
116: mixerctl -f $1 -n -w fea8-i7-master--
117: Consumer:Consumer_Control.Consumer:Mute 1
118: mixerctl -f $1 -n -w fea8-i7-mute++
119: Consumer:Consumer_Control.Consumer:Channel_Top.Microsoft:Base_Up 1
120: mixerctl -f $1 -n -w fea8-i7-bass++
121: Consumer:Consumer_Control.Consumer:Channel_Top.Microsoft:Base_Down 1
122: mixerctl -f $1 -n -w fea8-i7-bass--
123: .Ed
124: .Pp
125: A sample invocation using this configuration would be
126: .Bd -literal -offset indent
1.2 deraadt 127: $ usbhidaction -f /dev/uhid1 -c conf /dev/mixer1
1.1 nate 128: .Ed
129: .Sh SEE ALSO
130: .Xr usbhidctl 1 ,
131: .Xr usbhid 3 ,
132: .Xr uhid 4 ,
133: .Xr usb 4
134: .Sh HISTORY
135: The
136: .Nm
137: command first appeared in
138: .Ox 3.2 .