]> sigrok.org Git - sigrok-cli.git/blob - doc/sigrok-cli.1
cli: manpage: Document -l, -a, and -s.
[sigrok-cli.git] / doc / sigrok-cli.1
1 .TH SIGROK\-CLI 1 "March 18, 2012"
2 .SH "NAME"
3 sigrok\-cli \- Command-line client for the sigrok logic analyzer software
4 .SH "SYNOPSIS"
5 .B sigrok\-cli \fR[\fB\-hVlDiIoOdptwas\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fB\-l\fR|\fB\-\-loglevel\fR level] [\fB\-D\fR|\fB\-\-list\-devices\fR] [\fB\-i\fR|\fB\-\-input\-file\fR filename] [\fB\-I\fR|\fB\-\-input\-format\fR format] [\fB\-o\fR|\fB\-\-output\-file\fR filename] [\fB\-O\fR|\fB\-\-output-format\fR format] [\fB\-d\fR|\fB\-\-device\fR device] [\fB\-p\fR|\fB\-\-probes\fR probelist] [\fB\-t\fR|\fB\-\-triggers\fR triggerlist] [\fB\-w\fR|\fB\-\-wait\-trigger\fR] [\fB\-a\fR|\fB\-\-protocol\-decoders\fR list] [\fB\-s\fR|\fB\-\-protocol\-decoder\-stack\fR stack] [\fB\-\-time\fR ms] [\fB\-\-samples\fR numsamples] [\fB\-\-continuous\fR]
6 .SH "DESCRIPTION"
7 .B sigrok\-cli
8 is a cross-platform command line utility for the
9 .B sigrok
10 logic analyzer software.
11 .PP
12 The command-line frontend for sigrok cannot display graphical output, but is
13 still sufficient to run through the whole process of hardware initialization,
14 acquisition, protocol decoding and saving the session.
15 .PP
16 It is useful for running on remote or embedded systems, netbooks, PDAs,
17 and for various other use-cases. It can display samples on standard output or
18 save them in various file formats.
19 .SH "OPTIONS"
20 .TP
21 .B "\-h, \-\-help"
22 Show a help text and exit.
23 .TP
24 .B "\-V, \-\-version"
25 Show
26 .B sigrok-cli
27 version, and information about supported hardware drivers, input file
28 formats, output file formats, and protocol decoders.
29 .TP
30 .BR "\-l, \-\-loglevel " <level>
31 Set the libsigrok and libsigrokdecode loglevel. At the moment
32 .B sigrok-cli
33 doesn't support setting the two loglevels independently. The higher the
34 number, the more debug output will be printed. Valid loglevels are
35 .BR 0 " (NONE),"
36 .BR 1 " (ERR),"
37 .BR 2 " (WARN),"
38 .BR 3 " (INFO),"
39 .BR 4 " (DBG), and"
40 .BR 5 " (SPEW)."
41 .TP
42 .B "\-D, \-\-list\-devices"
43 List all logic analyzer devices found on the system. This actively scans for
44 devices (USB, serial port, and others).
45 .TP
46 .BR "\-i, \-\-input\-file " <filename>
47 Load input from a file instead of a hardware device. If the
48 .B \-\-input\-format
49 option is not supplied, sigrok-cli attempts to autodetect the file format of
50 the input file.
51 .TP
52 .BR "\-I, \-\-input\-format " <format>
53 When loading an input file, assume it's in the specified format. If this
54 option is not supplied (in addition to
55 .BR \-\-input\-file ),
56 sigrok-cli attempts to autodetect the file format of the input file.
57 .TP
58 .BR "\-o, \-\-output\-file " <filename>
59 Save output to a file instead of writing it to stdout. The default format
60 used when saving is the sigrok session file format. This can be changed with
61 the
62 .B \-\-output\-format
63 option.
64 .TP
65 .BR "\-O, \-\-output\-format " <formatname>
66 Set the output format to use. Use the
67 .B \-V
68 option to see a list of available output formats. The format name may
69 optionally be followed by a colon-separated list of options, where each
70 option takes the form
71 .BR "key=value" .
72 .sp
73 Supported formats currently include
74 .BR bits ,
75 .BR hex ,
76 .BR ascii ,
77 .BR binary ,
78 .BR vcd ,
79 .BR ols ,
80 .BR gnuplot ,
81 .BR chronovu-la8 ", and"
82 .BR csv .
83 .sp
84 The
85 .B bits
86 or
87 .B hex
88 formats, for an ASCII bit or ASCII hexadecimal display, can take a "width" option, specifying the number of samples (in bits) to display per line. Thus
89 .B hex:width=128
90 will display 128 bits per line, in hexadecimal:
91 .sp
92  1:ffff ffff ffff ffff ffff ffff ffff ffff
93  2:ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00
94 .sp
95 The lines always start with the probe number (or name, if defined), followed by a colon. If no format is specified, it defaults to
96 .BR bits:width=64 ,
97 like this:
98 .sp
99  1:11111111 11111111 11111111 11111111 [...]
100  2:11111111 00000000 11111111 00000000 [...]
101 .TP
102 .BR "\-d, \-\-device " <device>
103 The device to use for acquisition. It can be specified by ID as reported by
104 .BR "\-\-list\-devices" ,
105 or by the name of the driver as reported by
106 .BR \-\-version .
107 .sp
108 A device can optionally be followed by a colon-separated list of device
109 options, where each option takes the form
110 .BR key=value .
111 For example, to set the samplerate on the first device you might specify
112 .sp
113 .RB "  $ " "sigrok\-cli \-d 0:samplerate=1m"
114 .sp
115 Samplerate is an option common to most devices. The argument specifies the
116 samplerate in Hz. You can also specify the samplerate in kHz, MHz or GHz.
117 The following are all equivalent:
118 .sp
119 .RB "  $ " "sigrok\-cli \-\-samples 100 \-d 0:samplerate=1000000"
120 .sp
121 .RB "  $ " "sigrok\-cli \-\-samples 100 \-d 0:samplerate=1m"
122 .sp
123 .RB "  $ " "sigrok\-cli \-\-samples 100 \-d ""0:samplerate=1 MHz""
124 .TP
125 .BR "\-p, \-\-probes " <probelist>
126 A comma-separated list of probes to be used in the session.
127 .sp
128 The default is to use all the probes available on a device. You can name
129 a probe like this:
130 .BR "1=CLK" .
131 A range of probes can also be given, in the form
132 .BR "1\-5" .
133 .sp
134 Example:
135 .sp
136  $
137 .B "sigrok\-cli \-\-samples 100 \-\-probes 1=CLK,2\-4,7"
138 .br
139  CLK:11111111 11111111 11111111 11111111 [...]
140    2:11111111 11111111 11111111 11111111 [...]
141    3:11111111 11111111 11111111 11111111 [...]
142    4:11111111 11111111 11111111 11111111 [...]
143    7:11111111 11111111 11111111 11111111 [...]
144 .sp
145 The comma-separated list is processed from left to right, i.e. items farther
146 to the right override previous items. For example
147 .B "1=CS,1=MISO"
148 will set the name of probe 1 to
149 .BR "MISO" .
150 .sp
151 Also, while
152 .B "5=MOSI,6=MISO"
153 will only select probes 5 and 6, and set their names to MISO and MOSI, the
154 command line
155 .B "5=MOSI,6=MISO,1\-8"
156 will select probes 1\-8 (including 5 and 6, of course), but the names specified
157 for probes 5 and 6 will be reset to the defaults by the
158 .B "1\-8"
159 probe selection.
160 .TP
161 .BR "\-t, \-\-triggers " <triggerlist>
162 A comma-separated list of triggers to use, of the form
163 .BR "<probe>=<trigger>" .
164 You can use the name or number of the probe, and the trigger itself is a
165 series of characters:
166 .sp
167 .BR "0 or 1" :
168 A low or high value on the pin.
169 .br
170 .BR "r or f" :
171 A rising or falling value on the pin. An
172 .B r
173 effectively corresponds to
174 .BR 01 .
175 .br
176 .BR "c" :
177 Any kind of change on a pin (either a rising or a falling edge).
178 .sp
179 Not every device supports all of these trigger types. Use the
180 .B "\-d <device>"
181 argument (with no other arguments) to see which triggers your device supports.
182 .TP
183 .BR "\-w, \-\-wait-trigger"
184 Don't output any sample data (even if it's actually received from the logic
185 analyzer) before the trigger condition is met. In other words, do not output
186 any pre-trigger data. This option is useful if you don't care about the data
187 that came before the trigger (but the logic analyzer hardware delivers this
188 data to sigrok nonetheless).
189 .TP
190 .BR "\-a, \-\-protocol\-decoders " <list>
191 This option allows the user to specify a comma-separated list of protocol
192 decoders to be used in this session. The decoders are specified by their
193 ID, as shown in the
194 .B \-\-version
195 output.
196 .sp
197 Example:
198 .sp
199  $
200 .B "sigrok\-cli \-i <file.sr> \-a i2c"
201 .sp
202 Each protocol decoder can optionally be followed by a colon-separated list
203 of options, where each option takes the form
204 .BR "key=value" .
205 .sp
206 Example:
207 .sp
208  $
209 .B "sigrok\-cli \-i <file.sr> \-a uart:baudrate=115200:parity=odd"
210 .sp
211 The list of supported options depends entirely on the protocol decoder. Every
212 protocol decoder has different options it supports.
213 .sp
214 Any "options" specified for a protocol decoder which are not actually
215 supported options, will be interpreted as being probe name/number assignments.
216 .sp
217 Example:
218 .sp
219  $
220 .B "sigrok\-cli \-i <file.sr>"
221 .br
222 .B "              \-a spi:wordsize=9:miso=1:mosi=5:sck=3:cs=0"
223 .sp
224 In this example,
225 .B wordsize
226 is an option supported by the
227 .B spi
228 protocol decoder. Additionally, the user tells sigrok to decode the SPI
229 protocol using probe 1 as MISO signal for SPI, probe 5 as MOSI, probe 3
230 as SCK, and probe 0 as CS# signal.
231 .TP
232 .BR "\-s, \-\-protocol\-decoder\-stack " <stack>
233 This option allows the user to specify a protocol decoder stack, i.e.
234 the way in which one protocol decoder's output gets piped into another
235 protocol decoder.
236 .sp
237 The decoders are specified by their ID, as shown in the
238 .B \-\-version
239 output. In addition to the
240 .B \-s
241 option, all protocol decoders that are used in a stack, must also be specified
242 (together with their options, if any) using the
243 .B \-a
244 parameter.
245 .sp
246 Example:
247 .sp
248  $
249 .B "sigrok\-cli \-i <file.sr> \-a i2c:sda=4,scl=7,rtc8564"
250 .br
251 .B "              \-s i2c,rtc8564"
252 .sp
253 In this example, the
254 .B \-s
255 option specifies that the output of the
256 .BR i2c " decoder"
257 is piped into the
258 .BR rtc8564 " decoder,"
259 i.e., the
260 .BR rtc8564 " decoder"
261 is stacked on top of the
262 .BR i2c " decoder."
263 .sp
264 The respective protocol decoder options and probe name/number assignments
265 must be given using the
266 .B \-a
267 option (you cannot specify them in the
268 .B \-s
269 option).
270 .TP
271 .BR "\-\-time " <ms>
272 Sample for
273 .B <ms>
274 milliseconds, then quit. You can optionally follow the number by
275 .B s
276 to state the number of seconds to sample instead. For example,
277 .B "\-\-time 2s"
278 will sample for two seconds.
279 .TP
280 .BR "\-\-samples " <numsamples>
281 Acquire
282 .B <numsamples>
283 samples, then quit.
284 .TP
285 .BR "\-\-continuous"
286 Sample continuously until stopped. Not all devices support this.
287 .SH "EXAMPLES"
288 In order to get exactly 100 samples from the (only) detected logic analyzer
289 hardware, run the following command:
290 .TP
291 .B "  sigrok\-cli \-\-samples 100"
292 .TP
293 If you want to sample data for 3 seconds, use:
294 .TP
295 .B "  sigrok\-cli \-\-time 3000"
296 .TP
297 Alternatively, you can also use:
298 .TP
299 .B "  sigrok\-cli \-\-time 3s"
300 .TP
301 To capture data from 4 probes lasting 100ms at 10 MHz starting at the trigger condition 1:high, 2:rising, 3:low, 4:high, use:
302 .TP
303 .B "  sigrok\-cli -d 0:samplerate=10m \-O bits \-p 1\-4 \-\-time 100 \\\\"
304 .B "      \-\-wait\-trigger \-\-triggers 1=1,2=r,3=0,4=1 "
305 .SH "EXIT STATUS"
306 .B sigrok\-cli
307 exits with 0 on success, 1 on most failures.
308 .SH "SEE ALSO"
309 \fBsigrok\-qt\fP(1),
310 \fBsigrok\-gtk\fP(1)
311 .SH "BUGS"
312 Please report any bugs on the sigrok\-devel mailing list
313 .RB "(" sigrok\-devel@lists.souceforge.net ")."
314 .SH "LICENSE"
315 .B sigrok\-cli
316 is covered by the GNU General Public License (GPL). Some portions are
317 licensed under the "GPL v2 or later", some under "GPL v3 or later".
318 .SH "AUTHORS"
319 Please see the individual source code files.
320 .PP
321 This manual page was written by Uwe Hermann <uwe@hermann\-uwe.de>.
322 It is licensed under the terms of the GNU GPL (version 2 or later).