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