SIGROK-CLI(1)

πŸ“¦
version 0.7.2 Β· 2 versions
, in arch rolling, debian bookworm, debian trixie, fedora 43, fedora 44, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 SIGROK-CLI 🌸

okay bestie, this is the manual page for sigrok-cli, aka the command-line client for the sigrok software, from the General Commands Manual section (1). like, section 1, the classics. πŸ’…


✨ NAME ✨

sigrok-cli β€” command-line client for the sigrok software


πŸŽ€ SYNOPSIS πŸŽ€

sigrok-cli [OPTIONS] [COMMAND]

πŸ¦‹ DESCRIPTION πŸ¦‹

sigrok-cli is a cross-platform command line utility for the sigrok software. no cap.

It cannot display graphical output, but bestie, it's still so sufficient to run through the whole process of hardware initialization, acquisition, protocol decoding and saving the session. the whole glow-up pipeline, start to finish. ✨

It's useful for running on remote or embedded systems, netbooks, PDAs, and for various other use-cases. It can display samples on standard output or save them in various file formats. it's giving "small but mighty". πŸ”₯


πŸ’– OPTIONS πŸ’–

  • -h, --help β€” Show a help text and exit. classic. 🫢
  • -V, --version β€” Show sigrok-cli version and the versions of libraries used. receipts included, we love transparency. πŸ‘‘
  • -L, --list-supported β€” Show information about supported hardware drivers, input file formats, output file formats, and protocol decoders. the whole menu, periodt.
  • --list-supported-wiki β€” Show information about supported protocol decoders in MediaWiki syntax. This is generally only used by developers to easily update the list of supported protocol decoders in the sigrok wiki. (iykyk β€” it's a dev thing πŸ’€)
  • -d, --driver <drivername> β€” Unless doing a global scan, users typically select one of the available drivers. This can speedup program start, and can avoid false matches for ambiguous configurations. Selecting a driver also allows to pass more driver specific options. Use the -L (--list-supported) option to get a list of available drivers.

Drivers can take options, in the form key=value separated by colons.

Drivers communicating with hardware via a serial port always need the port specified as the conn option. For example, to use the Openbench Logic Sniffer:

$ sigrok-cli --driver=ols:conn=/dev/ttyACM0 [...]

Some USB devices don't use a unique VendorID/ProductID combination, and thus need that specified as well. Notice that colons are used to separate the driver name from the conn option, thus colons cannot be used within the conn option's argument. To select a specific USB device, use either VendorID.ProductID or bus.address:

USB VendorID.ProductID example:

$ sigrok-cli --driver=uni-t-ut61e:conn=1a86.e008 [...]

USB bus.address example:

$ sigrok-cli --driver=uni-t-ut61e:conn=4.6 [...]
  • -D, --dont-scan β€” Do not automatically scan for device drivers in the absence of a -d (--driver) specification. we're not doing the automatic thing today bestie. πŸ™ˆ
  • -c, --config <deviceoption> β€” A colon-separated list of device options, where each option takes the form key=value. Multiple occurances of the --config option are supported. The first item in the list of options can take the form channel_group=<name> which would override the --channel-group specification for this list of options. Other option lists in other --config occurances are not affected by this list's channel group name.

For example, to set the samplerate to 1MHz on a device supported by the fx2lafw driver, you might specify

$ sigrok-cli -d fx2lafw --config samplerate=1m [...]

Samplerate is an option common to most logic analyzers. The argument specifies the samplerate in Hz. You can also specify the samplerate in kHz, MHz or GHz. The following are all equivalent:

$ sigrok-cli -d fx2lafw --config samplerate=1000000 [...]
$ sigrok-cli -d fx2lafw --config samplerate=1m [...]
$ sigrok-cli -d fx2lafw --config "samplerate=1 MHz" [...]

These examples specify options within a channel group. The first two are equivalent.

$ sigrok-cli -d demo --channel-group Logic --config pattern=random [...]
$ sigrok-cli -d demo --config channel_group=Logic:pattern=random [...]
$ sigrok-cli -d demo --config samplerate=1m --config channel_group=Logic:pattern=random [...]
  • -i, --input-file <filename> β€” Load input from a file instead of a hardware device. You can specify "-" to use stdin as input. If the --input-format option is not supplied, sigrok-cli attempts to autodetect the file format of the input file. it'll figure it out, it's smart like that. 🧚

Example for loading a sigrok session file:

$ sigrok-cli -i example.sr [...]

Example for loading a WAV file (autodetection of input format):

$ sigrok-cli -i example.wav [...]

Example for loading a VCD file from stdin (autodetection of input format):

$ cat example.vcd | sigrok-cli -i - [...]
  • -I, --input-format <format> β€” When loading an input file, assume it's in the specified format. If this option is not supplied (in addition to --input-file), sigrok-cli attempts to autodetect the file format of the input file. Use the -L (--list-supported) option to see a list of available input formats.

The format name may optionally be followed by a colon-separated list of options, where each option takes the form key=value.

Example for loading a binary file with options:

$ sigrok-cli -i example.bin
             -I binary:numchannels=4:samplerate=1mhz [...]
  • -o, --output-file <filename> β€” Save output to a file instead of writing it to stdout. The default format used when saving is the sigrok session file format. This can be changed with the --output-format option.

Example for saving data in the sigrok session format:

$ sigrok-cli [...] -o example.sr
  • -O, --output-format <format> β€” Set the output format to use. Use the -L (--list-supported) option to see a list of available output formats.

The format name may optionally be followed by a colon-separated list of options, where each option takes the form key=value.

For example, the bits or hex 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 -O hex:width=128 will display 128 bits per line, in hexadecimal:

0:ffff ffff ffff ffff ffff ffff ffff ffff
1:ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00

The lines always start with the channel number (or name, if defined), followed by a colon. If no format is specified, it defaults to bits:width=64, like this:

0:11111111 11111111 11111111 11111111 [...]
1:11111111 00000000 11111111 00000000 [...]

Example for saving data in the CSV format with options:

$ sigrok-cli [...] -o example.csv -O csv:dedup:header=false

Notice that boolean options are true when no value gets specified. πŸ‘€

  • -C, --channels <channellist> β€” A comma-separated list of channels to be used in the session.

Note that sigrok always names the channels according to how they're shown on the enclosure of the hardware. If your logic analyzer numbers the channels 0-15, that's how you must specify them with this option. An oscilloscope's channels would generally be referred to as "CH1", "CH2", and so on. Use the --show option to see a list of channel names for your device.

The default is to use all the channels available on a device. You can name a channel like this: 1=CLK. A range of channels can also be given, in the form 1-5.

Example:

$ sigrok-cli --driver fx2lafw --samples 100
             --channels 1=CLK,2-4,7
CLK:11111111 11111111 11111111 11111111 [...]
  2:11111111 11111111 11111111 11111111 [...]
  3:11111111 11111111 11111111 11111111 [...]
  4:11111111 11111111 11111111 11111111 [...]
  7:11111111 11111111 11111111 11111111 [...]

The comma-separated list is processed from left to right, i.e. items farther to the right override previous items. For example 1=CS,CS=MISO will set the name of channel 1 to MISO. last one wins, bestie. πŸ’…

  • -g, --channel-group <channel group> β€” Specify the channel group to operate on. Some devices organize channels into groups, the settings of which can only be changed as a group. The list of channel groups, if any, is displayed with the --show command.

Examples:

$ sigrok-cli -g CH1 [...]
$ sigrok-cli -d demo -g Logic -c pattern=graycode [...]

Channel group specifications in --get or --config options take precedence over channel group names in --channel-group so that a single sigrok-cli invocation can support the query or manipulation of multiple device options which reside in different channel groups.

  • -t, --triggers <triggerlist> β€” A comma-separated list of triggers to use, of the form <channel>=<trigger>. You can use the name or number of the channel, and the trigger itself is a series of characters:
    • 0 or 1: A low or high value on the pin.
    • r or f: A rising or falling value on the pin. An r effectively corresponds to 01.
    • e: Any kind of change on a pin (either a rising or a falling edge).

Not every device supports all of these trigger types. Use the --show command to see which triggers your device supports. vibe check your hardware first. ⭐

  • -w, --wait-trigger β€” Don't output any sample data (even if it's actually received from the hardware) before the trigger condition is met. In other words, do not output any pre-trigger data. This option is useful if you don't care about the data that came before the trigger (but the hardware delivers this data to sigrok nonetheless). not me ignoring the pre-trigger era πŸ’€
  • -P, --protocol-decoders <list> β€” This option allows the user to specify a comma-separated list of protocol decoders to be used in this session. The decoders are specified by their ID, as shown in the -L (--list-supported) output.

