1MODE2(1) 0.10.0" MODE2(1)
2
3
4
6 mode2 - Show kernel output available for LIRC drivers
7
8
10 mode2 --driver <driver> [--device <device>] [other options]
11
12 mode2 --raw --device <device> [other options]
13
14 mode2 --driver <driver> --list-devices
15
16
18 The original purpose of this program has been to check operation of
19 home-brew LIRC receiver hardware and to see the IR waveform of the
20 remote controller without an expensive oscilloscope. Over time, mode2
21 has evolved to a generic tool to check what kind of output the kernel
22 makes available for lirc.
23
24 mode2 will simply print pulse and space lengths to stdout for drivers
25 supporting LIRC_MODE_MODE2. For drivers supporting LIRC_MODE_LIRCCODE
26 such as TV-cards and the irman driver writes the decoded, integer val‐
27 ues.
28
29 From version 0.9.4, mode2 can also list the devices available for a
30 given driver. This requires enumeration support which is available in
31 most but not all drivers.
32
33 When given the correct driver mode2 should always work. Without a
34 driver, the --raw option should always work for /dev/lirc* devices. At
35 the time of writing, usb devices also works in most cases. However,
36 since it is tricky to get the path to the usb device, such ones are
37 normally best accessed using a driver.
38
39 Not all drivers requires a device.
40
42 -d --device=device
43 Read from given device.
44
45 -H --driver=driver
46 Use given driver.
47
48 -m --mode
49 Write pulse/space data as raw config files. Does not affect LIR‐
50 CCODE drivers.
51
52 -s --scope=time
53 Enable 'scope like display with time us per char. Does not
54 affect lirccode drivers.
55
56 -k --keep-root
57 Don't drop root privileges after opening device. See RUNNING AS
58 ROOT.
59
60 -l --list-devices
61 List all available devices for given driver. Requires support
62 not present in all drivers.
63
64 -g --gap=time
65 Treat spaces longer than time as the gap. Time is in microsec‐
66 onds.
67
68 -r --raw
69 Access device directly. This is primarely intended to be used
70 with kernel rc drivers i .e., when accessing /dev/lirc* devices.
71 Using other devices might work, but is in general undefined.
72
73 -A --driver-options=key:value[|key:value...]
74 Set driver-specific option named key to given value.
75
76 -U --plugindir=directory
77 Load drivers from directory. See DRIVER LOADING.
78
79 -O, --options-file <path>
80 File containing default values for all options. A relative path
81 is interpreted from current directory. See [FILES] below.
82
83 -D --loglevel=level
84 Determine the amount of logging information. [level] can be a
85 symbolic syslog level: 'error','warning, 'info', 'notice' or
86 'debug'. lirc also defines three additional levels 'trace',
87 'trace1' and 'trace2' which gives even more messages ('trace2'
88 bringing the most). However, in the log these messages are
89 marked as 'debug'. The level can also be an integer in the
90 range 3 (almost no messages) to 10.
91
92 -h --help
93 Display usage summary.
94
95 -v --version
96 Display version.
97
98
100 In many cases mode2 needs to run as root to access devices not avail‐
101 able to regular users. On the other hand, running as root creates prob‐
102 lems such as log files owned by root, security concerns etc.
103
104 In order to cope with this, mode2 by default drops root privileges
105 after opening the input device. This support is based on that root per‐
106 missions are accquired using sudo(1) e. g., using
107
108 $ sudo mode2 --raw /dev/lirc0
109
110 If not using sudo, the same behaviour could be accomplished using the
111 SUDO_USER environment variable e. g.,
112
113 # SUDO_USER=$LOGNAME mode2 --raw /dev/lirc0
114
115 The --keep-root option will make mode2 to keep root privileges for the
116 complete run.
117
118
120 Invoked with a MODE2 type driver with mode2 prints space/mark timings:
121 al@snorken $ ./mode2 --driver default --device /dev/lirc0
122 Using driver default on device /dev/lirc0
123 Trying device: /dev/lirc0
124 Using device: /dev/lirc0
125 pulse 2750
126 space 800
127 pulse 500
128 space 350
129 pulse 550
130 space 350
131 pulse 550
132 ...
133
134 Invoked with a LIRCCODE type driver mode2 prints decoded values:
135
136 $ ./mode2 --driver atilibusb
137 Using driver atilibusb on device /dev/lirc0
138 Trying device: /dev/bus/usb/001/007
139 Using device: /dev/bus/usb/001/007
140 code: 0x14709b0000
141 code: 0x14709b0000
142 code: 0x14709b0000
143 code: 0x14709b0000
144 code: 0x14709b0000
145 ...
146
147 Invoked using mode2 --list-devices for the devinput driver with a
148 single X10 RF usb device plugged in:
149 $ ./mode2 --list-devices --driver devinput
150 /dev/input/event12 [0bc7:0006] X10 WTI RF receiver vers: 1.10 serial: ?
151 /dev/input/by-id/usb-X10_WTI_RF_receiver-event-if00 -> ../event12
152 /dev/input/by-path/pci-0000:0b:00.0-usb-0:1:1.0-event -> ../event12
153
155 Drivers are loaded dynamically. The search path used for this is deter‐
156 mined by (falling priority):
157
158 - The --plugindir option.
159
160 - The 'plugindir' entry in the [lircd] section of the
161 lirc_options.conf file.
162
163 - The environment variable LIRC_PLUGINDIR.
164
165 - A hardcoded default (/usr/lib64/lirc/plugins).
166
167
169 LIRC_LOGLEVEL
170 Used as fallback when there is no --loglevel option present. Syntax
171 is the same as for --loglevel, see OPTIONS.
172
173
175 /etc/lirc/lirc_options.conf
176 The options file holding default values for command line options in
177 the [mode2] section. For some values including debug, plugindir,
178 driver and device mode2 falls back to the [lircd] section if not
179 found in [mode2].
180
181 The location of this file can be changed using the -O/--options-
182 file command-line option or using the environment variable
183 LIRC_OPTIONS_PATH.
184
185
186 ~/.cache/mode2.log
187 Debug log. Setting the XDG_CACHE_HOME environment variable relo‐
188 cates this file to $XDG_CACHE_HOME/mode2.log. The amount of logging
189 respects the LIRC_LOGLEVEL environment variable, defaulting to the
190 debug value in lirc_options.conf.
191
192
193
195 xmode2(1)
196 lirc(4)
197
198 The documentation for lirc is maintained as html pages. They are
199 located under html/ in the documentation directory.
200
201
202
203mode2 Last change: Jan 2017 MODE2(1)