]> sigrok.org Git - sigrok-cli.git/blame_incremental - doc/sigrok-cli.1
add --dont-scan (-D) command line option
[sigrok-cli.git] / doc / sigrok-cli.1
... / ...
CommitLineData
1.TH SIGROK\-CLI 1 "March 28, 2019"
2.SH "NAME"
3sigrok\-cli \- Command-line client for the sigrok software
4.SH "SYNOPSIS"
5.B sigrok\-cli [OPTIONS] [COMMAND]
6.SH "DESCRIPTION"
7\fBsigrok\-cli\fP is a cross-platform command line utility for the
8\fBsigrok\fP software.
9.PP
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.
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.
17.SH OPTIONS
18.TP
19.B "\-h, \-\-help"
20Show a help text and exit.
21.TP
22.B "\-V, \-\-version"
23Show
24.B sigrok\-cli
25version and the versions of libraries used.
26.TP
27.B "\-L, \-\-list\-supported"
28Show information about supported hardware drivers, input file
29formats, output file formats, and protocol decoders.
30.TP
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
36\fB\-d, \-\-driver\fP <drivername>
37A driver must always be selected (unless doing a global scan). Use the
38.BR "\-L " ( "\-\-list\-supported" ")"
39option to get a list of available drivers.
40.sp
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:
47.sp
48.RB " $ " "sigrok\-cli \-\-driver=ols:conn=/dev/ttyACM0" " [...]"
49.sp
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:
53.sp
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" " [...]"
61.TP
62.B "\-D, \-\-dont\-scan"
63Do not automatically scan for device drivers in the absence of a
64.BR "\-d " ( "\-\-driver" )
65specification.
66.TP
67.BR "\-c, \-\-config " <deviceoption>
68A colon-separated list of device options, where each option takes the form
69.BR key=value .
70For example, to set the samplerate to 1MHz on a device supported by the
71fx2lafw driver, you might specify
72.sp
73.RB " $ " "sigrok\-cli \-d fx2lafw \-\-config samplerate=1m" " [...]"
74.sp
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.
77The following are all equivalent:
78.sp
79.RB " $ " "sigrok\-cli \-d fx2lafw \-\-config samplerate=1000000" " [...]"
80.sp
81.RB " $ " "sigrok\-cli \-d fx2lafw \-\-config samplerate=1m" " [...]"
82.sp
83.RB " $ " "sigrok\-cli \-d fx2lafw \-\-config \(dqsamplerate=1 MHz\(dq" " [...]"
84.TP
85.BR "\-i, \-\-input\-file " <filename>
86Load input from a file instead of a hardware device. You can specify
87"-" to use stdin as input. If the
88.B \-\-input\-format
89option is not supplied, sigrok\-cli attempts to autodetect the file format of
90the input file.
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 \-" " [...]
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 ),
108sigrok-cli attempts to autodetect the file format of the input file. Use the
109.BR "\-L " ( "\-\-list\-supported" ")"
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
114.BR "key=value" .
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" " [...]"
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
126.B \-\-output\-format
127option.
128.sp
129Example for saving data in the sigrok session format:
130.sp
131.RB " $ " "sigrok\-cli " "[...] " "\-o example.sr"
132.TP
133.BR "\-O, \-\-output\-format " <format>
134Set the output format to use. Use the
135.BR "\-L " ( "\-\-list\-supported" ")"
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
140.BR "key=value" .
141.sp
142For example, the
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
147.B "\-O hex:width=128"
148will display 128 bits per line, in hexadecimal:
149.sp
150 0:ffff ffff ffff ffff ffff ffff ffff ffff
151 1:ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00
152.sp
153The lines always start with the channel number (or name, if defined), followed by a colon. If no format is specified, it defaults to
154.BR bits:width=64 ,
155like this:
156.sp
157 0:11111111 11111111 11111111 11111111 [...]
158 1:11111111 00000000 11111111 00000000 [...]
159.sp
160Example for saving data in the CSV format with options:
161.sp
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.
165.TP
166.BR "\-C, \-\-channels " <channellist>
167A comma-separated list of channels to be used in the session.
168.sp
169Note that sigrok always names the channels according to how they're shown on
170the enclosure of the hardware. If your logic analyzer numbers the channels 0\-15,
171that's how you must specify them with this option. An oscilloscope's channels
172would generally be referred to as "CH1", "CH2", and so on.
173Use the \fB\-\-show\fP option to see a list of channel names for your device.
174.sp
175The default is to use all the channels available on a device. You can name
176a channel like this:
177.BR "1=CLK" .
178A range of channels can also be given, in the form
179.BR "1\-5" .
180.sp
181Example:
182.sp
183.RB " $ " "sigrok\-cli \-\-driver fx2lafw \-\-samples 100"
184.br
185.B " \-\-channels 1=CLK,2\-4,7"
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
195.B "1=CS,CS=MISO"
196will set the name of channel 1 to
197.BR "MISO" .
198.TP
199.BR "\-g, \-\-channel\-group "<channel\ group>
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
204Examples:
205.sp
206.RB " $ " "sigrok\-cli \-g CH1" " [...]"
207.sp
208.RB " $ " "sigrok\-cli \-d demo \-g Logic \-c pattern=graycode" " [...]"
209.TP
210.BR "\-t, \-\-triggers " <triggerlist>
211A comma-separated list of triggers to use, of the form
212.BR "<channel>=<trigger>" .
213You can use the name or number of the channel, and the trigger itself is a
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
225.BR "e" :
226Any kind of change on a pin (either a rising or a falling edge).
227.sp
228Not every device supports all of these trigger types. Use the \fB\-\-show\fP
229command to see which triggers your device supports.
230.TP
231.BR "\-w, \-\-wait\-trigger"
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).
237.TP
238.BR "\-P, \-\-protocol\-decoders " <list>
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
242.BR "\-L " ( "\-\-list\-supported" ")"
243output.
244.sp
245Example:
246.sp
247 $
248.B "sigrok\-cli \-i <file.sr> \-P i2c"
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 $
257.B "sigrok\-cli \-i <file.sr> "
258.br
259.B " \-P uart:baudrate=115200:parity_type=odd"
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
265supported options, will be interpreted as being channel name/number assignments.
266.sp
267Example:
268.sp
269 $
270.B "sigrok\-cli \-i <file.sr>"
271.br
272.B " \-P spi:wordsize=9:miso=1:mosi=5:clk=3:cs=0"
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
279protocol using channel 1 as MISO signal for SPI, channel 5 as MOSI, channel 3
280as CLK, and channel 0 as CS# signal.
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.
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
311.TP
312.BR "\-A, \-\-protocol\-decoder\-annotations " <annotations>
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:
316.sp
317 $
318.B "sigrok\-cli \-i <file.sr> \-P i2c,i2cfilter,edid \-A i2c"
319.sp
320If a protocol decoder has multiple annotation classes, you can also specify
321which one of them to show by specifying its short description like this:
322.sp
323 $
324.B "sigrok\-cli \-i <file.sr> \-P i2c,i2cfilter,edid"
325.br
326.B " \-A i2c=data\-read"
327.sp
328Select multiple annotation classes by separating them with a colon:
329.sp
330 $
331.B "sigrok\-cli \-i <file.sr> \-P i2c,i2cfilter,edid"
332.br
333.B " \-A i2c=data\-read:data\-write"
334.sp
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:
346.sp
347 $
348.B "sigrok\-cli \-i <file.sr> \-P i2c,i2cfilter,edid"
349.br
350.B " \-A i2c=data\-read:data\-write,edid"
351.TP
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
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
393.BR "\-l, \-\-loglevel " <level>
394Set the libsigrok and libsigrokdecode loglevel. At the moment \fBsigrok\-cli\fP
395doesn't support setting the two loglevels independently. The higher the
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
412Show information about the selected option. For example, to see options for a
413connected fx2lafw device:
414.sp
415 $
416.B "sigrok\-cli \-\-driver fx2lafw \-\-show
417.sp
418In order to properly get device options for your hardware, some drivers might
419need a serial port specified:
420.sp
421 $
422.B "sigrok\-cli \-\-driver ols:conn=/dev/ttyACM0 \-\-show
423.sp
424This also works for protocol decoders, input modules and output modules:
425.sp
426 $
427.B "sigrok\-cli \-\-protocol\-decoders i2c \-\-show
428 $
429.B "sigrok\-cli \-\-input\-format csv \-\-show
430 $
431.B "sigrok\-cli \-\-output\-format bits \-\-show
432.TP
433.B "\-\-scan"
434Scan for devices that can be detected automatically.
435.sp
436Example:
437.sp
438 $
439.B "sigrok\-cli \-\-scan
440.br
441 The following devices were found:
442.br
443 demo \- Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3
444.br
445 fx2lafw:conn=3.26 \- CWAV USBee SX with 8 channels: 0 1 2 3 4 5 6 7
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 $
451.B "sigrok\-cli \-\-driver digitek\-dt4000zc:conn=/dev/ttyUSB0 \-\-scan
452.br
453 The following devices were found:
454.br
455 Digitek DT4000ZC with 1 channel: P1
456.TP
457.BR "\-\-time " <ms>
458Sample for
459.B <ms>
460milliseconds, then quit.
461.sp
462You can optionally follow the number by \fBs\fP to specify the time to
463sample in seconds.
464.sp
465For example,
466.B "\-\-time 2s"
467will sample for two seconds.
468.TP
469.BR "\-\-samples " <numsamples>
470Acquire
471.B <numsamples>
472samples, then quit.
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.
481.TP
482.BR "\-\-frames " <numframes>
483Acquire
484.B <numframes>
485frames, then quit.
486.TP
487.BR "\-\-continuous"
488Sample continuously until stopped. Not all devices support this.
489.TP
490.BR "\-\-get " <variable>
491Get the value of
492.B <variable>
493from the specified device and print it.
494.TP
495.BR "\-\-set"
496Set one or more variables specified with the \fB\-\-config\fP option, without
497doing any acquisition.
498.SH EXAMPLES
499In order to get exactly 100 samples from the connected fx2lafw-supported logic
500analyzer hardware, run the following command:
501.TP
502.B " sigrok\-cli \-\-driver fx2lafw \-\-samples 100"
503.TP
504If you want to sample data for 3 seconds (3000 ms), use:
505.TP
506.B " sigrok\-cli \-\-driver fx2lafw \-\-time 3000"
507.TP
508Alternatively, you can also use:
509.TP
510.B " sigrok\-cli \-\-driver fx2lafw \-\-time 3s"
511.TP
512To capture data from the first 4 channels using the Openbench Logic Sniffer lasting 100ms at 10 MHz starting at the trigger condition
5130:high, 1:rising, 2:low, 3:high, use:
514.TP
515.nf
516\fBsigrok\-cli \-\-driver ols:conn=/dev/ttyACM0 \-\-config samplerate=10m \\\fP
517\fB\-\-output\-format bits \-\-channels 0\-3 \-\-wait\-trigger \\\fP
518\fB\-\-triggers 0=1,1=r,2=0,3=1 \-\-time 100\fP
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
523\fB\-\-config datalog=on \-\-set\fP
524.SH "EXIT STATUS"
525.B sigrok\-cli
526exits with 0 on success, 1 on most failures.
527.SH "SEE ALSO"
528\fBpulseview\fP(1)
529.SH "BUGS"
530Please report any bugs via Bugzilla
531.RB "(" http://sigrok.org/bugzilla ")"
532or on the sigrok\-devel mailing list
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).