]> sigrok.org Git - sigrok-cli.git/blame - doc/sigrok-cli.1
add --dont-scan (-D) command line option
[sigrok-cli.git] / doc / sigrok-cli.1
CommitLineData
c45dd41c 1.TH SIGROK\-CLI 1 "March 28, 2019"
43e5747a 2.SH "NAME"
53155b2f 3sigrok\-cli \- Command-line client for the sigrok software
43e5747a 4.SH "SYNOPSIS"
53155b2f 5.B sigrok\-cli [OPTIONS] [COMMAND]
43e5747a 6.SH "DESCRIPTION"
10d98b47
UH
7\fBsigrok\-cli\fP is a cross-platform command line utility for the
8\fBsigrok\fP software.
43e5747a 9.PP
10d98b47
UH
10It cannot display graphical output, but is still sufficient to run through
11the whole process of hardware initialization, acquisition, protocol decoding
12and saving the session.
43e5747a
UH
13.PP
14It is useful for running on remote or embedded systems, netbooks, PDAs,
15and for various other use-cases. It can display samples on standard output or
16save them in various file formats.
53155b2f 17.SH OPTIONS
43e5747a 18.TP
43e5747a
UH
19.B "\-h, \-\-help"
20Show a help text and exit.
21.TP
7949dca0
UH
22.B "\-V, \-\-version"
23Show
a0cfa735 24.B sigrok\-cli
6293db8a
UH
25version and the versions of libraries used.
26.TP
a0cfa735 27.B "\-L, \-\-list\-supported"
6293db8a 28Show information about supported hardware drivers, input file
7949dca0
UH
29formats, output file formats, and protocol decoders.
30.TP
c45dd41c
UH
31.B "\-\-list\-supported\-wiki"
32Show information about supported protocol decoders in MediaWiki syntax.
33This is generally only used by developers to easily update the list of
34supported protocol decoders in the sigrok wiki.
35.TP
b5ac81ad
BV
36\fB\-d, \-\-driver\fP <drivername>
37A driver must always be selected (unless doing a global scan). Use the
c45dd41c 38.BR "\-L " ( "\-\-list\-supported" ")"
c1865eb5 39option to get a list of available drivers.
53155b2f 40.sp
10d98b47
UH
41Drivers can take options, in the form \fBkey=value\fP
42separated by colons.
43.sp
44Drivers communicating with hardware via a serial port always need the port
45specified as the \fBconn\fP option. For example, to use the
46Openbench Logic Sniffer:
53155b2f 47.sp
a0cfa735 48.RB " $ " "sigrok\-cli \-\-driver=ols:conn=/dev/ttyACM0" " [...]"
53155b2f 49.sp
10d98b47
UH
50Some USB devices don't use a unique VendorID/ProductID combination, and thus
51need that specified as well. This also uses the \fBconn\fP option, using
52either \fBVendorID.ProductID\fP or \fBbus.address\fP:
53155b2f 53.sp
a0cfa735
UH
54USB \fBVendorID.ProductID\fP example:
55.sp
56.RB " $ " "sigrok\-cli \-\-driver=uni\-t\-ut61e:conn=1a86.e008" " [...]"
57.sp
58USB \fBbus.address\fP example:
59.sp
60.RB " $ " "sigrok\-cli \-\-driver=uni\-t\-ut61e:conn=4.6" " [...]"
43e5747a 61.TP
b20ea789
GS
62.B "\-D, \-\-dont\-scan"
63Do not automatically scan for device drivers in the absence of a
64.BR "\-d " ( "\-\-driver" )
65specification.
66.TP
a0cfa735 67.BR "\-c, \-\-config " <deviceoption>
53155b2f 68A colon-separated list of device options, where each option takes the form
1b4b6a7c 69.BR key=value .
10d98b47
UH
70For example, to set the samplerate to 1MHz on a device supported by the
71fx2lafw driver, you might specify
1b4b6a7c 72.sp
a0cfa735 73.RB " $ " "sigrok\-cli \-d fx2lafw \-\-config samplerate=1m" " [...]"
1b4b6a7c 74.sp
53155b2f
BV
75Samplerate is an option common to most logic analyzers. The argument specifies
76the samplerate in Hz. You can also specify the samplerate in kHz, MHz or GHz.
1b4b6a7c
UH
77The following are all equivalent:
78.sp
a0cfa735 79.RB " $ " "sigrok\-cli \-d fx2lafw \-\-config samplerate=1000000" " [...]"
1b4b6a7c 80.sp
a0cfa735 81.RB " $ " "sigrok\-cli \-d fx2lafw \-\-config samplerate=1m" " [...]"
1b4b6a7c 82.sp
a0cfa735 83.RB " $ " "sigrok\-cli \-d fx2lafw \-\-config \(dqsamplerate=1 MHz\(dq" " [...]"
1b4b6a7c 84.TP
43e5747a 85.BR "\-i, \-\-input\-file " <filename>
a0cfa735
UH
86Load input from a file instead of a hardware device. You can specify
87"-" to use stdin as input. If the
43e5747a 88.B \-\-input\-format
a0cfa735 89option is not supplied, sigrok\-cli attempts to autodetect the file format of
43e5747a 90the input file.
a0cfa735
UH
91.sp
92Example for loading a sigrok session file:
93.sp
94.RB " $ " "sigrok\-cli \-i example.sr" " [...]"
95.sp
96Example for loading a WAV file (autodetection of input format):
97.sp
98.RB " $ " "sigrok\-cli \-i example.wav" " [...]
99.sp
100Example for loading a VCD file from stdin (autodetection of input format):
101.sp
102.RB " $ " "cat example.vcd | sigrok\-cli \-i \-" " [...]
43e5747a
UH
103.TP
104.BR "\-I, \-\-input\-format " <format>
105When loading an input file, assume it's in the specified format. If this
106option is not supplied (in addition to
107.BR \-\-input\-file ),
943d0c08 108sigrok-cli attempts to autodetect the file format of the input file. Use the
a0cfa735 109.BR "\-L " ( "\-\-list\-supported" ")"
10d98b47
UH
110option to see a list of available input formats.
111.sp
112The format name may optionally be followed by a colon-separated list of
113options, where each option takes the form
943d0c08 114.BR "key=value" .
a0cfa735
UH
115.sp
116Example for loading a binary file with options:
117.sp
118.RB " $ " "sigrok\-cli \-i example.bin"
119.br
120.BR " \-I binary:numchannels=4:samplerate=1mhz" " [...]"
43e5747a
UH
121.TP
122.BR "\-o, \-\-output\-file " <filename>
123Save output to a file instead of writing it to stdout. The default format
124used when saving is the sigrok session file format. This can be changed with
125the
76ae913d 126.B \-\-output\-format
7949dca0 127option.
a0cfa735
UH
128.sp
129Example for saving data in the sigrok session format:
130.sp
131.RB " $ " "sigrok\-cli " "[...] " "\-o example.sr"
7949dca0 132.TP
a0cfa735 133.BR "\-O, \-\-output\-format " <format>
7949dca0 134Set the output format to use. Use the
a0cfa735 135.BR "\-L " ( "\-\-list\-supported" ")"
10d98b47
UH
136option to see a list of available output formats.
137.sp
138The format name may optionally be followed by a colon-separated list of
139options, where each option takes the form
7949dca0
UH
140.BR "key=value" .
141.sp
c1865eb5 142For example, the
7949dca0
UH
143.B bits
144or
145.B hex
146formats, 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
a0cfa735 147.B "\-O hex:width=128"
7949dca0
UH
148will display 128 bits per line, in hexadecimal:
149.sp
10d98b47
UH
150 0:ffff ffff ffff ffff ffff ffff ffff ffff
151 1:ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00
7949dca0 152.sp
029d73fe 153The lines always start with the channel number (or name, if defined), followed by a colon. If no format is specified, it defaults to
7949dca0
UH
154.BR bits:width=64 ,
155like this:
156.sp
10d98b47
UH
157 0:11111111 11111111 11111111 11111111 [...]
158 1:11111111 00000000 11111111 00000000 [...]
a0cfa735 159.sp
f5735c5e 160Example for saving data in the CSV format with options:
a0cfa735 161.sp
f5735c5e
GS
162.RB " $ " "sigrok\-cli " "[...] " "\-o example.csv \-O csv:dedup:header=false"
163.sp
164Notice that boolean options are \fBtrue\fP when no value gets specified.
43e5747a 165.TP
3dfbfbc8 166.BR "\-C, \-\-channels " <channellist>
029d73fe 167A comma-separated list of channels to be used in the session.
43e5747a 168.sp
029d73fe 169Note that sigrok always names the channels according to how they're shown on
a0cfa735 170the enclosure of the hardware. If your logic analyzer numbers the channels 0\-15,
029d73fe 171that's how you must specify them with this option. An oscilloscope's channels
10d98b47 172would generally be referred to as "CH1", "CH2", and so on.
029d73fe 173Use the \fB\-\-show\fP option to see a list of channel names for your device.
53155b2f 174.sp
029d73fe
UH
175The default is to use all the channels available on a device. You can name
176a channel like this:
43e5747a 177.BR "1=CLK" .
029d73fe 178A range of channels can also be given, in the form
43e5747a
UH
179.BR "1\-5" .
180.sp
181Example:
182.sp
10d98b47
UH
183.RB " $ " "sigrok\-cli \-\-driver fx2lafw \-\-samples 100"
184.br
3dfbfbc8 185.B " \-\-channels 1=CLK,2\-4,7"
43e5747a
UH
186.br
187 CLK:11111111 11111111 11111111 11111111 [...]
188 2:11111111 11111111 11111111 11111111 [...]
189 3:11111111 11111111 11111111 11111111 [...]
190 4:11111111 11111111 11111111 11111111 [...]
191 7:11111111 11111111 11111111 11111111 [...]
192.sp
193The comma-separated list is processed from left to right, i.e. items farther
194to the right override previous items. For example
bf836932 195.B "1=CS,CS=MISO"
029d73fe 196will set the name of channel 1 to
43e5747a 197.BR "MISO" .
43e5747a 198.TP
ca50f4b3 199.BR "\-g, \-\-channel\-group "<channel\ group>
a0cfa735
UH
200Specify the channel group to operate on. Some devices organize channels into
201groups, the settings of which can only be changed as a group. The list of
202channel groups, if any, is displayed with the \fB\-\-show\fP command.
203.sp
f5735c5e 204Examples:
a0cfa735
UH
205.sp
206.RB " $ " "sigrok\-cli \-g CH1" " [...]"
f5735c5e
GS
207.sp
208.RB " $ " "sigrok\-cli \-d demo \-g Logic \-c pattern=graycode" " [...]"
31f9318a 209.TP
43e5747a
UH
210.BR "\-t, \-\-triggers " <triggerlist>
211A comma-separated list of triggers to use, of the form
029d73fe
UH
212.BR "<channel>=<trigger>" .
213You can use the name or number of the channel, and the trigger itself is a
43e5747a
UH
214series of characters:
215.sp
216.BR "0 or 1" :
217A low or high value on the pin.
218.br
219.BR "r or f" :
220A rising or falling value on the pin. An
221.B r
222effectively corresponds to
223.BR 01 .
224.br
f99038b4 225.BR "e" :
85f2ddbb 226Any kind of change on a pin (either a rising or a falling edge).
43e5747a 227.sp
10d98b47
UH
228Not every device supports all of these trigger types. Use the \fB\-\-show\fP
229command to see which triggers your device supports.
43e5747a 230.TP
a0cfa735 231.BR "\-w, \-\-wait\-trigger"
10d98b47
UH
232Don't output any sample data (even if it's actually received from the
233hardware) before the trigger condition is met. In other words, do not output
234any pre-trigger data. This option is useful if you don't care about the data
235that came before the trigger (but the hardware delivers this data to sigrok
236nonetheless).
43e5747a 237.TP
b5ac81ad 238.BR "\-P, \-\-protocol\-decoders " <list>
85f2ddbb
UH
239This option allows the user to specify a comma-separated list of protocol
240decoders to be used in this session. The decoders are specified by their
241ID, as shown in the
a0cfa735 242.BR "\-L " ( "\-\-list\-supported" ")"
85f2ddbb
UH
243output.
244.sp
245Example:
246.sp
247 $
b5ac81ad 248.B "sigrok\-cli \-i <file.sr> \-P i2c"
85f2ddbb
UH
249.sp
250Each protocol decoder can optionally be followed by a colon-separated list
251of options, where each option takes the form
252.BR "key=value" .
253.sp
254Example:
255.sp
256 $
8791df07
UH
257.B "sigrok\-cli \-i <file.sr> "
258.br
259.B " \-P uart:baudrate=115200:parity_type=odd"
85f2ddbb
UH
260.sp
261The list of supported options depends entirely on the protocol decoder. Every
262protocol decoder has different options it supports.
263.sp
264Any "options" specified for a protocol decoder which are not actually
029d73fe 265supported options, will be interpreted as being channel name/number assignments.
85f2ddbb
UH
266.sp
267Example:
268.sp
269 $
270.B "sigrok\-cli \-i <file.sr>"
271.br
bf836932 272.B " \-P spi:wordsize=9:miso=1:mosi=5:clk=3:cs=0"
85f2ddbb
UH
273.sp
274In this example,
275.B wordsize
276is an option supported by the
277.B spi
278protocol decoder. Additionally, the user tells sigrok to decode the SPI
029d73fe 279protocol using channel 1 as MISO signal for SPI, channel 5 as MOSI, channel 3
bf836932 280as CLK, and channel 0 as CS# signal.
65f903f9
GS
281.sp
282Notice that the
283.B sigrok\-cli
284application does not support "name matching". Instead it's assumed that the
285traces in the input stream match the order of the decoder's input signals,
286or that users explicitly specify the input channel to decoder signal mapping.
e4b7762f
GS
287.br
288.sp
289When multiple decoders are specified in the same
290.BR -P
291option, they will be stacked on top of each other in the specified order.
292.sp
293Example:
294.sp
295 $
296.B "sigrok\-cli \-i <file.sr> \-P i2c,eeprom24xx"
297.br
298 $
299.B "sigrok\-cli \-i <file.sr> \-P uart:baudrate=31250,midi"
300.sp
301When multiple
302.BR -P
303options are specified, each of them creates one decoder stack, which
304executes in parallel to other decoder stacks.
305.sp
306Example:
307.sp
308 $
309.B "sigrok\-cli \-i <file.sr> \-P uart:tx=D0:rx=D1 \-P timing:data=D2"
310.sp
85f2ddbb 311.TP
b6bd032d 312.BR "\-A, \-\-protocol\-decoder\-annotations " <annotations>
87d526cf
UH
313By default, all annotation output of all protocol decoders is
314shown. With this option a specific decoder's annotations can be selected for
315display, by specifying the decoder ID:
7fb87027
BV
316.sp
317 $
a0cfa735 318.B "sigrok\-cli \-i <file.sr> \-P i2c,i2cfilter,edid \-A i2c"
7fb87027 319.sp
6c5438fe 320If a protocol decoder has multiple annotation classes, you can also specify
790b0261 321which one of them to show by specifying its short description like this:
7fb87027
BV
322.sp
323 $
b5ac81ad 324.B "sigrok\-cli \-i <file.sr> \-P i2c,i2cfilter,edid"
7fb87027 325.br
a0cfa735 326.B " \-A i2c=data\-read"
790b0261 327.sp
6c5438fe 328Select multiple annotation classes by separating them with a colon:
790b0261
BV
329.sp
330 $
331.B "sigrok\-cli \-i <file.sr> \-P i2c,i2cfilter,edid"
332.br
a0cfa735 333.B " \-A i2c=data\-read:data\-write"
7fb87027 334.sp
b7360ee6
GS
335Annotation row names will resolve to their respective list of classes.
336Row and class names can be used in combination. When names are ambiguous
337then class names take precedence.
338.sp
339 $
340.B "sigrok\-cli \-i <file.sr> \-P i2c"
341.br
342.B " \-A i2c=addr\-data:warnings"
343.sp
344You can also select multiple protocol decoders, with optionally selected
345annotation classes each, by separating them with commas:
7fb87027
BV
346.sp
347 $
b5ac81ad 348.B "sigrok\-cli \-i <file.sr> \-P i2c,i2cfilter,edid"
7fb87027 349.br
a0cfa735 350.B " \-A i2c=data\-read:data\-write,edid"
7fb87027 351.TP
b0f1c540
BV
352.BR "\-M, \-\-protocol\-decoder\-meta " <pdname>
353When given, show protocol decoder meta output instead of annotations.
354The argument is the name of the decoder whose meta output to show.
355.sp
356 $
357.B "sigrok\-cli \-i <file.sr> \-M i2c"
358.sp
359Not every decoder generates meta output.
360.TP
361.BR "\-B, \-\-protocol\-decoder\-binary " <binaryspec>
362When given, decoder "raw" data of various kinds is written to stdout instead
363of annotations (this could be raw binary UART/SPI bytes, or WAV files, PCAP
364files, PNG files, or anything else; this is entirely dependent on the
365decoder and what kinds of binary output make sense for that decoder).
366.sp
367No other information is printed to stdout, so this is
368suitable for piping into other programs or saving to a file.
369.sp
370Protocol decoders that support binary output publish a list of binary
371classes, for example the UART decoder might have "TX" and "RX". To
372select TX for output, the argument to this option would be:
373.sp
374 $
375.B "sigrok\-cli \-i <file.sr> \-B uart=tx"
376.br
377.sp
378If only the protocol decoder is specified, without binary class, all classes
379are written to stdout:
380.sp
381 $
382.B "sigrok\-cli \-i <file.sr> \-B uart"
383.sp
384(this is only useful in rare cases, generally you would specify a certain
385binary class you're interested in)
386.sp
387Not every decoder generates binary output.
388.TP
8aafb57c
GS
389.BR "\-\-protocol\-decoder\-samplenum
390When given, decoder annotations will include sample numbers, too.
391This allows consumers to receive machine readable timing information.
392.TP
53155b2f 393.BR "\-l, \-\-loglevel " <level>
a0cfa735 394Set the libsigrok and libsigrokdecode loglevel. At the moment \fBsigrok\-cli\fP
10d98b47 395doesn't support setting the two loglevels independently. The higher the
53155b2f
BV
396number, the more debug output will be printed. Valid loglevels are:
397.sp
398\fB0\fP None
399.br
400\fB1\fP Error
401.br
402\fB2\fP Warnings
403.br
404\fB3\fP Informational
405.br
406\fB4\fP Debug
407.br
408\fB5\fP Spew
409.TP
410.B "\-\-show"
411.br
10d98b47
UH
412Show information about the selected option. For example, to see options for a
413connected fx2lafw device:
53155b2f
BV
414.sp
415 $
416.B "sigrok\-cli \-\-driver fx2lafw \-\-show
417.sp
10d98b47
UH
418In order to properly get device options for your hardware, some drivers might
419need a serial port specified:
53155b2f
BV
420.sp
421 $
422.B "sigrok\-cli \-\-driver ols:conn=/dev/ttyACM0 \-\-show
423.sp
a8b4041a 424This also works for protocol decoders, input modules and output modules:
53155b2f
BV
425.sp
426 $
ad6520c4
BV
427.B "sigrok\-cli \-\-protocol\-decoders i2c \-\-show
428 $
a8b4041a
BV
429.B "sigrok\-cli \-\-input\-format csv \-\-show
430 $
ad6520c4 431.B "sigrok\-cli \-\-output\-format bits \-\-show
53155b2f 432.TP
b5ac81ad
BV
433.B "\-\-scan"
434Scan for devices that can be detected automatically.
10d98b47
UH
435.sp
436Example:
437.sp
438 $
b5ac81ad 439.B "sigrok\-cli \-\-scan
10d98b47
UH
440.br
441 The following devices were found:
442.br
a0cfa735 443 demo \- Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3
10d98b47 444.br
a0cfa735 445 fx2lafw:conn=3.26 \- CWAV USBee SX with 8 channels: 0 1 2 3 4 5 6 7
10d98b47
UH
446.sp
447However, not all devices are auto-detectable (e.g. serial port based ones).
448For those you'll have to provide a \fBconn\fP option, see above.
449.sp
450 $
a0cfa735 451.B "sigrok\-cli \-\-driver digitek\-dt4000zc:conn=/dev/ttyUSB0 \-\-scan
10d98b47
UH
452.br
453 The following devices were found:
454.br
029d73fe 455 Digitek DT4000ZC with 1 channel: P1
53155b2f 456.TP
43e5747a
UH
457.BR "\-\-time " <ms>
458Sample for
459.B <ms>
10d98b47
UH
460milliseconds, then quit.
461.sp
bf836932
UH
462You can optionally follow the number by \fBs\fP to specify the time to
463sample in seconds.
10d98b47
UH
464.sp
465For example,
43e5747a
UH
466.B "\-\-time 2s"
467will sample for two seconds.
468.TP
469.BR "\-\-samples " <numsamples>
470Acquire
471.B <numsamples>
472samples, then quit.
10d98b47
UH
473.sp
474You can optionally follow the number by \fBk\fP, \fBm\fP, or \fBg\fP to
475specify the number of samples in kilosamples, megasamples, or gigasamples,
476respectively.
477.sp
478For example,
479.B "\-\-samples 3m"
480will acquire 3000000 samples.
43e5747a 481.TP
66d5560b
UH
482.BR "\-\-frames " <numframes>
483Acquire
484.B <numframes>
485frames, then quit.
486.TP
43e5747a
UH
487.BR "\-\-continuous"
488Sample continuously until stopped. Not all devices support this.
2d73284e 489.TP
62a64762
BV
490.BR "\-\-get " <variable>
491Get the value of
492.B <variable>
493from the specified device and print it.
494.TP
2d73284e 495.BR "\-\-set"
b8656921
UH
496Set one or more variables specified with the \fB\-\-config\fP option, without
497doing any acquisition.
53155b2f 498.SH EXAMPLES
b8656921
UH
499In order to get exactly 100 samples from the connected fx2lafw-supported logic
500analyzer hardware, run the following command:
43e5747a 501.TP
53155b2f 502.B " sigrok\-cli \-\-driver fx2lafw \-\-samples 100"
43e5747a 503.TP
2d73284e 504If you want to sample data for 3 seconds (3000 ms), use:
43e5747a 505.TP
53155b2f 506.B " sigrok\-cli \-\-driver fx2lafw \-\-time 3000"
43e5747a
UH
507.TP
508Alternatively, you can also use:
509.TP
53155b2f 510.B " sigrok\-cli \-\-driver fx2lafw \-\-time 3s"
43e5747a 511.TP
029d73fe 512To capture data from the first 4 channels using the Openbench Logic Sniffer lasting 100ms at 10 MHz starting at the trigger condition
53155b2f 5130:high, 1:rising, 2:low, 3:high, use:
43e5747a 514.TP
53155b2f 515.nf
b5ac81ad 516\fBsigrok\-cli \-\-driver ols:conn=/dev/ttyACM0 \-\-config samplerate=10m \\\fP
3dfbfbc8 517\fB\-\-output\-format bits \-\-channels 0\-3 \-\-wait\-trigger \\\fP
b5ac81ad 518\fB\-\-triggers 0=1,1=r,2=0,3=1 \-\-time 100\fP
2d73284e
BV
519.TP
520To turn on internal logging on a Lascar EL-USB series device:
521.TP
522\fBsigrok\-cli \-\-driver lascar\-el\-usb:conn=10c4.0002 \\\fP
b8656921 523\fB\-\-config datalog=on \-\-set\fP
43e5747a
UH
524.SH "EXIT STATUS"
525.B sigrok\-cli
526exits with 0 on success, 1 on most failures.
527.SH "SEE ALSO"
b5ac81ad 528\fBpulseview\fP(1)
43e5747a 529.SH "BUGS"
10d98b47
UH
530Please report any bugs via Bugzilla
531.RB "(" http://sigrok.org/bugzilla ")"
532or on the sigrok\-devel mailing list
43e5747a
UH
533.RB "(" sigrok\-devel@lists.souceforge.net ")."
534.SH "LICENSE"
535.B sigrok\-cli
536is covered by the GNU General Public License (GPL). Some portions are
537licensed under the "GPL v2 or later", some under "GPL v3 or later".
538.SH "AUTHORS"
539Please see the individual source code files.
540.PP
541This manual page was written by Uwe Hermann <uwe@hermann\-uwe.de>.
542It is licensed under the terms of the GNU GPL (version 2 or later).