Example:

$ sigrok-cli -i <file.sr> -P i2c

Each protocol decoder can optionally be followed by a colon-separated list of options, where each option takes the form key=value.

Example:

$ sigrok-cli -i <file.sr>
             -P uart:baudrate=115200:parity_type=odd

The list of supported options depends entirely on the protocol decoder. Every protocol decoder has different options it supports.

Any "options" specified for a protocol decoder which are not actually supported options, will be interpreted as being channel name/number assignments.

Example:

$ sigrok-cli -i <file.sr> \
             -P spi:wordsize=9:miso=1:mosi=5:clk=3:cs=0

In this one, wordsize is an option that the spi protocol decoder itself supports. And then we're also telling sigrok to decode SPI using channel 1 as the MISO signal, channel 5 as MOSI, channel 3 as CLK, and channel 0 as the CS# signal. Bestie, you're basically hand-delivering the wiring diagram to the decoder πŸ’…

Heads up though: sigrok-cli does not do "name matching". So it just assumes your input traces line up in the same order as the decoder's input signals β€” or you explicitly spell out the input-channel-to-decoder-signal mapping yourself. No mind reading, no vibes-based inference. 😭

When you put multiple decoders in the same -P option, they stack on top of each other in the order you listed them. Chain 'em like friendship bracelets πŸŽ€

