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