Example:

$ sigrok-cli -i <file.sr> -P i2c,eeprom24xx
$ sigrok-cli -i <file.sr> -P uart:baudrate=31250,midi

When you give multiple -P options, each one creates its own separate decoder stack, and those stacks all run in parallel with each other. Multitasking queen πŸ‘‘

Example:

$ sigrok-cli -i <file.sr> -P uart:tx=D0:rx=D1 -P timing:data=D2
  • -A, --protocol-decoder-annotations <annotations> β€” So by default, like, all the annotation output from all the protocol decoders gets shown. But with this option you can pick just one specific decoder's annotations to display, by naming the decoder ID:
$ sigrok-cli -i <file.sr> -P i2c,i2cfilter,edid -A i2c

And if a protocol decoder has multiple annotation classes, you can also say which one of them to show, by giving its short description, like this:

$ sigrok-cli -i <file.sr> -P i2c,i2cfilter,edid \
             -A i2c=data-read

Want multiple annotation classes? Separate them with a colon, bestie:

$ sigrok-cli -i <file.sr> -P i2c,i2cfilter,edid \
             -A i2c=data-read:data-write

Annotation row names will resolve to their own respective list of classes. And you can mix row names and class names together, no problem. When names are ambiguous, class names win. Periodt.

$ sigrok-cli -i <file.sr> -P i2c \
             -A i2c=addr-data:warnings

You can also select multiple protocol decoders β€” each with optionally selected annotation classes β€” by separating them with commas:

$ sigrok-cli -i <file.sr> -P i2c,i2cfilter,edid \
             -A i2c=data-read:data-write,edid
  • -M, --protocol-decoder-meta <pdname> β€” Give this one and instead of annotations you get the protocol decoder's meta output ✨ The argument is the name of the decoder whose meta output you want.
$ sigrok-cli -i <file.sr> -M i2c
Not every decoder generates meta output. Some are just out here doing the bare minimum. πŸ™ˆ
  • -B, --protocol-decoder-binary <binaryspec> β€” Give this one and decoder "raw" data of various kinds gets written to stdout instead of annotations. Could be raw binary UART/SPI bytes, or WAV files, or PCAP files, or PNG files, or literally anything else β€” it's entirely up to the decoder and whatever kinds of binary output actually make sense for that decoder.

Nothing else gets printed to stdout, so this is perfect for piping into other programs or saving straight to a file. Chef's kiss 🧚

Protocol decoders that support binary output publish a list of binary classes β€” for example the UART decoder might have "TX" and "RX". To select TX for output, your argument would look like:

$ sigrok-cli -i <file.sr> -B uart=tx

And if you only name the protocol decoder, with no binary class, then all classes get written to stdout:

$ sigrok-cli -i <file.sr> -B uart
(this is only useful in rare cases, generally you would specify a certain binary class you're interested in β€” like, be specific, it's a vibe check)

Not every decoder generates binary output either. Same energy as above. πŸ’€

  • --protocol-decoder-samplenum β€” Give it and decoder annotations will include sample numbers too. This lets consumers receive machine readable timing information. So valid, so useful. ⭐
  • -l, --loglevel <level> β€” Sets the libsigrok and libsigrokdecode loglevel. Right now sigrok-cli doesn't support setting those two loglevels independently β€” they move as a unit, it's giving package deal. The higher the number, the more debug output gets printed. Valid loglevels are:
0   None
1   Error
2   Warnings
3   Informational
4   Debug
5   Spew
  • --show β€” Shows information about the selected option. For example, to see options for a connected fx2lafw device:
$ sigrok-cli --driver fx2lafw --show

In order to properly get device options for your hardware, some drivers might need a serial port specified:

$ sigrok-cli --driver ols:conn=/dev/ttyACM0 --show

This also works for protocol decoders, input modules and output modules:

$ sigrok-cli --protocol-decoders i2c --show
$ sigrok-cli --input-format csv --show
$ sigrok-cli --output-format bits --show

And it works for input files too, including optional input format specifications:

$ sigrok-cli --input-file <file.sr> --show
$ sigrok-cli --input-file <file.vcd> --input-format vcd --show
  • --scan β€” Scan for devices that can be detected automatically. πŸ”

Example:

$ sigrok-cli --scan
The following devices were found:
demo - Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3
fx2lafw:conn=3.26 - CWAV USBee SX with 8 channels: 0 1 2 3 4 5 6 7

However β€” and this is the tea β˜• β€” not all devices are auto-detectable (e.g. serial port based ones). For those you'll have to provide a conn option, see above.

$ sigrok-cli --driver digitek-dt4000zc:conn=/dev/ttyUSB0 --scan
The following devices were found:
Digitek DT4000ZC with 1 channel: P1
  • --time <ms> β€” Sample for <ms> milliseconds, then quit. In and out, no lingering πŸ’¨

You can optionally follow the number by s to specify the time to sample in seconds.

For example, --time 2s will sample for two seconds.

  • --samples <numsamples> β€” Acquire <numsamples> samples, then quit.

You can optionally follow the number by k, m, or g to specify the number of samples in kilosamples, megasamples, or gigasamples, respectively. Slay units of measurement πŸ’–

For example, --samples 3m will acquire 3000000 samples.

  • --frames <numframes> β€” Acquire <numframes> frames, then quit.
  • --continuous β€” Sample continuously until stopped. Not all devices support this β€” some of them simply cannot commit like that. πŸ˜”
  • --get <variable> β€” Get the value of <variable> from the specified device and print it. Multiple variable names can be specified, and they get separated by colon. The list of variable names can optionally be preceeded by channel_group=<name>, which would override the --channel-group specification. Multiple --get occurances are supported in a single sigrok-cli invocation. Obsessed with the flexibility honestly.
$ sigrok-cli -d demo --get samplerate:averaging --get channel_group=Logic:pattern
  • --set β€” Set one or more variables specified with the --config option, without doing any acquisition. All config, zero capture, that's the deal ✨

✨ EXAMPLES ✨

In order to get exactly 100 samples from the connected fx2lafw-supported logic analyzer hardware, run the following command:

sigrok-cli --driver fx2lafw --samples 100

If you want to sample data for 3 seconds (3000 ms), use:

sigrok-cli --driver fx2lafw --time 3000

Alternatively, you can also use:

sigrok-cli --driver fx2lafw --time 3s

To capture data from the first 4 channels using the Openbench Logic Sniffer lasting 100ms at 10 MHz starting at the trigger condition 0:high, 1:rising, 2:low, 3:high, use:

sigrok-cli --driver ols:conn=/dev/ttyACM0 --config samplerate=10m \
       --output-format bits --channels 0-3 --wait-trigger \
       --triggers 0=1,1=r,2=0,3=1 --time 100

To turn on internal logging on a Lascar EL-USB series device:

sigrok-cli --driver lascar-el-usb:conn=10c4.0002 \
       --config datalog=on --set

πŸšͺ EXIT STATUS πŸšͺ

sigrok-cli exits with 0 on success, 1 on most failures. Two moods, that's it. 🫢


πŸ‘€ SEE ALSO πŸ‘€

pulseview(1)


πŸ› BUGS πŸ›

Please report any bugs via Bugzilla (http://sigrok.org/bugzilla) or on the sigrok-devel mailing list (sigrok-devel@lists.souceforge.net). The devs genuinely want to hear it, no gatekeeping πŸ’œ


πŸ“œ LICENSE πŸ“œ

sigrok-cli is covered by the GNU General Public License (GPL). Some portions are licensed under the "GPL v2 or later", some under "GPL v3 or later". Free as in freedom, iconic as in iconic πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

Please see the individual source code files.

This manual page was written by Uwe Hermann <uwe@hermann-uwe.de>. It is licensed under the terms of the GNU GPL (version 2 or later).


And that's the whole page, bestie β€” sourced from the sigrok-cli docs, the March 28, 2019 edition. Go forth and decode, you absolute main character. πŸŒΈπŸ¦‹βœ¨