<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://sigrok.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AtomicFS</id>
	<title>sigrok - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://sigrok.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AtomicFS"/>
	<link rel="alternate" type="text/html" href="https://sigrok.org/wiki/Special:Contributions/AtomicFS"/>
	<updated>2026-04-22T08:08:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Sigrok-cli&amp;diff=16563</id>
		<title>Sigrok-cli</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Sigrok-cli&amp;diff=16563"/>
		<updated>2023-07-07T08:09:31Z</updated>

		<summary type="html">&lt;p&gt;AtomicFS: /* Usage tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:sigrok-cli}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;sigrok-cli&amp;#039;&amp;#039;&amp;#039; (sometimes abbreviated as &amp;quot;cli&amp;quot;) is a command-line frontend for sigrok.&lt;br /&gt;
&lt;br /&gt;
It is licensed under the terms of the &amp;#039;&amp;#039;&amp;#039;GNU GPL, version 3 or later&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
== Getting the code ==&lt;br /&gt;
&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;git clone git://sigrok.org/sigrok-cli&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You can also [http://sigrok.org/gitweb/?p=sigrok-cli.git;a=tree browse the source code] via gitweb.&lt;br /&gt;
&lt;br /&gt;
== Distribution packages ==&lt;br /&gt;
&lt;br /&gt;
See [[Downloads#Binaries_and_distribution_packages|Downloads]].&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
See [[Building]].&lt;br /&gt;
&lt;br /&gt;
== Usage tips ==&lt;br /&gt;
&lt;br /&gt;
It is recommended to capture the data first and process them later. sigrok-cli is single-threaded application and too much load will overwhelm it resulting in early termination. For capturing, use binary output format (especially for high sample-rates). This is because other formats pose too big overhead.&lt;br /&gt;
&lt;br /&gt;
 $ sigrok-cli --driver saleae-logic-pro --channels 0=Vcc,1=CS,2=MISO,3=MOSI,4=CLK --output-file &amp;lt;file&amp;gt;.bin --output-format binary --config samplerate=50m --continuous&lt;br /&gt;
&lt;br /&gt;
Even better, consider to use a buffer instead of direct write (even on SSD) and also compression.&lt;br /&gt;
&lt;br /&gt;
 $ sigrok-cli --driver saleae-logic-pro --channels 0=Vcc,1=CS,2=MISO,3=MOSI,4=CLK --output-format binary --config samplerate=50m --continuous | mbuffer | lz4 | pv &amp;gt; data.lz4q&lt;br /&gt;
&lt;br /&gt;
== Manpage ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- Generated by: &amp;quot;LC_ALL=C nroff -man doc/sigrok-cli.1 | col -b&amp;quot;. --&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SIGROK-CLI(1)		    General Commands Manual		 SIGROK-CLI(1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAME&lt;br /&gt;
       sigrok-cli - Command-line client for the sigrok software&lt;br /&gt;
&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
       sigrok-cli [OPTIONS] [COMMAND]&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
       sigrok-cli  is  a  cross-platform  command  line utility for the sigrok&lt;br /&gt;
       software.&lt;br /&gt;
&lt;br /&gt;
       It cannot display graphical output, but	is  still  sufficient  to  run&lt;br /&gt;
       through the whole process of hardware initialization, acquisition, pro-&lt;br /&gt;
       tocol decoding and saving the session.&lt;br /&gt;
&lt;br /&gt;
       It is useful for running on remote or embedded systems, netbooks, PDAs,&lt;br /&gt;
       and  for  various  other  use-cases. It can display samples on standard&lt;br /&gt;
       output or save them in various file formats.&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
       -h, --help&lt;br /&gt;
	      Show a help text and exit.&lt;br /&gt;
&lt;br /&gt;
       -V, --version&lt;br /&gt;
	      Show sigrok-cli version and the versions of libraries used.&lt;br /&gt;
&lt;br /&gt;
       -L, --list-supported&lt;br /&gt;
	      Show information about supported hardware  drivers,  input  file&lt;br /&gt;
	      formats, output file formats, and protocol decoders.&lt;br /&gt;
&lt;br /&gt;
       -d, --driver &amp;lt;drivername&amp;gt;&lt;br /&gt;
	      A  driver  must always be selected (unless doing a global scan).&lt;br /&gt;
	      Use the -L (--list-supported) option to get a list of  available&lt;br /&gt;
	      drivers.&lt;br /&gt;
&lt;br /&gt;
	      Drivers  can  take  options,  in the form key=value separated by&lt;br /&gt;
	      colons.&lt;br /&gt;
&lt;br /&gt;
	      Drivers communicating with hardware via  a  serial  port	always&lt;br /&gt;
	      need  the port specified as the conn option. For example, to use&lt;br /&gt;
	      the Openbench Logic Sniffer:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=ols:conn=/dev/ttyACM0 [...]&lt;br /&gt;
&lt;br /&gt;
	      Some USB devices don&amp;#039;t use a unique VendorID/ProductID  combina-&lt;br /&gt;
	      tion,  and  thus need that specified as well. This also uses the&lt;br /&gt;
	      conn option, using either VendorID.ProductID or bus.address:&lt;br /&gt;
&lt;br /&gt;
	      USB VendorID.ProductID example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=uni-t-ut61e:conn=1a86.e008 [...]&lt;br /&gt;
&lt;br /&gt;
	      USB bus.address example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=uni-t-ut61e:conn=4.6 [...]&lt;br /&gt;
&lt;br /&gt;
       -c, --config &amp;lt;deviceoption&amp;gt;&lt;br /&gt;
	      A colon-separated list of  device  options,  where  each	option&lt;br /&gt;
	      takes the form key=value.  For example, to set the samplerate to&lt;br /&gt;
	      1MHz on a device supported by  the  fx2lafw  driver,  you  might&lt;br /&gt;
	      specify&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1m [...]&lt;br /&gt;
&lt;br /&gt;
	      Samplerate  is  an  option  common  to most logic analyzers. The&lt;br /&gt;
	      argument specifies the samplerate in Hz. You  can  also  specify&lt;br /&gt;
	      the samplerate in kHz, MHz or GHz.  The following are all equiv-&lt;br /&gt;
	      alent:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1000000 [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1m [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config &amp;quot;samplerate=1 MHz&amp;quot; [...]&lt;br /&gt;
&lt;br /&gt;
       -i, --input-file &amp;lt;filename&amp;gt;&lt;br /&gt;
	      Load input from a file instead of a  hardware  device.  You  can&lt;br /&gt;
	      specify  &amp;quot;-&amp;quot; to use stdin as input. If the --input-format option&lt;br /&gt;
	      is not supplied, sigrok-cli attempts to autodetect the file for-&lt;br /&gt;
	      mat of the input file.&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a sigrok session file:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.sr [...]&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a WAV file (autodetection of input format):&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.wav [...]&lt;br /&gt;
&lt;br /&gt;
	      Example  for  loading  a	VCD  file from stdin (autodetection of&lt;br /&gt;
	      input format):&lt;br /&gt;
&lt;br /&gt;
		$ cat example.vcd | sigrok-cli -i - [...]&lt;br /&gt;
&lt;br /&gt;
       -I, --input-format &amp;lt;format&amp;gt;&lt;br /&gt;
	      When loading an input file, assume it&amp;#039;s in the specified format.&lt;br /&gt;
	      If  this	option	is not supplied (in addition to --input-file),&lt;br /&gt;
	      sigrok-cli attempts to autodetect the file format of  the  input&lt;br /&gt;
	      file.  Use  the  -L  (--list-supported)  option to see a list of&lt;br /&gt;
	      available input formats.&lt;br /&gt;
&lt;br /&gt;
	      The format name may optionally be followed by a  colon-separated&lt;br /&gt;
	      list of options, where each option takes the form key=value.&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a binary file with options:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.bin&lt;br /&gt;
			     -I binary:numchannels=4:samplerate=1mhz [...]&lt;br /&gt;
&lt;br /&gt;
       -o, --output-file &amp;lt;filename&amp;gt;&lt;br /&gt;
	      Save  output  to	a  file  instead  of writing it to stdout. The&lt;br /&gt;
	      default format used when saving is the sigrok session file  for-&lt;br /&gt;
	      mat. This can be changed with the --output-format option.&lt;br /&gt;
&lt;br /&gt;
	      Example for saving data in the sigrok session format:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli [...] -o example.sr&lt;br /&gt;
&lt;br /&gt;
       -O, --output-format &amp;lt;format&amp;gt;&lt;br /&gt;
	      Set  the	output	format	to  use. Use the -L (--list-supported)&lt;br /&gt;
	      option to see a list of available output formats.&lt;br /&gt;
&lt;br /&gt;
	      The format name may optionally be followed by a  colon-separated&lt;br /&gt;
	      list of options, where each option takes the form key=value.&lt;br /&gt;
&lt;br /&gt;
	      For  example, the bits or hex formats, for an ASCII bit or ASCII&lt;br /&gt;
	      hexadecimal display, can take a &amp;quot;width&amp;quot; option,  specifying  the&lt;br /&gt;
	      number  of  samples  (in	bits)  to  display  per  line. Thus -O&lt;br /&gt;
	      hex:width=128 will display 128 bits per line, in hexadecimal:&lt;br /&gt;
&lt;br /&gt;
	       0:ffff ffff ffff ffff ffff ffff ffff ffff&lt;br /&gt;
	       1:ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00&lt;br /&gt;
&lt;br /&gt;
	      The lines always start with the  channel	number	(or  name,  if&lt;br /&gt;
	      defined),  followed  by  a  colon. If no format is specified, it&lt;br /&gt;
	      defaults to bits:width=64, like this:&lt;br /&gt;
&lt;br /&gt;
	       0:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
	       1:11111111 00000000 11111111 00000000 [...]&lt;br /&gt;
&lt;br /&gt;
	      Example for saving data in the CSV format with options:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli [...] -o example.csv -O csv:dedup:header=false&lt;br /&gt;
&lt;br /&gt;
	      Notice that boolean options are true when no value  gets	speci-&lt;br /&gt;
	      fied.&lt;br /&gt;
&lt;br /&gt;
       -C, --channels &amp;lt;channellist&amp;gt;&lt;br /&gt;
	      A comma-separated list of channels to be used in the session.&lt;br /&gt;
&lt;br /&gt;
	      Note  that  sigrok  always  names  the channels according to how&lt;br /&gt;
	      they&amp;#039;re shown on the enclosure of the hardware.  If  your  logic&lt;br /&gt;
	      analyzer	numbers the channels 0-15, that&amp;#039;s how you must specify&lt;br /&gt;
	      them with this option. An oscilloscope&amp;#039;s channels  would	gener-&lt;br /&gt;
	      ally  be referred to as &amp;quot;CH1&amp;quot;, &amp;quot;CH2&amp;quot;, and so on.	Use the --show&lt;br /&gt;
	      option to see a list of channel names for your device.&lt;br /&gt;
&lt;br /&gt;
	      The default is to use all the channels available	on  a  device.&lt;br /&gt;
	      You  can	name  a channel like this: 1=CLK.  A range of channels&lt;br /&gt;
	      can also be given, in the form 1-5.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver fx2lafw --samples 100&lt;br /&gt;
			     --channels 1=CLK,2-4,7&lt;br /&gt;
	       CLK:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 2:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 3:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 4:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 7:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
&lt;br /&gt;
	      The comma-separated list is processed from left to  right,  i.e.&lt;br /&gt;
	      items  farther to the right override previous items. For example&lt;br /&gt;
	      1=CS,CS=MISO will set the name of channel 1 to MISO.&lt;br /&gt;
&lt;br /&gt;
       -g, --channel-group &amp;lt;channel group&amp;gt;&lt;br /&gt;
	      Specify the channel group to operate on. Some  devices  organize&lt;br /&gt;
	      channels	into groups, the settings of which can only be changed&lt;br /&gt;
	      as a group. The list of channel groups,  if  any,  is  displayed&lt;br /&gt;
	      with the --show command.&lt;br /&gt;
&lt;br /&gt;
	      Examples:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -g CH1 [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d demo -g Logic -c pattern=graycode [...]&lt;br /&gt;
&lt;br /&gt;
       -t, --triggers &amp;lt;triggerlist&amp;gt;&lt;br /&gt;
	      A  comma-separated  list	of triggers to use, of the form &amp;lt;chan-&lt;br /&gt;
	      nel&amp;gt;=&amp;lt;trigger&amp;gt;.  You can use the name or number of the  channel,&lt;br /&gt;
	      and the trigger itself is a series of characters:&lt;br /&gt;
&lt;br /&gt;
	      0 or 1: A low or high value on the pin.&lt;br /&gt;
	      r  or  f: A rising or falling value on the pin. An r effectively&lt;br /&gt;
	      corresponds to 01.&lt;br /&gt;
	      e: Any kind of change on a pin (either a	rising	or  a  falling&lt;br /&gt;
	      edge).&lt;br /&gt;
&lt;br /&gt;
	      Not  every  device  supports all of these trigger types. Use the&lt;br /&gt;
	      --show command to see which triggers your device supports.&lt;br /&gt;
&lt;br /&gt;
       -w, --wait-trigger&lt;br /&gt;
	      Don&amp;#039;t output any sample data (even  if  it&amp;#039;s  actually  received&lt;br /&gt;
	      from the hardware) before the trigger condition is met. In other&lt;br /&gt;
	      words, do not output any pre-trigger data. This option is useful&lt;br /&gt;
	      if  you  don&amp;#039;t  care about the data that came before the trigger&lt;br /&gt;
	      (but the hardware delivers this data to sigrok nonetheless).&lt;br /&gt;
&lt;br /&gt;
       -P, --protocol-decoders &amp;lt;list&amp;gt;&lt;br /&gt;
	      This option allows the user to specify a comma-separated list of&lt;br /&gt;
	      protocol	decoders  to be used in this session. The decoders are&lt;br /&gt;
	      specified by their ID, as shown  in  the	-L  (--list-supported)&lt;br /&gt;
	      output.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c&lt;br /&gt;
&lt;br /&gt;
	      Each protocol decoder can optionally be followed by a colon-sep-&lt;br /&gt;
	      arated list  of  options,  where	each  option  takes  the  form&lt;br /&gt;
	      key=value.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt;&lt;br /&gt;
			    -P uart:baudrate=115200:parity_type=odd&lt;br /&gt;
&lt;br /&gt;
	      The  list  of supported options depends entirely on the protocol&lt;br /&gt;
	      decoder. Every protocol decoder has different  options  it  sup-&lt;br /&gt;
	      ports.&lt;br /&gt;
&lt;br /&gt;
	      Any  &amp;quot;options&amp;quot;  specified  for  a protocol decoder which are not&lt;br /&gt;
	      actually supported options, will be interpreted as being channel&lt;br /&gt;
	      name/number assignments.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt;&lt;br /&gt;
			    -P spi:wordsize=9:miso=1:mosi=5:clk=3:cs=0&lt;br /&gt;
&lt;br /&gt;
	      In this example, wordsize is an option supported by the spi pro-&lt;br /&gt;
	      tocol decoder. Additionally, the user tells sigrok to decode the&lt;br /&gt;
	      SPI  protocol  using channel 1 as MISO signal for SPI, channel 5&lt;br /&gt;
	      as MOSI, channel 3 as CLK, and channel 0 as CS# signal.&lt;br /&gt;
&lt;br /&gt;
	      Notice that the sigrok-cli application does  not	support  &amp;quot;name&lt;br /&gt;
	      matching&amp;quot;.  Instead  it&amp;#039;s  assumed  that the traces in the input&lt;br /&gt;
	      stream match the order of the decoder&amp;#039;s input signals,  or  that&lt;br /&gt;
	      users  explicitly  specify  the  input channel to decoder signal&lt;br /&gt;
	      mapping.&lt;br /&gt;
&lt;br /&gt;
	      When multiple decoders are specified in the same -P option, they&lt;br /&gt;
	      will be stacked on top of each other in the specified order.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,eeprom24xx&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P uart:baudrate=31250,midi&lt;br /&gt;
&lt;br /&gt;
	      When multiple -P options are specified, each of them creates one&lt;br /&gt;
	      decoder stack, which  executes  in  parallel  to	other  decoder&lt;br /&gt;
	      stacks.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P uart:tx=D0:rx=D1 -P timing:data=D2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       -A, --protocol-decoder-annotations &amp;lt;annotations&amp;gt;&lt;br /&gt;
	      By  default,  all  annotation output of all protocol decoders is&lt;br /&gt;
	      shown. With this option a specific decoder&amp;#039;s annotations can  be&lt;br /&gt;
	      selected for display, by specifying the decoder ID:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid -A i2c&lt;br /&gt;
&lt;br /&gt;
	      If  a  protocol decoder has multiple annotation classes, you can&lt;br /&gt;
	      also specify which one of them to show by specifying  its  short&lt;br /&gt;
	      description like this:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read&lt;br /&gt;
&lt;br /&gt;
	      Select  multiple	annotation  classes  by separating them with a&lt;br /&gt;
	      colon:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read:data-write&lt;br /&gt;
&lt;br /&gt;
	      You can also select multiple protocol decoders, with an optional&lt;br /&gt;
	      selected annotation class each, by separating them with commas:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read:data-write,edid&lt;br /&gt;
&lt;br /&gt;
       -M, --protocol-decoder-meta &amp;lt;pdname&amp;gt;&lt;br /&gt;
	      When given, show protocol decoder meta output instead of annota-&lt;br /&gt;
	      tions.  The argument is the name of the decoder whose meta  out-&lt;br /&gt;
	      put to show.&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -M i2c&lt;br /&gt;
&lt;br /&gt;
	      Not every decoder generates meta output.&lt;br /&gt;
&lt;br /&gt;
       -B, --protocol-decoder-binary &amp;lt;binaryspec&amp;gt;&lt;br /&gt;
	      When  given,  decoder  &amp;quot;raw&amp;quot; data of various kinds is written to&lt;br /&gt;
	      stdout instead of annotations (this could be raw binary UART/SPI&lt;br /&gt;
	      bytes,  or  WAV  files, PCAP files, PNG files, or anything else;&lt;br /&gt;
	      this is entirely dependent on the  decoder  and  what  kinds  of&lt;br /&gt;
	      binary output make sense for that decoder).&lt;br /&gt;
&lt;br /&gt;
	      No  other  information is printed to stdout, so this is suitable&lt;br /&gt;
	      for piping into other programs or saving to a file.&lt;br /&gt;
&lt;br /&gt;
	      Protocol decoders that support binary output publish a  list  of&lt;br /&gt;
	      binary classes, for example the UART decoder might have &amp;quot;TX&amp;quot; and&lt;br /&gt;
	      &amp;quot;RX&amp;quot;. To select TX for output, the argument to this option would&lt;br /&gt;
	      be:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -B uart=tx&lt;br /&gt;
&lt;br /&gt;
	      If only the protocol decoder is specified, without binary class,&lt;br /&gt;
	      all classes are written to stdout:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -B uart&lt;br /&gt;
&lt;br /&gt;
	      (this is only useful in rare cases, generally you would  specify&lt;br /&gt;
	      a certain binary class you&amp;#039;re interested in)&lt;br /&gt;
&lt;br /&gt;
	      Not every decoder generates binary output.&lt;br /&gt;
&lt;br /&gt;
       --protocol-decoder-samplenum&lt;br /&gt;
	      When  given,  decoder  annotations  will include sample numbers,&lt;br /&gt;
	      too.  This allows consumers to receive machine  readable	timing&lt;br /&gt;
	      information.&lt;br /&gt;
&lt;br /&gt;
       -l, --loglevel &amp;lt;level&amp;gt;&lt;br /&gt;
	      Set  the	libsigrok  and libsigrokdecode loglevel. At the moment&lt;br /&gt;
	      sigrok-cli doesn&amp;#039;t support setting the  two  loglevels  indepen-&lt;br /&gt;
	      dently.  The  higher  the  number, the more debug output will be&lt;br /&gt;
	      printed. Valid loglevels are:&lt;br /&gt;
&lt;br /&gt;
	      0   None&lt;br /&gt;
	      1   Error&lt;br /&gt;
	      2   Warnings&lt;br /&gt;
	      3   Informational&lt;br /&gt;
	      4   Debug&lt;br /&gt;
	      5   Spew&lt;br /&gt;
&lt;br /&gt;
       --show&lt;br /&gt;
	      Show information about the selected option. For example, to  see&lt;br /&gt;
	      options for a connected fx2lafw device:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver fx2lafw --show&lt;br /&gt;
&lt;br /&gt;
	      In  order to properly get device options for your hardware, some&lt;br /&gt;
	      drivers might need a serial port specified:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver ols:conn=/dev/ttyACM0 --show&lt;br /&gt;
&lt;br /&gt;
	      This also works for protocol decoders, input modules and	output&lt;br /&gt;
	      modules:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --protocol-decoders i2c --show&lt;br /&gt;
	       $ sigrok-cli --input-format csv --show&lt;br /&gt;
	       $ sigrok-cli --output-format bits --show&lt;br /&gt;
&lt;br /&gt;
       --scan Scan for devices that can be detected automatically.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --scan&lt;br /&gt;
	       The following devices were found:&lt;br /&gt;
	       demo - Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0&lt;br /&gt;
	      A1 A2 A3&lt;br /&gt;
	       fx2lafw:conn=3.26 - CWAV USBee SX with 8 channels: 0 1 2 3 4  5&lt;br /&gt;
	      6 7&lt;br /&gt;
&lt;br /&gt;
	      However,	not  all devices are auto-detectable (e.g. serial port&lt;br /&gt;
	      based ones).  For those you&amp;#039;ll have to provide  a  conn  option,&lt;br /&gt;
	      see above.&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver digitek-dt4000zc:conn=/dev/ttyUSB0 --scan&lt;br /&gt;
	       The following devices were found:&lt;br /&gt;
	       Digitek DT4000ZC with 1 channel: P1&lt;br /&gt;
&lt;br /&gt;
       --time &amp;lt;ms&amp;gt;&lt;br /&gt;
	      Sample for &amp;lt;ms&amp;gt; milliseconds, then quit.&lt;br /&gt;
&lt;br /&gt;
	      You can optionally follow the number by s to specify the time to&lt;br /&gt;
	      sample in seconds.&lt;br /&gt;
&lt;br /&gt;
	      For example, --time 2s will sample for two seconds.&lt;br /&gt;
&lt;br /&gt;
       --samples &amp;lt;numsamples&amp;gt;&lt;br /&gt;
	      Acquire &amp;lt;numsamples&amp;gt; samples, then quit.&lt;br /&gt;
&lt;br /&gt;
	      You can optionally follow the number by k, m, or	g  to  specify&lt;br /&gt;
	      the  number  of samples in kilosamples, megasamples, or gigasam-&lt;br /&gt;
	      ples, respectively.&lt;br /&gt;
&lt;br /&gt;
	      For example, --samples 3m will acquire 3000000 samples.&lt;br /&gt;
&lt;br /&gt;
       --frames &amp;lt;numframes&amp;gt;&lt;br /&gt;
	      Acquire &amp;lt;numframes&amp;gt; frames, then quit.&lt;br /&gt;
&lt;br /&gt;
       --continuous&lt;br /&gt;
	      Sample continuously until stopped. Not all devices support this.&lt;br /&gt;
&lt;br /&gt;
       --get &amp;lt;variable&amp;gt;&lt;br /&gt;
	      Get the value of &amp;lt;variable&amp;gt; from the specified device and  print&lt;br /&gt;
	      it.&lt;br /&gt;
&lt;br /&gt;
       --set  Set  one	or  more variables specified with the --config option,&lt;br /&gt;
	      without doing any acquisition.&lt;br /&gt;
&lt;br /&gt;
EXAMPLES&lt;br /&gt;
       In order to get exactly 100 samples  from  the  connected  fx2lafw-sup-&lt;br /&gt;
       ported logic analyzer hardware, run the following command:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --samples 100&lt;br /&gt;
&lt;br /&gt;
       If you want to sample data for 3 seconds (3000 ms), use:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --time 3000&lt;br /&gt;
&lt;br /&gt;
       Alternatively, you can also use:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --time 3s&lt;br /&gt;
&lt;br /&gt;
       To  capture  data  from	the first 4 channels using the Openbench Logic&lt;br /&gt;
       Sniffer lasting 100ms at 10 MHz starting at the trigger condition&lt;br /&gt;
	      0:high, 1:rising, 2:low, 3:high, use:&lt;br /&gt;
&lt;br /&gt;
       sigrok-cli --driver ols:conn=/dev/ttyACM0 --config samplerate=10m \&lt;br /&gt;
	      --output-format bits --channels 0-3 --wait-trigger \&lt;br /&gt;
	      --triggers 0=1,1=r,2=0,3=1 --time 100&lt;br /&gt;
&lt;br /&gt;
       To turn on internal logging on a Lascar EL-USB series device:&lt;br /&gt;
&lt;br /&gt;
       sigrok-cli --driver lascar-el-usb:conn=10c4.0002 \&lt;br /&gt;
	      --config datalog=on --set&lt;br /&gt;
&lt;br /&gt;
EXIT STATUS&lt;br /&gt;
       sigrok-cli exits with 0 on success, 1 on most failures.&lt;br /&gt;
&lt;br /&gt;
SEE ALSO&lt;br /&gt;
       pulseview(1)&lt;br /&gt;
&lt;br /&gt;
BUGS&lt;br /&gt;
       Please report any bugs via Bugzilla (http://sigrok.org/bugzilla) or  on&lt;br /&gt;
       the sigrok-devel mailing list (sigrok-devel@lists.souceforge.net).&lt;br /&gt;
&lt;br /&gt;
LICENSE&lt;br /&gt;
       sigrok-cli  is  covered	by  the GNU General Public License (GPL). Some&lt;br /&gt;
       portions are licensed under the &amp;quot;GPL v2 or later&amp;quot;, some under  &amp;quot;GPL  v3&lt;br /&gt;
       or later&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
AUTHORS&lt;br /&gt;
       Please see the individual source code files.&lt;br /&gt;
&lt;br /&gt;
       This  manual  page was written by Uwe Hermann &amp;lt;uwe@hermann-uwe.de&amp;gt;.  It&lt;br /&gt;
       is licensed under the terms of the GNU GPL (version 2 or later).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
			       October 22, 2018 		 SIGROK-CLI(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Screenshots ==&lt;br /&gt;
&lt;br /&gt;
=== sigrok-cli in action: logic data, decoder output, analog data ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sigrok-cli-screenshot-1.png]]&lt;/div&gt;</summary>
		<author><name>AtomicFS</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Sigrok-cli&amp;diff=16562</id>
		<title>Sigrok-cli</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Sigrok-cli&amp;diff=16562"/>
		<updated>2023-07-07T08:06:33Z</updated>

		<summary type="html">&lt;p&gt;AtomicFS: /* Usage tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:sigrok-cli}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;sigrok-cli&amp;#039;&amp;#039;&amp;#039; (sometimes abbreviated as &amp;quot;cli&amp;quot;) is a command-line frontend for sigrok.&lt;br /&gt;
&lt;br /&gt;
It is licensed under the terms of the &amp;#039;&amp;#039;&amp;#039;GNU GPL, version 3 or later&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
== Getting the code ==&lt;br /&gt;
&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;git clone git://sigrok.org/sigrok-cli&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You can also [http://sigrok.org/gitweb/?p=sigrok-cli.git;a=tree browse the source code] via gitweb.&lt;br /&gt;
&lt;br /&gt;
== Distribution packages ==&lt;br /&gt;
&lt;br /&gt;
See [[Downloads#Binaries_and_distribution_packages|Downloads]].&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
See [[Building]].&lt;br /&gt;
&lt;br /&gt;
== Usage tips ==&lt;br /&gt;
&lt;br /&gt;
It is recommended to capture the data first and process them later. sigrok-cli is single-threaded application and too much load will overwhelm it. For capturing, use binary output format (especially for high sample-rates). This is because other formats pose too big overhead.&lt;br /&gt;
&lt;br /&gt;
 $ sigrok-cli --driver saleae-logic-pro --channels 0=Vcc,1=CS,2=MISO,3=MOSI,4=CLK --output-file &amp;lt;file&amp;gt;.bin --output-format binary --config samplerate=50m --continuous&lt;br /&gt;
&lt;br /&gt;
Even better, consider to use a buffer instead of direct write (even on SSD) and also compression.&lt;br /&gt;
&lt;br /&gt;
 $ sigrok-cli --driver saleae-logic-pro --channels 0=Vcc,1=CS,2=MISO,3=MOSI,4=CLK --output-format binary --config samplerate=50m --continuous | mbuffer | lz4 | pv &amp;gt; data.lz4q&lt;br /&gt;
&lt;br /&gt;
== Manpage ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- Generated by: &amp;quot;LC_ALL=C nroff -man doc/sigrok-cli.1 | col -b&amp;quot;. --&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SIGROK-CLI(1)		    General Commands Manual		 SIGROK-CLI(1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAME&lt;br /&gt;
       sigrok-cli - Command-line client for the sigrok software&lt;br /&gt;
&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
       sigrok-cli [OPTIONS] [COMMAND]&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
       sigrok-cli  is  a  cross-platform  command  line utility for the sigrok&lt;br /&gt;
       software.&lt;br /&gt;
&lt;br /&gt;
       It cannot display graphical output, but	is  still  sufficient  to  run&lt;br /&gt;
       through the whole process of hardware initialization, acquisition, pro-&lt;br /&gt;
       tocol decoding and saving the session.&lt;br /&gt;
&lt;br /&gt;
       It is useful for running on remote or embedded systems, netbooks, PDAs,&lt;br /&gt;
       and  for  various  other  use-cases. It can display samples on standard&lt;br /&gt;
       output or save them in various file formats.&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
       -h, --help&lt;br /&gt;
	      Show a help text and exit.&lt;br /&gt;
&lt;br /&gt;
       -V, --version&lt;br /&gt;
	      Show sigrok-cli version and the versions of libraries used.&lt;br /&gt;
&lt;br /&gt;
       -L, --list-supported&lt;br /&gt;
	      Show information about supported hardware  drivers,  input  file&lt;br /&gt;
	      formats, output file formats, and protocol decoders.&lt;br /&gt;
&lt;br /&gt;
       -d, --driver &amp;lt;drivername&amp;gt;&lt;br /&gt;
	      A  driver  must always be selected (unless doing a global scan).&lt;br /&gt;
	      Use the -L (--list-supported) option to get a list of  available&lt;br /&gt;
	      drivers.&lt;br /&gt;
&lt;br /&gt;
	      Drivers  can  take  options,  in the form key=value separated by&lt;br /&gt;
	      colons.&lt;br /&gt;
&lt;br /&gt;
	      Drivers communicating with hardware via  a  serial  port	always&lt;br /&gt;
	      need  the port specified as the conn option. For example, to use&lt;br /&gt;
	      the Openbench Logic Sniffer:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=ols:conn=/dev/ttyACM0 [...]&lt;br /&gt;
&lt;br /&gt;
	      Some USB devices don&amp;#039;t use a unique VendorID/ProductID  combina-&lt;br /&gt;
	      tion,  and  thus need that specified as well. This also uses the&lt;br /&gt;
	      conn option, using either VendorID.ProductID or bus.address:&lt;br /&gt;
&lt;br /&gt;
	      USB VendorID.ProductID example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=uni-t-ut61e:conn=1a86.e008 [...]&lt;br /&gt;
&lt;br /&gt;
	      USB bus.address example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=uni-t-ut61e:conn=4.6 [...]&lt;br /&gt;
&lt;br /&gt;
       -c, --config &amp;lt;deviceoption&amp;gt;&lt;br /&gt;
	      A colon-separated list of  device  options,  where  each	option&lt;br /&gt;
	      takes the form key=value.  For example, to set the samplerate to&lt;br /&gt;
	      1MHz on a device supported by  the  fx2lafw  driver,  you  might&lt;br /&gt;
	      specify&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1m [...]&lt;br /&gt;
&lt;br /&gt;
	      Samplerate  is  an  option  common  to most logic analyzers. The&lt;br /&gt;
	      argument specifies the samplerate in Hz. You  can  also  specify&lt;br /&gt;
	      the samplerate in kHz, MHz or GHz.  The following are all equiv-&lt;br /&gt;
	      alent:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1000000 [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1m [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config &amp;quot;samplerate=1 MHz&amp;quot; [...]&lt;br /&gt;
&lt;br /&gt;
       -i, --input-file &amp;lt;filename&amp;gt;&lt;br /&gt;
	      Load input from a file instead of a  hardware  device.  You  can&lt;br /&gt;
	      specify  &amp;quot;-&amp;quot; to use stdin as input. If the --input-format option&lt;br /&gt;
	      is not supplied, sigrok-cli attempts to autodetect the file for-&lt;br /&gt;
	      mat of the input file.&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a sigrok session file:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.sr [...]&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a WAV file (autodetection of input format):&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.wav [...]&lt;br /&gt;
&lt;br /&gt;
	      Example  for  loading  a	VCD  file from stdin (autodetection of&lt;br /&gt;
	      input format):&lt;br /&gt;
&lt;br /&gt;
		$ cat example.vcd | sigrok-cli -i - [...]&lt;br /&gt;
&lt;br /&gt;
       -I, --input-format &amp;lt;format&amp;gt;&lt;br /&gt;
	      When loading an input file, assume it&amp;#039;s in the specified format.&lt;br /&gt;
	      If  this	option	is not supplied (in addition to --input-file),&lt;br /&gt;
	      sigrok-cli attempts to autodetect the file format of  the  input&lt;br /&gt;
	      file.  Use  the  -L  (--list-supported)  option to see a list of&lt;br /&gt;
	      available input formats.&lt;br /&gt;
&lt;br /&gt;
	      The format name may optionally be followed by a  colon-separated&lt;br /&gt;
	      list of options, where each option takes the form key=value.&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a binary file with options:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.bin&lt;br /&gt;
			     -I binary:numchannels=4:samplerate=1mhz [...]&lt;br /&gt;
&lt;br /&gt;
       -o, --output-file &amp;lt;filename&amp;gt;&lt;br /&gt;
	      Save  output  to	a  file  instead  of writing it to stdout. The&lt;br /&gt;
	      default format used when saving is the sigrok session file  for-&lt;br /&gt;
	      mat. This can be changed with the --output-format option.&lt;br /&gt;
&lt;br /&gt;
	      Example for saving data in the sigrok session format:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli [...] -o example.sr&lt;br /&gt;
&lt;br /&gt;
       -O, --output-format &amp;lt;format&amp;gt;&lt;br /&gt;
	      Set  the	output	format	to  use. Use the -L (--list-supported)&lt;br /&gt;
	      option to see a list of available output formats.&lt;br /&gt;
&lt;br /&gt;
	      The format name may optionally be followed by a  colon-separated&lt;br /&gt;
	      list of options, where each option takes the form key=value.&lt;br /&gt;
&lt;br /&gt;
	      For  example, the bits or hex formats, for an ASCII bit or ASCII&lt;br /&gt;
	      hexadecimal display, can take a &amp;quot;width&amp;quot; option,  specifying  the&lt;br /&gt;
	      number  of  samples  (in	bits)  to  display  per  line. Thus -O&lt;br /&gt;
	      hex:width=128 will display 128 bits per line, in hexadecimal:&lt;br /&gt;
&lt;br /&gt;
	       0:ffff ffff ffff ffff ffff ffff ffff ffff&lt;br /&gt;
	       1:ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00&lt;br /&gt;
&lt;br /&gt;
	      The lines always start with the  channel	number	(or  name,  if&lt;br /&gt;
	      defined),  followed  by  a  colon. If no format is specified, it&lt;br /&gt;
	      defaults to bits:width=64, like this:&lt;br /&gt;
&lt;br /&gt;
	       0:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
	       1:11111111 00000000 11111111 00000000 [...]&lt;br /&gt;
&lt;br /&gt;
	      Example for saving data in the CSV format with options:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli [...] -o example.csv -O csv:dedup:header=false&lt;br /&gt;
&lt;br /&gt;
	      Notice that boolean options are true when no value  gets	speci-&lt;br /&gt;
	      fied.&lt;br /&gt;
&lt;br /&gt;
       -C, --channels &amp;lt;channellist&amp;gt;&lt;br /&gt;
	      A comma-separated list of channels to be used in the session.&lt;br /&gt;
&lt;br /&gt;
	      Note  that  sigrok  always  names  the channels according to how&lt;br /&gt;
	      they&amp;#039;re shown on the enclosure of the hardware.  If  your  logic&lt;br /&gt;
	      analyzer	numbers the channels 0-15, that&amp;#039;s how you must specify&lt;br /&gt;
	      them with this option. An oscilloscope&amp;#039;s channels  would	gener-&lt;br /&gt;
	      ally  be referred to as &amp;quot;CH1&amp;quot;, &amp;quot;CH2&amp;quot;, and so on.	Use the --show&lt;br /&gt;
	      option to see a list of channel names for your device.&lt;br /&gt;
&lt;br /&gt;
	      The default is to use all the channels available	on  a  device.&lt;br /&gt;
	      You  can	name  a channel like this: 1=CLK.  A range of channels&lt;br /&gt;
	      can also be given, in the form 1-5.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver fx2lafw --samples 100&lt;br /&gt;
			     --channels 1=CLK,2-4,7&lt;br /&gt;
	       CLK:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 2:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 3:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 4:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 7:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
&lt;br /&gt;
	      The comma-separated list is processed from left to  right,  i.e.&lt;br /&gt;
	      items  farther to the right override previous items. For example&lt;br /&gt;
	      1=CS,CS=MISO will set the name of channel 1 to MISO.&lt;br /&gt;
&lt;br /&gt;
       -g, --channel-group &amp;lt;channel group&amp;gt;&lt;br /&gt;
	      Specify the channel group to operate on. Some  devices  organize&lt;br /&gt;
	      channels	into groups, the settings of which can only be changed&lt;br /&gt;
	      as a group. The list of channel groups,  if  any,  is  displayed&lt;br /&gt;
	      with the --show command.&lt;br /&gt;
&lt;br /&gt;
	      Examples:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -g CH1 [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d demo -g Logic -c pattern=graycode [...]&lt;br /&gt;
&lt;br /&gt;
       -t, --triggers &amp;lt;triggerlist&amp;gt;&lt;br /&gt;
	      A  comma-separated  list	of triggers to use, of the form &amp;lt;chan-&lt;br /&gt;
	      nel&amp;gt;=&amp;lt;trigger&amp;gt;.  You can use the name or number of the  channel,&lt;br /&gt;
	      and the trigger itself is a series of characters:&lt;br /&gt;
&lt;br /&gt;
	      0 or 1: A low or high value on the pin.&lt;br /&gt;
	      r  or  f: A rising or falling value on the pin. An r effectively&lt;br /&gt;
	      corresponds to 01.&lt;br /&gt;
	      e: Any kind of change on a pin (either a	rising	or  a  falling&lt;br /&gt;
	      edge).&lt;br /&gt;
&lt;br /&gt;
	      Not  every  device  supports all of these trigger types. Use the&lt;br /&gt;
	      --show command to see which triggers your device supports.&lt;br /&gt;
&lt;br /&gt;
       -w, --wait-trigger&lt;br /&gt;
	      Don&amp;#039;t output any sample data (even  if  it&amp;#039;s  actually  received&lt;br /&gt;
	      from the hardware) before the trigger condition is met. In other&lt;br /&gt;
	      words, do not output any pre-trigger data. This option is useful&lt;br /&gt;
	      if  you  don&amp;#039;t  care about the data that came before the trigger&lt;br /&gt;
	      (but the hardware delivers this data to sigrok nonetheless).&lt;br /&gt;
&lt;br /&gt;
       -P, --protocol-decoders &amp;lt;list&amp;gt;&lt;br /&gt;
	      This option allows the user to specify a comma-separated list of&lt;br /&gt;
	      protocol	decoders  to be used in this session. The decoders are&lt;br /&gt;
	      specified by their ID, as shown  in  the	-L  (--list-supported)&lt;br /&gt;
	      output.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c&lt;br /&gt;
&lt;br /&gt;
	      Each protocol decoder can optionally be followed by a colon-sep-&lt;br /&gt;
	      arated list  of  options,  where	each  option  takes  the  form&lt;br /&gt;
	      key=value.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt;&lt;br /&gt;
			    -P uart:baudrate=115200:parity_type=odd&lt;br /&gt;
&lt;br /&gt;
	      The  list  of supported options depends entirely on the protocol&lt;br /&gt;
	      decoder. Every protocol decoder has different  options  it  sup-&lt;br /&gt;
	      ports.&lt;br /&gt;
&lt;br /&gt;
	      Any  &amp;quot;options&amp;quot;  specified  for  a protocol decoder which are not&lt;br /&gt;
	      actually supported options, will be interpreted as being channel&lt;br /&gt;
	      name/number assignments.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt;&lt;br /&gt;
			    -P spi:wordsize=9:miso=1:mosi=5:clk=3:cs=0&lt;br /&gt;
&lt;br /&gt;
	      In this example, wordsize is an option supported by the spi pro-&lt;br /&gt;
	      tocol decoder. Additionally, the user tells sigrok to decode the&lt;br /&gt;
	      SPI  protocol  using channel 1 as MISO signal for SPI, channel 5&lt;br /&gt;
	      as MOSI, channel 3 as CLK, and channel 0 as CS# signal.&lt;br /&gt;
&lt;br /&gt;
	      Notice that the sigrok-cli application does  not	support  &amp;quot;name&lt;br /&gt;
	      matching&amp;quot;.  Instead  it&amp;#039;s  assumed  that the traces in the input&lt;br /&gt;
	      stream match the order of the decoder&amp;#039;s input signals,  or  that&lt;br /&gt;
	      users  explicitly  specify  the  input channel to decoder signal&lt;br /&gt;
	      mapping.&lt;br /&gt;
&lt;br /&gt;
	      When multiple decoders are specified in the same -P option, they&lt;br /&gt;
	      will be stacked on top of each other in the specified order.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,eeprom24xx&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P uart:baudrate=31250,midi&lt;br /&gt;
&lt;br /&gt;
	      When multiple -P options are specified, each of them creates one&lt;br /&gt;
	      decoder stack, which  executes  in  parallel  to	other  decoder&lt;br /&gt;
	      stacks.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P uart:tx=D0:rx=D1 -P timing:data=D2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       -A, --protocol-decoder-annotations &amp;lt;annotations&amp;gt;&lt;br /&gt;
	      By  default,  all  annotation output of all protocol decoders is&lt;br /&gt;
	      shown. With this option a specific decoder&amp;#039;s annotations can  be&lt;br /&gt;
	      selected for display, by specifying the decoder ID:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid -A i2c&lt;br /&gt;
&lt;br /&gt;
	      If  a  protocol decoder has multiple annotation classes, you can&lt;br /&gt;
	      also specify which one of them to show by specifying  its  short&lt;br /&gt;
	      description like this:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read&lt;br /&gt;
&lt;br /&gt;
	      Select  multiple	annotation  classes  by separating them with a&lt;br /&gt;
	      colon:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read:data-write&lt;br /&gt;
&lt;br /&gt;
	      You can also select multiple protocol decoders, with an optional&lt;br /&gt;
	      selected annotation class each, by separating them with commas:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read:data-write,edid&lt;br /&gt;
&lt;br /&gt;
       -M, --protocol-decoder-meta &amp;lt;pdname&amp;gt;&lt;br /&gt;
	      When given, show protocol decoder meta output instead of annota-&lt;br /&gt;
	      tions.  The argument is the name of the decoder whose meta  out-&lt;br /&gt;
	      put to show.&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -M i2c&lt;br /&gt;
&lt;br /&gt;
	      Not every decoder generates meta output.&lt;br /&gt;
&lt;br /&gt;
       -B, --protocol-decoder-binary &amp;lt;binaryspec&amp;gt;&lt;br /&gt;
	      When  given,  decoder  &amp;quot;raw&amp;quot; data of various kinds is written to&lt;br /&gt;
	      stdout instead of annotations (this could be raw binary UART/SPI&lt;br /&gt;
	      bytes,  or  WAV  files, PCAP files, PNG files, or anything else;&lt;br /&gt;
	      this is entirely dependent on the  decoder  and  what  kinds  of&lt;br /&gt;
	      binary output make sense for that decoder).&lt;br /&gt;
&lt;br /&gt;
	      No  other  information is printed to stdout, so this is suitable&lt;br /&gt;
	      for piping into other programs or saving to a file.&lt;br /&gt;
&lt;br /&gt;
	      Protocol decoders that support binary output publish a  list  of&lt;br /&gt;
	      binary classes, for example the UART decoder might have &amp;quot;TX&amp;quot; and&lt;br /&gt;
	      &amp;quot;RX&amp;quot;. To select TX for output, the argument to this option would&lt;br /&gt;
	      be:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -B uart=tx&lt;br /&gt;
&lt;br /&gt;
	      If only the protocol decoder is specified, without binary class,&lt;br /&gt;
	      all classes are written to stdout:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -B uart&lt;br /&gt;
&lt;br /&gt;
	      (this is only useful in rare cases, generally you would  specify&lt;br /&gt;
	      a certain binary class you&amp;#039;re interested in)&lt;br /&gt;
&lt;br /&gt;
	      Not every decoder generates binary output.&lt;br /&gt;
&lt;br /&gt;
       --protocol-decoder-samplenum&lt;br /&gt;
	      When  given,  decoder  annotations  will include sample numbers,&lt;br /&gt;
	      too.  This allows consumers to receive machine  readable	timing&lt;br /&gt;
	      information.&lt;br /&gt;
&lt;br /&gt;
       -l, --loglevel &amp;lt;level&amp;gt;&lt;br /&gt;
	      Set  the	libsigrok  and libsigrokdecode loglevel. At the moment&lt;br /&gt;
	      sigrok-cli doesn&amp;#039;t support setting the  two  loglevels  indepen-&lt;br /&gt;
	      dently.  The  higher  the  number, the more debug output will be&lt;br /&gt;
	      printed. Valid loglevels are:&lt;br /&gt;
&lt;br /&gt;
	      0   None&lt;br /&gt;
	      1   Error&lt;br /&gt;
	      2   Warnings&lt;br /&gt;
	      3   Informational&lt;br /&gt;
	      4   Debug&lt;br /&gt;
	      5   Spew&lt;br /&gt;
&lt;br /&gt;
       --show&lt;br /&gt;
	      Show information about the selected option. For example, to  see&lt;br /&gt;
	      options for a connected fx2lafw device:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver fx2lafw --show&lt;br /&gt;
&lt;br /&gt;
	      In  order to properly get device options for your hardware, some&lt;br /&gt;
	      drivers might need a serial port specified:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver ols:conn=/dev/ttyACM0 --show&lt;br /&gt;
&lt;br /&gt;
	      This also works for protocol decoders, input modules and	output&lt;br /&gt;
	      modules:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --protocol-decoders i2c --show&lt;br /&gt;
	       $ sigrok-cli --input-format csv --show&lt;br /&gt;
	       $ sigrok-cli --output-format bits --show&lt;br /&gt;
&lt;br /&gt;
       --scan Scan for devices that can be detected automatically.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --scan&lt;br /&gt;
	       The following devices were found:&lt;br /&gt;
	       demo - Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0&lt;br /&gt;
	      A1 A2 A3&lt;br /&gt;
	       fx2lafw:conn=3.26 - CWAV USBee SX with 8 channels: 0 1 2 3 4  5&lt;br /&gt;
	      6 7&lt;br /&gt;
&lt;br /&gt;
	      However,	not  all devices are auto-detectable (e.g. serial port&lt;br /&gt;
	      based ones).  For those you&amp;#039;ll have to provide  a  conn  option,&lt;br /&gt;
	      see above.&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver digitek-dt4000zc:conn=/dev/ttyUSB0 --scan&lt;br /&gt;
	       The following devices were found:&lt;br /&gt;
	       Digitek DT4000ZC with 1 channel: P1&lt;br /&gt;
&lt;br /&gt;
       --time &amp;lt;ms&amp;gt;&lt;br /&gt;
	      Sample for &amp;lt;ms&amp;gt; milliseconds, then quit.&lt;br /&gt;
&lt;br /&gt;
	      You can optionally follow the number by s to specify the time to&lt;br /&gt;
	      sample in seconds.&lt;br /&gt;
&lt;br /&gt;
	      For example, --time 2s will sample for two seconds.&lt;br /&gt;
&lt;br /&gt;
       --samples &amp;lt;numsamples&amp;gt;&lt;br /&gt;
	      Acquire &amp;lt;numsamples&amp;gt; samples, then quit.&lt;br /&gt;
&lt;br /&gt;
	      You can optionally follow the number by k, m, or	g  to  specify&lt;br /&gt;
	      the  number  of samples in kilosamples, megasamples, or gigasam-&lt;br /&gt;
	      ples, respectively.&lt;br /&gt;
&lt;br /&gt;
	      For example, --samples 3m will acquire 3000000 samples.&lt;br /&gt;
&lt;br /&gt;
       --frames &amp;lt;numframes&amp;gt;&lt;br /&gt;
	      Acquire &amp;lt;numframes&amp;gt; frames, then quit.&lt;br /&gt;
&lt;br /&gt;
       --continuous&lt;br /&gt;
	      Sample continuously until stopped. Not all devices support this.&lt;br /&gt;
&lt;br /&gt;
       --get &amp;lt;variable&amp;gt;&lt;br /&gt;
	      Get the value of &amp;lt;variable&amp;gt; from the specified device and  print&lt;br /&gt;
	      it.&lt;br /&gt;
&lt;br /&gt;
       --set  Set  one	or  more variables specified with the --config option,&lt;br /&gt;
	      without doing any acquisition.&lt;br /&gt;
&lt;br /&gt;
EXAMPLES&lt;br /&gt;
       In order to get exactly 100 samples  from  the  connected  fx2lafw-sup-&lt;br /&gt;
       ported logic analyzer hardware, run the following command:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --samples 100&lt;br /&gt;
&lt;br /&gt;
       If you want to sample data for 3 seconds (3000 ms), use:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --time 3000&lt;br /&gt;
&lt;br /&gt;
       Alternatively, you can also use:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --time 3s&lt;br /&gt;
&lt;br /&gt;
       To  capture  data  from	the first 4 channels using the Openbench Logic&lt;br /&gt;
       Sniffer lasting 100ms at 10 MHz starting at the trigger condition&lt;br /&gt;
	      0:high, 1:rising, 2:low, 3:high, use:&lt;br /&gt;
&lt;br /&gt;
       sigrok-cli --driver ols:conn=/dev/ttyACM0 --config samplerate=10m \&lt;br /&gt;
	      --output-format bits --channels 0-3 --wait-trigger \&lt;br /&gt;
	      --triggers 0=1,1=r,2=0,3=1 --time 100&lt;br /&gt;
&lt;br /&gt;
       To turn on internal logging on a Lascar EL-USB series device:&lt;br /&gt;
&lt;br /&gt;
       sigrok-cli --driver lascar-el-usb:conn=10c4.0002 \&lt;br /&gt;
	      --config datalog=on --set&lt;br /&gt;
&lt;br /&gt;
EXIT STATUS&lt;br /&gt;
       sigrok-cli exits with 0 on success, 1 on most failures.&lt;br /&gt;
&lt;br /&gt;
SEE ALSO&lt;br /&gt;
       pulseview(1)&lt;br /&gt;
&lt;br /&gt;
BUGS&lt;br /&gt;
       Please report any bugs via Bugzilla (http://sigrok.org/bugzilla) or  on&lt;br /&gt;
       the sigrok-devel mailing list (sigrok-devel@lists.souceforge.net).&lt;br /&gt;
&lt;br /&gt;
LICENSE&lt;br /&gt;
       sigrok-cli  is  covered	by  the GNU General Public License (GPL). Some&lt;br /&gt;
       portions are licensed under the &amp;quot;GPL v2 or later&amp;quot;, some under  &amp;quot;GPL  v3&lt;br /&gt;
       or later&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
AUTHORS&lt;br /&gt;
       Please see the individual source code files.&lt;br /&gt;
&lt;br /&gt;
       This  manual  page was written by Uwe Hermann &amp;lt;uwe@hermann-uwe.de&amp;gt;.  It&lt;br /&gt;
       is licensed under the terms of the GNU GPL (version 2 or later).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
			       October 22, 2018 		 SIGROK-CLI(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Screenshots ==&lt;br /&gt;
&lt;br /&gt;
=== sigrok-cli in action: logic data, decoder output, analog data ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sigrok-cli-screenshot-1.png]]&lt;/div&gt;</summary>
		<author><name>AtomicFS</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Input_output_formats&amp;diff=16561</id>
		<title>Input output formats</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Input_output_formats&amp;diff=16561"/>
		<updated>2023-07-07T08:04:29Z</updated>

		<summary type="html">&lt;p&gt;AtomicFS: /* Supported input/output formats */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[libsigrok]] supports a number of different input modules (a.k.a. file formats) and output modules, and has a generic API which allows easily adding more input/output modules.&lt;br /&gt;
&lt;br /&gt;
== Supported input/output formats ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width: 12em;&amp;quot; | Name&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:analog|Analog]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Text output of analog data and types.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:ascii|ASCII]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| ASCII art.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:binary|Binary]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Raw binary data output without any metadata attached.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:bits|Bits]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| 0/1 digits.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space: nowrap;&amp;quot; | [[File format:chronovu_la8|ChronoVu LA8]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| [[ChronoVu LA8]] software file format (usually with .kdt file extension).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:csv|CSV]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Comma-separated values (also usable for generating data and config files for gnuplot).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:hex|hex]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Hexadecimal digits.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:logicport|Intronix Logicport LA1034]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| [[Intronix Logicport LA1034]] *.lpf files.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:ols|ols]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The file format used by the [http://www.lxtreme.nl/ols/ &amp;quot;Alternative&amp;quot; Java client] for the [[Openbench Logic Sniffer]].&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:saleae|saleae]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| Files exported by the Saleae Logic application.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:srzip|srzip]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The current (v2) sigrok session file format (*.sr).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:stf|STF]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| &amp;quot;Sigma Test File&amp;quot;. Native format of the Asix Sigma/Omega vendor software.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:vcd|VCD]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The [http://en.wikipedia.org/wiki/Value_change_dump Value Change Dump] format (can also be visualized in [http://gtkwave.sourceforge.net/ gtkwave], for instance).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:wav|WAV]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The [http://en.wikipedia.org/wiki/WAV waveform audio] (WAV) file format.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:raw_analog|Raw analog]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| Analog signals without header (configurable sample size, format, and endianness).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:trace32_ad|Lauterbach Trace32]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| The Lauterbach Trace32 logic analyzer data file format.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:wavedrom|WaveDrom]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Digital timing diagrams in JSON syntax&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The output formats apply only to unprocessed raw data. Data processed by decoders can&amp;#039;t be saved into output file by argument, only by redirection of &amp;lt;code&amp;gt;STDOUT&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Supported transform modules ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width: 8em;&amp;quot; | Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| nop&lt;br /&gt;
| Do nothing.&lt;br /&gt;
|-&lt;br /&gt;
| scale&lt;br /&gt;
| Scale analog values by a specified factor.&lt;br /&gt;
|-&lt;br /&gt;
| invert&lt;br /&gt;
| Invert values.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Possible candidates for future input/output formats ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Scanalogic&lt;br /&gt;
| Used by the [[IKALOGIC Scanalogic-2]] and [[IKALOGIC ScanaPLUS]] logic analyzers.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_rof|Rigol ROF]]&lt;br /&gt;
| Used by the [[Rigol DP800 series]] power supplies.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_raf|Rigol RAF]]&lt;br /&gt;
| Used by the Rigol DG1000Z, DG4000, and DG5000 series signal generators. See [http://www.batronix.com/pdf/Rigol/UserGuide/DG1000Z_UserGuide_EN.pdf DG1000Z User Guide] page 2-75, also [http://www.eevblog.com/forum/testgear/rigol-dg4000-series-raf-file-format/msg559443/ this post] at eevblog.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_wfm|Rigol WFM]]&lt;br /&gt;
| Used by the Rigol DS series oscilloscopes. See https://github.com/mabl/pyRigolWFM/blob/master/wfm.py&lt;br /&gt;
|-&lt;br /&gt;
| [[File_format:Rigol_WFM4|Rigol WFM4]]&lt;br /&gt;
| Used by the Rigol DS4000 series oscilloscopes.&lt;br /&gt;
|-&lt;br /&gt;
| Vector MDF (v3.3) / ASAM MDF (v4.x)&lt;br /&gt;
| Automotive industry standard format. Docs can be found [http://vector.com/vi_mdf_de.html here] and [http://vector.com/downloads/mdf_specification.pdf here]. Validator is [http://vector.com/downloads/MDFValidator2.1.8.zip here]. Some code is [https://code.google.com/p/mdfreader/ here] and [http://sourceforge.net/p/mdfdatafile/code/HEAD/tree/ here].&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Comtrade COMTRADE]&lt;br /&gt;
| File format used by devices in power engineering (e.g. protective relays, fault recorders). Can contain digital and analog data with constant or variable sample rate.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:pwl|PWL]]&lt;br /&gt;
| Trivial file format that can be used to define the signal of voltage/current sources in a SPICE simulation.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:tektronix_wfm|Tektronix WFM]]&lt;br /&gt;
| Used by the Tektronix TDS series oscilloscopes. A parser for Matlab can be found [http://www.mathworks.com/matlabcentral/fileexchange/5873-tektronix-binary-file-readers/content/wfmread.m here].&lt;br /&gt;
|-&lt;br /&gt;
| EVCD/IDX/FST/GHW&lt;br /&gt;
| File formats generated by hardware simulation tools. See the [http://gtkwave.sourceforge.net/gtkwave.pdf GtkWave manual] for some of them, and conversion utilities.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.ni.com/hu-hu/support/documentation/supplemental/06/the-ni-tdms-file-format.html NI TDMS]&lt;br /&gt;
| File formats used by various National Instruments software like LabVIEW or DAQExpress.&lt;br /&gt;
|-&lt;br /&gt;
| IMC data format&lt;br /&gt;
| File formats used by imc GmbH softwares. File format description can be found in the [https://www.imcdataworks.com/secure-dl/?file=fileadmin/Download-Center/Manuals/imc_FAMOS/imcSharedComponents.pdf imc Software Shared Components documentation]. (Registration required.)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AtomicFS</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Input_output_formats&amp;diff=16560</id>
		<title>Input output formats</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Input_output_formats&amp;diff=16560"/>
		<updated>2023-07-06T16:18:06Z</updated>

		<summary type="html">&lt;p&gt;AtomicFS: /* Supported input/output formats */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[libsigrok]] supports a number of different input modules (a.k.a. file formats) and output modules, and has a generic API which allows easily adding more input/output modules.&lt;br /&gt;
&lt;br /&gt;
== Supported input/output formats ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width: 12em;&amp;quot; | Name&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:analog|Analog]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Text output of analog data and types.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:ascii|ASCII]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| ASCII art.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:binary|Binary]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Raw binary data output without any metadata attached.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:bits|Bits]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| 0/1 digits.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space: nowrap;&amp;quot; | [[File format:chronovu_la8|ChronoVu LA8]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| [[ChronoVu LA8]] software file format (usually with .kdt file extension).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:csv|CSV]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Comma-separated values (also usable for generating data and config files for gnuplot).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:hex|hex]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Hexadecimal digits.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:logicport|Intronix Logicport LA1034]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| [[Intronix Logicport LA1034]] *.lpf files.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:ols|ols]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The file format used by the [http://www.lxtreme.nl/ols/ &amp;quot;Alternative&amp;quot; Java client] for the [[Openbench Logic Sniffer]].&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:saleae|saleae]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| Files exported by the Saleae Logic application.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:srzip|srzip]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The current (v2) sigrok session file format (*.sr).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:stf|STF]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| &amp;quot;Sigma Test File&amp;quot;. Native format of the Asix Sigma/Omega vendor software.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:vcd|VCD]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The [http://en.wikipedia.org/wiki/Value_change_dump Value Change Dump] format (can also be visualized in [http://gtkwave.sourceforge.net/ gtkwave], for instance).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:wav|WAV]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The [http://en.wikipedia.org/wiki/WAV waveform audio] (WAV) file format.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:raw_analog|Raw analog]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| Analog signals without header (configurable sample size, format, and endianness).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:trace32_ad|Lauterbach Trace32]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| The Lauterbach Trace32 logic analyzer data file format.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:wavedrom|WaveDrom]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Digital timing diagrams in JSON syntax&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;WARNING:&amp;lt;/b&amp;gt; The output formats apply only to unprocessed raw data. Data processed by decoders can&amp;#039;t be saved into output file by argument, only by redirection of &amp;lt;code&amp;gt;STDOUT&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Supported transform modules ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width: 8em;&amp;quot; | Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| nop&lt;br /&gt;
| Do nothing.&lt;br /&gt;
|-&lt;br /&gt;
| scale&lt;br /&gt;
| Scale analog values by a specified factor.&lt;br /&gt;
|-&lt;br /&gt;
| invert&lt;br /&gt;
| Invert values.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Possible candidates for future input/output formats ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Scanalogic&lt;br /&gt;
| Used by the [[IKALOGIC Scanalogic-2]] and [[IKALOGIC ScanaPLUS]] logic analyzers.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_rof|Rigol ROF]]&lt;br /&gt;
| Used by the [[Rigol DP800 series]] power supplies.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_raf|Rigol RAF]]&lt;br /&gt;
| Used by the Rigol DG1000Z, DG4000, and DG5000 series signal generators. See [http://www.batronix.com/pdf/Rigol/UserGuide/DG1000Z_UserGuide_EN.pdf DG1000Z User Guide] page 2-75, also [http://www.eevblog.com/forum/testgear/rigol-dg4000-series-raf-file-format/msg559443/ this post] at eevblog.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_wfm|Rigol WFM]]&lt;br /&gt;
| Used by the Rigol DS series oscilloscopes. See https://github.com/mabl/pyRigolWFM/blob/master/wfm.py&lt;br /&gt;
|-&lt;br /&gt;
| [[File_format:Rigol_WFM4|Rigol WFM4]]&lt;br /&gt;
| Used by the Rigol DS4000 series oscilloscopes.&lt;br /&gt;
|-&lt;br /&gt;
| Vector MDF (v3.3) / ASAM MDF (v4.x)&lt;br /&gt;
| Automotive industry standard format. Docs can be found [http://vector.com/vi_mdf_de.html here] and [http://vector.com/downloads/mdf_specification.pdf here]. Validator is [http://vector.com/downloads/MDFValidator2.1.8.zip here]. Some code is [https://code.google.com/p/mdfreader/ here] and [http://sourceforge.net/p/mdfdatafile/code/HEAD/tree/ here].&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Comtrade COMTRADE]&lt;br /&gt;
| File format used by devices in power engineering (e.g. protective relays, fault recorders). Can contain digital and analog data with constant or variable sample rate.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:pwl|PWL]]&lt;br /&gt;
| Trivial file format that can be used to define the signal of voltage/current sources in a SPICE simulation.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:tektronix_wfm|Tektronix WFM]]&lt;br /&gt;
| Used by the Tektronix TDS series oscilloscopes. A parser for Matlab can be found [http://www.mathworks.com/matlabcentral/fileexchange/5873-tektronix-binary-file-readers/content/wfmread.m here].&lt;br /&gt;
|-&lt;br /&gt;
| EVCD/IDX/FST/GHW&lt;br /&gt;
| File formats generated by hardware simulation tools. See the [http://gtkwave.sourceforge.net/gtkwave.pdf GtkWave manual] for some of them, and conversion utilities.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.ni.com/hu-hu/support/documentation/supplemental/06/the-ni-tdms-file-format.html NI TDMS]&lt;br /&gt;
| File formats used by various National Instruments software like LabVIEW or DAQExpress.&lt;br /&gt;
|-&lt;br /&gt;
| IMC data format&lt;br /&gt;
| File formats used by imc GmbH softwares. File format description can be found in the [https://www.imcdataworks.com/secure-dl/?file=fileadmin/Download-Center/Manuals/imc_FAMOS/imcSharedComponents.pdf imc Software Shared Components documentation]. (Registration required.)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AtomicFS</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Sigrok-cli&amp;diff=16559</id>
		<title>Sigrok-cli</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Sigrok-cli&amp;diff=16559"/>
		<updated>2023-07-06T16:16:05Z</updated>

		<summary type="html">&lt;p&gt;AtomicFS: /* Manpage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:sigrok-cli}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;sigrok-cli&amp;#039;&amp;#039;&amp;#039; (sometimes abbreviated as &amp;quot;cli&amp;quot;) is a command-line frontend for sigrok.&lt;br /&gt;
&lt;br /&gt;
It is licensed under the terms of the &amp;#039;&amp;#039;&amp;#039;GNU GPL, version 3 or later&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
== Getting the code ==&lt;br /&gt;
&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;git clone git://sigrok.org/sigrok-cli&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You can also [http://sigrok.org/gitweb/?p=sigrok-cli.git;a=tree browse the source code] via gitweb.&lt;br /&gt;
&lt;br /&gt;
== Distribution packages ==&lt;br /&gt;
&lt;br /&gt;
See [[Downloads#Binaries_and_distribution_packages|Downloads]].&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
See [[Building]].&lt;br /&gt;
&lt;br /&gt;
== Usage tips ==&lt;br /&gt;
&lt;br /&gt;
It is recommended to capture the data first and process them later. sigrok-cli is single-threaded application and too much load will crash it. For capturing, use binary output format (especially for high sample-rates). This is because other formats pose too big overhead.&lt;br /&gt;
&lt;br /&gt;
 $ sigrok-cli --driver saleae-logic-pro --channels 0=Vcc,1=CS,2=MISO,3=MOSI,4=CLK --output-file &amp;lt;file&amp;gt;.bin --output-format binary --config samplerate=50m --continuous&lt;br /&gt;
&lt;br /&gt;
Even better, consider to use a buffer instead of direct write (even on SSD) and also compression.&lt;br /&gt;
&lt;br /&gt;
 $ sigrok-cli --driver saleae-logic-pro --channels 0=Vcc,1=CS,2=MISO,3=MOSI,4=CLK --output-format binary --config samplerate=50m --continuous | mbuffer | lz4 | pv &amp;gt; data.lz4q&lt;br /&gt;
&lt;br /&gt;
== Manpage ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- Generated by: &amp;quot;LC_ALL=C nroff -man doc/sigrok-cli.1 | col -b&amp;quot;. --&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SIGROK-CLI(1)		    General Commands Manual		 SIGROK-CLI(1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAME&lt;br /&gt;
       sigrok-cli - Command-line client for the sigrok software&lt;br /&gt;
&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
       sigrok-cli [OPTIONS] [COMMAND]&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
       sigrok-cli  is  a  cross-platform  command  line utility for the sigrok&lt;br /&gt;
       software.&lt;br /&gt;
&lt;br /&gt;
       It cannot display graphical output, but	is  still  sufficient  to  run&lt;br /&gt;
       through the whole process of hardware initialization, acquisition, pro-&lt;br /&gt;
       tocol decoding and saving the session.&lt;br /&gt;
&lt;br /&gt;
       It is useful for running on remote or embedded systems, netbooks, PDAs,&lt;br /&gt;
       and  for  various  other  use-cases. It can display samples on standard&lt;br /&gt;
       output or save them in various file formats.&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
       -h, --help&lt;br /&gt;
	      Show a help text and exit.&lt;br /&gt;
&lt;br /&gt;
       -V, --version&lt;br /&gt;
	      Show sigrok-cli version and the versions of libraries used.&lt;br /&gt;
&lt;br /&gt;
       -L, --list-supported&lt;br /&gt;
	      Show information about supported hardware  drivers,  input  file&lt;br /&gt;
	      formats, output file formats, and protocol decoders.&lt;br /&gt;
&lt;br /&gt;
       -d, --driver &amp;lt;drivername&amp;gt;&lt;br /&gt;
	      A  driver  must always be selected (unless doing a global scan).&lt;br /&gt;
	      Use the -L (--list-supported) option to get a list of  available&lt;br /&gt;
	      drivers.&lt;br /&gt;
&lt;br /&gt;
	      Drivers  can  take  options,  in the form key=value separated by&lt;br /&gt;
	      colons.&lt;br /&gt;
&lt;br /&gt;
	      Drivers communicating with hardware via  a  serial  port	always&lt;br /&gt;
	      need  the port specified as the conn option. For example, to use&lt;br /&gt;
	      the Openbench Logic Sniffer:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=ols:conn=/dev/ttyACM0 [...]&lt;br /&gt;
&lt;br /&gt;
	      Some USB devices don&amp;#039;t use a unique VendorID/ProductID  combina-&lt;br /&gt;
	      tion,  and  thus need that specified as well. This also uses the&lt;br /&gt;
	      conn option, using either VendorID.ProductID or bus.address:&lt;br /&gt;
&lt;br /&gt;
	      USB VendorID.ProductID example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=uni-t-ut61e:conn=1a86.e008 [...]&lt;br /&gt;
&lt;br /&gt;
	      USB bus.address example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=uni-t-ut61e:conn=4.6 [...]&lt;br /&gt;
&lt;br /&gt;
       -c, --config &amp;lt;deviceoption&amp;gt;&lt;br /&gt;
	      A colon-separated list of  device  options,  where  each	option&lt;br /&gt;
	      takes the form key=value.  For example, to set the samplerate to&lt;br /&gt;
	      1MHz on a device supported by  the  fx2lafw  driver,  you  might&lt;br /&gt;
	      specify&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1m [...]&lt;br /&gt;
&lt;br /&gt;
	      Samplerate  is  an  option  common  to most logic analyzers. The&lt;br /&gt;
	      argument specifies the samplerate in Hz. You  can  also  specify&lt;br /&gt;
	      the samplerate in kHz, MHz or GHz.  The following are all equiv-&lt;br /&gt;
	      alent:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1000000 [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1m [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config &amp;quot;samplerate=1 MHz&amp;quot; [...]&lt;br /&gt;
&lt;br /&gt;
       -i, --input-file &amp;lt;filename&amp;gt;&lt;br /&gt;
	      Load input from a file instead of a  hardware  device.  You  can&lt;br /&gt;
	      specify  &amp;quot;-&amp;quot; to use stdin as input. If the --input-format option&lt;br /&gt;
	      is not supplied, sigrok-cli attempts to autodetect the file for-&lt;br /&gt;
	      mat of the input file.&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a sigrok session file:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.sr [...]&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a WAV file (autodetection of input format):&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.wav [...]&lt;br /&gt;
&lt;br /&gt;
	      Example  for  loading  a	VCD  file from stdin (autodetection of&lt;br /&gt;
	      input format):&lt;br /&gt;
&lt;br /&gt;
		$ cat example.vcd | sigrok-cli -i - [...]&lt;br /&gt;
&lt;br /&gt;
       -I, --input-format &amp;lt;format&amp;gt;&lt;br /&gt;
	      When loading an input file, assume it&amp;#039;s in the specified format.&lt;br /&gt;
	      If  this	option	is not supplied (in addition to --input-file),&lt;br /&gt;
	      sigrok-cli attempts to autodetect the file format of  the  input&lt;br /&gt;
	      file.  Use  the  -L  (--list-supported)  option to see a list of&lt;br /&gt;
	      available input formats.&lt;br /&gt;
&lt;br /&gt;
	      The format name may optionally be followed by a  colon-separated&lt;br /&gt;
	      list of options, where each option takes the form key=value.&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a binary file with options:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.bin&lt;br /&gt;
			     -I binary:numchannels=4:samplerate=1mhz [...]&lt;br /&gt;
&lt;br /&gt;
       -o, --output-file &amp;lt;filename&amp;gt;&lt;br /&gt;
	      Save  output  to	a  file  instead  of writing it to stdout. The&lt;br /&gt;
	      default format used when saving is the sigrok session file  for-&lt;br /&gt;
	      mat. This can be changed with the --output-format option.&lt;br /&gt;
&lt;br /&gt;
	      Example for saving data in the sigrok session format:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli [...] -o example.sr&lt;br /&gt;
&lt;br /&gt;
       -O, --output-format &amp;lt;format&amp;gt;&lt;br /&gt;
	      Set  the	output	format	to  use. Use the -L (--list-supported)&lt;br /&gt;
	      option to see a list of available output formats.&lt;br /&gt;
&lt;br /&gt;
	      The format name may optionally be followed by a  colon-separated&lt;br /&gt;
	      list of options, where each option takes the form key=value.&lt;br /&gt;
&lt;br /&gt;
	      For  example, the bits or hex formats, for an ASCII bit or ASCII&lt;br /&gt;
	      hexadecimal display, can take a &amp;quot;width&amp;quot; option,  specifying  the&lt;br /&gt;
	      number  of  samples  (in	bits)  to  display  per  line. Thus -O&lt;br /&gt;
	      hex:width=128 will display 128 bits per line, in hexadecimal:&lt;br /&gt;
&lt;br /&gt;
	       0:ffff ffff ffff ffff ffff ffff ffff ffff&lt;br /&gt;
	       1:ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00&lt;br /&gt;
&lt;br /&gt;
	      The lines always start with the  channel	number	(or  name,  if&lt;br /&gt;
	      defined),  followed  by  a  colon. If no format is specified, it&lt;br /&gt;
	      defaults to bits:width=64, like this:&lt;br /&gt;
&lt;br /&gt;
	       0:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
	       1:11111111 00000000 11111111 00000000 [...]&lt;br /&gt;
&lt;br /&gt;
	      Example for saving data in the CSV format with options:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli [...] -o example.csv -O csv:dedup:header=false&lt;br /&gt;
&lt;br /&gt;
	      Notice that boolean options are true when no value  gets	speci-&lt;br /&gt;
	      fied.&lt;br /&gt;
&lt;br /&gt;
       -C, --channels &amp;lt;channellist&amp;gt;&lt;br /&gt;
	      A comma-separated list of channels to be used in the session.&lt;br /&gt;
&lt;br /&gt;
	      Note  that  sigrok  always  names  the channels according to how&lt;br /&gt;
	      they&amp;#039;re shown on the enclosure of the hardware.  If  your  logic&lt;br /&gt;
	      analyzer	numbers the channels 0-15, that&amp;#039;s how you must specify&lt;br /&gt;
	      them with this option. An oscilloscope&amp;#039;s channels  would	gener-&lt;br /&gt;
	      ally  be referred to as &amp;quot;CH1&amp;quot;, &amp;quot;CH2&amp;quot;, and so on.	Use the --show&lt;br /&gt;
	      option to see a list of channel names for your device.&lt;br /&gt;
&lt;br /&gt;
	      The default is to use all the channels available	on  a  device.&lt;br /&gt;
	      You  can	name  a channel like this: 1=CLK.  A range of channels&lt;br /&gt;
	      can also be given, in the form 1-5.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver fx2lafw --samples 100&lt;br /&gt;
			     --channels 1=CLK,2-4,7&lt;br /&gt;
	       CLK:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 2:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 3:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 4:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 7:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
&lt;br /&gt;
	      The comma-separated list is processed from left to  right,  i.e.&lt;br /&gt;
	      items  farther to the right override previous items. For example&lt;br /&gt;
	      1=CS,CS=MISO will set the name of channel 1 to MISO.&lt;br /&gt;
&lt;br /&gt;
       -g, --channel-group &amp;lt;channel group&amp;gt;&lt;br /&gt;
	      Specify the channel group to operate on. Some  devices  organize&lt;br /&gt;
	      channels	into groups, the settings of which can only be changed&lt;br /&gt;
	      as a group. The list of channel groups,  if  any,  is  displayed&lt;br /&gt;
	      with the --show command.&lt;br /&gt;
&lt;br /&gt;
	      Examples:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -g CH1 [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d demo -g Logic -c pattern=graycode [...]&lt;br /&gt;
&lt;br /&gt;
       -t, --triggers &amp;lt;triggerlist&amp;gt;&lt;br /&gt;
	      A  comma-separated  list	of triggers to use, of the form &amp;lt;chan-&lt;br /&gt;
	      nel&amp;gt;=&amp;lt;trigger&amp;gt;.  You can use the name or number of the  channel,&lt;br /&gt;
	      and the trigger itself is a series of characters:&lt;br /&gt;
&lt;br /&gt;
	      0 or 1: A low or high value on the pin.&lt;br /&gt;
	      r  or  f: A rising or falling value on the pin. An r effectively&lt;br /&gt;
	      corresponds to 01.&lt;br /&gt;
	      e: Any kind of change on a pin (either a	rising	or  a  falling&lt;br /&gt;
	      edge).&lt;br /&gt;
&lt;br /&gt;
	      Not  every  device  supports all of these trigger types. Use the&lt;br /&gt;
	      --show command to see which triggers your device supports.&lt;br /&gt;
&lt;br /&gt;
       -w, --wait-trigger&lt;br /&gt;
	      Don&amp;#039;t output any sample data (even  if  it&amp;#039;s  actually  received&lt;br /&gt;
	      from the hardware) before the trigger condition is met. In other&lt;br /&gt;
	      words, do not output any pre-trigger data. This option is useful&lt;br /&gt;
	      if  you  don&amp;#039;t  care about the data that came before the trigger&lt;br /&gt;
	      (but the hardware delivers this data to sigrok nonetheless).&lt;br /&gt;
&lt;br /&gt;
       -P, --protocol-decoders &amp;lt;list&amp;gt;&lt;br /&gt;
	      This option allows the user to specify a comma-separated list of&lt;br /&gt;
	      protocol	decoders  to be used in this session. The decoders are&lt;br /&gt;
	      specified by their ID, as shown  in  the	-L  (--list-supported)&lt;br /&gt;
	      output.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c&lt;br /&gt;
&lt;br /&gt;
	      Each protocol decoder can optionally be followed by a colon-sep-&lt;br /&gt;
	      arated list  of  options,  where	each  option  takes  the  form&lt;br /&gt;
	      key=value.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt;&lt;br /&gt;
			    -P uart:baudrate=115200:parity_type=odd&lt;br /&gt;
&lt;br /&gt;
	      The  list  of supported options depends entirely on the protocol&lt;br /&gt;
	      decoder. Every protocol decoder has different  options  it  sup-&lt;br /&gt;
	      ports.&lt;br /&gt;
&lt;br /&gt;
	      Any  &amp;quot;options&amp;quot;  specified  for  a protocol decoder which are not&lt;br /&gt;
	      actually supported options, will be interpreted as being channel&lt;br /&gt;
	      name/number assignments.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt;&lt;br /&gt;
			    -P spi:wordsize=9:miso=1:mosi=5:clk=3:cs=0&lt;br /&gt;
&lt;br /&gt;
	      In this example, wordsize is an option supported by the spi pro-&lt;br /&gt;
	      tocol decoder. Additionally, the user tells sigrok to decode the&lt;br /&gt;
	      SPI  protocol  using channel 1 as MISO signal for SPI, channel 5&lt;br /&gt;
	      as MOSI, channel 3 as CLK, and channel 0 as CS# signal.&lt;br /&gt;
&lt;br /&gt;
	      Notice that the sigrok-cli application does  not	support  &amp;quot;name&lt;br /&gt;
	      matching&amp;quot;.  Instead  it&amp;#039;s  assumed  that the traces in the input&lt;br /&gt;
	      stream match the order of the decoder&amp;#039;s input signals,  or  that&lt;br /&gt;
	      users  explicitly  specify  the  input channel to decoder signal&lt;br /&gt;
	      mapping.&lt;br /&gt;
&lt;br /&gt;
	      When multiple decoders are specified in the same -P option, they&lt;br /&gt;
	      will be stacked on top of each other in the specified order.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,eeprom24xx&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P uart:baudrate=31250,midi&lt;br /&gt;
&lt;br /&gt;
	      When multiple -P options are specified, each of them creates one&lt;br /&gt;
	      decoder stack, which  executes  in  parallel  to	other  decoder&lt;br /&gt;
	      stacks.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P uart:tx=D0:rx=D1 -P timing:data=D2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       -A, --protocol-decoder-annotations &amp;lt;annotations&amp;gt;&lt;br /&gt;
	      By  default,  all  annotation output of all protocol decoders is&lt;br /&gt;
	      shown. With this option a specific decoder&amp;#039;s annotations can  be&lt;br /&gt;
	      selected for display, by specifying the decoder ID:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid -A i2c&lt;br /&gt;
&lt;br /&gt;
	      If  a  protocol decoder has multiple annotation classes, you can&lt;br /&gt;
	      also specify which one of them to show by specifying  its  short&lt;br /&gt;
	      description like this:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read&lt;br /&gt;
&lt;br /&gt;
	      Select  multiple	annotation  classes  by separating them with a&lt;br /&gt;
	      colon:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read:data-write&lt;br /&gt;
&lt;br /&gt;
	      You can also select multiple protocol decoders, with an optional&lt;br /&gt;
	      selected annotation class each, by separating them with commas:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read:data-write,edid&lt;br /&gt;
&lt;br /&gt;
       -M, --protocol-decoder-meta &amp;lt;pdname&amp;gt;&lt;br /&gt;
	      When given, show protocol decoder meta output instead of annota-&lt;br /&gt;
	      tions.  The argument is the name of the decoder whose meta  out-&lt;br /&gt;
	      put to show.&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -M i2c&lt;br /&gt;
&lt;br /&gt;
	      Not every decoder generates meta output.&lt;br /&gt;
&lt;br /&gt;
       -B, --protocol-decoder-binary &amp;lt;binaryspec&amp;gt;&lt;br /&gt;
	      When  given,  decoder  &amp;quot;raw&amp;quot; data of various kinds is written to&lt;br /&gt;
	      stdout instead of annotations (this could be raw binary UART/SPI&lt;br /&gt;
	      bytes,  or  WAV  files, PCAP files, PNG files, or anything else;&lt;br /&gt;
	      this is entirely dependent on the  decoder  and  what  kinds  of&lt;br /&gt;
	      binary output make sense for that decoder).&lt;br /&gt;
&lt;br /&gt;
	      No  other  information is printed to stdout, so this is suitable&lt;br /&gt;
	      for piping into other programs or saving to a file.&lt;br /&gt;
&lt;br /&gt;
	      Protocol decoders that support binary output publish a  list  of&lt;br /&gt;
	      binary classes, for example the UART decoder might have &amp;quot;TX&amp;quot; and&lt;br /&gt;
	      &amp;quot;RX&amp;quot;. To select TX for output, the argument to this option would&lt;br /&gt;
	      be:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -B uart=tx&lt;br /&gt;
&lt;br /&gt;
	      If only the protocol decoder is specified, without binary class,&lt;br /&gt;
	      all classes are written to stdout:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -B uart&lt;br /&gt;
&lt;br /&gt;
	      (this is only useful in rare cases, generally you would  specify&lt;br /&gt;
	      a certain binary class you&amp;#039;re interested in)&lt;br /&gt;
&lt;br /&gt;
	      Not every decoder generates binary output.&lt;br /&gt;
&lt;br /&gt;
       --protocol-decoder-samplenum&lt;br /&gt;
	      When  given,  decoder  annotations  will include sample numbers,&lt;br /&gt;
	      too.  This allows consumers to receive machine  readable	timing&lt;br /&gt;
	      information.&lt;br /&gt;
&lt;br /&gt;
       -l, --loglevel &amp;lt;level&amp;gt;&lt;br /&gt;
	      Set  the	libsigrok  and libsigrokdecode loglevel. At the moment&lt;br /&gt;
	      sigrok-cli doesn&amp;#039;t support setting the  two  loglevels  indepen-&lt;br /&gt;
	      dently.  The  higher  the  number, the more debug output will be&lt;br /&gt;
	      printed. Valid loglevels are:&lt;br /&gt;
&lt;br /&gt;
	      0   None&lt;br /&gt;
	      1   Error&lt;br /&gt;
	      2   Warnings&lt;br /&gt;
	      3   Informational&lt;br /&gt;
	      4   Debug&lt;br /&gt;
	      5   Spew&lt;br /&gt;
&lt;br /&gt;
       --show&lt;br /&gt;
	      Show information about the selected option. For example, to  see&lt;br /&gt;
	      options for a connected fx2lafw device:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver fx2lafw --show&lt;br /&gt;
&lt;br /&gt;
	      In  order to properly get device options for your hardware, some&lt;br /&gt;
	      drivers might need a serial port specified:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver ols:conn=/dev/ttyACM0 --show&lt;br /&gt;
&lt;br /&gt;
	      This also works for protocol decoders, input modules and	output&lt;br /&gt;
	      modules:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --protocol-decoders i2c --show&lt;br /&gt;
	       $ sigrok-cli --input-format csv --show&lt;br /&gt;
	       $ sigrok-cli --output-format bits --show&lt;br /&gt;
&lt;br /&gt;
       --scan Scan for devices that can be detected automatically.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --scan&lt;br /&gt;
	       The following devices were found:&lt;br /&gt;
	       demo - Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0&lt;br /&gt;
	      A1 A2 A3&lt;br /&gt;
	       fx2lafw:conn=3.26 - CWAV USBee SX with 8 channels: 0 1 2 3 4  5&lt;br /&gt;
	      6 7&lt;br /&gt;
&lt;br /&gt;
	      However,	not  all devices are auto-detectable (e.g. serial port&lt;br /&gt;
	      based ones).  For those you&amp;#039;ll have to provide  a  conn  option,&lt;br /&gt;
	      see above.&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver digitek-dt4000zc:conn=/dev/ttyUSB0 --scan&lt;br /&gt;
	       The following devices were found:&lt;br /&gt;
	       Digitek DT4000ZC with 1 channel: P1&lt;br /&gt;
&lt;br /&gt;
       --time &amp;lt;ms&amp;gt;&lt;br /&gt;
	      Sample for &amp;lt;ms&amp;gt; milliseconds, then quit.&lt;br /&gt;
&lt;br /&gt;
	      You can optionally follow the number by s to specify the time to&lt;br /&gt;
	      sample in seconds.&lt;br /&gt;
&lt;br /&gt;
	      For example, --time 2s will sample for two seconds.&lt;br /&gt;
&lt;br /&gt;
       --samples &amp;lt;numsamples&amp;gt;&lt;br /&gt;
	      Acquire &amp;lt;numsamples&amp;gt; samples, then quit.&lt;br /&gt;
&lt;br /&gt;
	      You can optionally follow the number by k, m, or	g  to  specify&lt;br /&gt;
	      the  number  of samples in kilosamples, megasamples, or gigasam-&lt;br /&gt;
	      ples, respectively.&lt;br /&gt;
&lt;br /&gt;
	      For example, --samples 3m will acquire 3000000 samples.&lt;br /&gt;
&lt;br /&gt;
       --frames &amp;lt;numframes&amp;gt;&lt;br /&gt;
	      Acquire &amp;lt;numframes&amp;gt; frames, then quit.&lt;br /&gt;
&lt;br /&gt;
       --continuous&lt;br /&gt;
	      Sample continuously until stopped. Not all devices support this.&lt;br /&gt;
&lt;br /&gt;
       --get &amp;lt;variable&amp;gt;&lt;br /&gt;
	      Get the value of &amp;lt;variable&amp;gt; from the specified device and  print&lt;br /&gt;
	      it.&lt;br /&gt;
&lt;br /&gt;
       --set  Set  one	or  more variables specified with the --config option,&lt;br /&gt;
	      without doing any acquisition.&lt;br /&gt;
&lt;br /&gt;
EXAMPLES&lt;br /&gt;
       In order to get exactly 100 samples  from  the  connected  fx2lafw-sup-&lt;br /&gt;
       ported logic analyzer hardware, run the following command:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --samples 100&lt;br /&gt;
&lt;br /&gt;
       If you want to sample data for 3 seconds (3000 ms), use:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --time 3000&lt;br /&gt;
&lt;br /&gt;
       Alternatively, you can also use:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --time 3s&lt;br /&gt;
&lt;br /&gt;
       To  capture  data  from	the first 4 channels using the Openbench Logic&lt;br /&gt;
       Sniffer lasting 100ms at 10 MHz starting at the trigger condition&lt;br /&gt;
	      0:high, 1:rising, 2:low, 3:high, use:&lt;br /&gt;
&lt;br /&gt;
       sigrok-cli --driver ols:conn=/dev/ttyACM0 --config samplerate=10m \&lt;br /&gt;
	      --output-format bits --channels 0-3 --wait-trigger \&lt;br /&gt;
	      --triggers 0=1,1=r,2=0,3=1 --time 100&lt;br /&gt;
&lt;br /&gt;
       To turn on internal logging on a Lascar EL-USB series device:&lt;br /&gt;
&lt;br /&gt;
       sigrok-cli --driver lascar-el-usb:conn=10c4.0002 \&lt;br /&gt;
	      --config datalog=on --set&lt;br /&gt;
&lt;br /&gt;
EXIT STATUS&lt;br /&gt;
       sigrok-cli exits with 0 on success, 1 on most failures.&lt;br /&gt;
&lt;br /&gt;
SEE ALSO&lt;br /&gt;
       pulseview(1)&lt;br /&gt;
&lt;br /&gt;
BUGS&lt;br /&gt;
       Please report any bugs via Bugzilla (http://sigrok.org/bugzilla) or  on&lt;br /&gt;
       the sigrok-devel mailing list (sigrok-devel@lists.souceforge.net).&lt;br /&gt;
&lt;br /&gt;
LICENSE&lt;br /&gt;
       sigrok-cli  is  covered	by  the GNU General Public License (GPL). Some&lt;br /&gt;
       portions are licensed under the &amp;quot;GPL v2 or later&amp;quot;, some under  &amp;quot;GPL  v3&lt;br /&gt;
       or later&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
AUTHORS&lt;br /&gt;
       Please see the individual source code files.&lt;br /&gt;
&lt;br /&gt;
       This  manual  page was written by Uwe Hermann &amp;lt;uwe@hermann-uwe.de&amp;gt;.  It&lt;br /&gt;
       is licensed under the terms of the GNU GPL (version 2 or later).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
			       October 22, 2018 		 SIGROK-CLI(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Screenshots ==&lt;br /&gt;
&lt;br /&gt;
=== sigrok-cli in action: logic data, decoder output, analog data ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sigrok-cli-screenshot-1.png]]&lt;/div&gt;</summary>
		<author><name>AtomicFS</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Sigrok-cli&amp;diff=16558</id>
		<title>Sigrok-cli</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Sigrok-cli&amp;diff=16558"/>
		<updated>2023-07-06T16:08:02Z</updated>

		<summary type="html">&lt;p&gt;AtomicFS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:sigrok-cli}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;sigrok-cli&amp;#039;&amp;#039;&amp;#039; (sometimes abbreviated as &amp;quot;cli&amp;quot;) is a command-line frontend for sigrok.&lt;br /&gt;
&lt;br /&gt;
It is licensed under the terms of the &amp;#039;&amp;#039;&amp;#039;GNU GPL, version 3 or later&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
== Getting the code ==&lt;br /&gt;
&lt;br /&gt;
 $ &amp;#039;&amp;#039;&amp;#039;git clone git://sigrok.org/sigrok-cli&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You can also [http://sigrok.org/gitweb/?p=sigrok-cli.git;a=tree browse the source code] via gitweb.&lt;br /&gt;
&lt;br /&gt;
== Distribution packages ==&lt;br /&gt;
&lt;br /&gt;
See [[Downloads#Binaries_and_distribution_packages|Downloads]].&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
See [[Building]].&lt;br /&gt;
&lt;br /&gt;
== Usage tips ==&lt;br /&gt;
&lt;br /&gt;
It is recommended to capture the data first and process them later. sigrok-cli is single-threaded application and too much load will crash it. For capturing, use binary output format (especially for high sample-rates). This is because other formats pose too big overhead.&lt;br /&gt;
&lt;br /&gt;
 $ sigrok-cli --driver saleae-logic-pro --channels 0=Vcc,1=CS,2=MISO,3=MOSI,4=CLK --output-file &amp;lt;file&amp;gt;.bin --output-format binary --config samplerate=50m --continuous&lt;br /&gt;
&lt;br /&gt;
Even better, consider to use a buffer instead of direct write (even on SSD) and also compression.&lt;br /&gt;
&lt;br /&gt;
 $ sigrok-cli --driver saleae-logic-pro --channels 0=Vcc,1=CS,2=MISO,3=MOSI,4=CLK --output-format binary --config samplerate=50m --continuous | mbuffer | lz4 | pv &amp;gt; data.lz4q&lt;br /&gt;
&lt;br /&gt;
== Manpage ==&lt;br /&gt;
&amp;lt;!-- Generated by: &amp;quot;LC_ALL=C nroff -man doc/sigrok-cli.1 | col -b&amp;quot;. --&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SIGROK-CLI(1)		    General Commands Manual		 SIGROK-CLI(1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAME&lt;br /&gt;
       sigrok-cli - Command-line client for the sigrok software&lt;br /&gt;
&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
       sigrok-cli [OPTIONS] [COMMAND]&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
       sigrok-cli  is  a  cross-platform  command  line utility for the sigrok&lt;br /&gt;
       software.&lt;br /&gt;
&lt;br /&gt;
       It cannot display graphical output, but	is  still  sufficient  to  run&lt;br /&gt;
       through the whole process of hardware initialization, acquisition, pro-&lt;br /&gt;
       tocol decoding and saving the session.&lt;br /&gt;
&lt;br /&gt;
       It is useful for running on remote or embedded systems, netbooks, PDAs,&lt;br /&gt;
       and  for  various  other  use-cases. It can display samples on standard&lt;br /&gt;
       output or save them in various file formats.&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
       -h, --help&lt;br /&gt;
	      Show a help text and exit.&lt;br /&gt;
&lt;br /&gt;
       -V, --version&lt;br /&gt;
	      Show sigrok-cli version and the versions of libraries used.&lt;br /&gt;
&lt;br /&gt;
       -L, --list-supported&lt;br /&gt;
	      Show information about supported hardware  drivers,  input  file&lt;br /&gt;
	      formats, output file formats, and protocol decoders.&lt;br /&gt;
&lt;br /&gt;
       -d, --driver &amp;lt;drivername&amp;gt;&lt;br /&gt;
	      A  driver  must always be selected (unless doing a global scan).&lt;br /&gt;
	      Use the -L (--list-supported) option to get a list of  available&lt;br /&gt;
	      drivers.&lt;br /&gt;
&lt;br /&gt;
	      Drivers  can  take  options,  in the form key=value separated by&lt;br /&gt;
	      colons.&lt;br /&gt;
&lt;br /&gt;
	      Drivers communicating with hardware via  a  serial  port	always&lt;br /&gt;
	      need  the port specified as the conn option. For example, to use&lt;br /&gt;
	      the Openbench Logic Sniffer:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=ols:conn=/dev/ttyACM0 [...]&lt;br /&gt;
&lt;br /&gt;
	      Some USB devices don&amp;#039;t use a unique VendorID/ProductID  combina-&lt;br /&gt;
	      tion,  and  thus need that specified as well. This also uses the&lt;br /&gt;
	      conn option, using either VendorID.ProductID or bus.address:&lt;br /&gt;
&lt;br /&gt;
	      USB VendorID.ProductID example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=uni-t-ut61e:conn=1a86.e008 [...]&lt;br /&gt;
&lt;br /&gt;
	      USB bus.address example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver=uni-t-ut61e:conn=4.6 [...]&lt;br /&gt;
&lt;br /&gt;
       -c, --config &amp;lt;deviceoption&amp;gt;&lt;br /&gt;
	      A colon-separated list of  device  options,  where  each	option&lt;br /&gt;
	      takes the form key=value.  For example, to set the samplerate to&lt;br /&gt;
	      1MHz on a device supported by  the  fx2lafw  driver,  you  might&lt;br /&gt;
	      specify&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1m [...]&lt;br /&gt;
&lt;br /&gt;
	      Samplerate  is  an  option  common  to most logic analyzers. The&lt;br /&gt;
	      argument specifies the samplerate in Hz. You  can  also  specify&lt;br /&gt;
	      the samplerate in kHz, MHz or GHz.  The following are all equiv-&lt;br /&gt;
	      alent:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1000000 [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config samplerate=1m [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d fx2lafw --config &amp;quot;samplerate=1 MHz&amp;quot; [...]&lt;br /&gt;
&lt;br /&gt;
       -i, --input-file &amp;lt;filename&amp;gt;&lt;br /&gt;
	      Load input from a file instead of a  hardware  device.  You  can&lt;br /&gt;
	      specify  &amp;quot;-&amp;quot; to use stdin as input. If the --input-format option&lt;br /&gt;
	      is not supplied, sigrok-cli attempts to autodetect the file for-&lt;br /&gt;
	      mat of the input file.&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a sigrok session file:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.sr [...]&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a WAV file (autodetection of input format):&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.wav [...]&lt;br /&gt;
&lt;br /&gt;
	      Example  for  loading  a	VCD  file from stdin (autodetection of&lt;br /&gt;
	      input format):&lt;br /&gt;
&lt;br /&gt;
		$ cat example.vcd | sigrok-cli -i - [...]&lt;br /&gt;
&lt;br /&gt;
       -I, --input-format &amp;lt;format&amp;gt;&lt;br /&gt;
	      When loading an input file, assume it&amp;#039;s in the specified format.&lt;br /&gt;
	      If  this	option	is not supplied (in addition to --input-file),&lt;br /&gt;
	      sigrok-cli attempts to autodetect the file format of  the  input&lt;br /&gt;
	      file.  Use  the  -L  (--list-supported)  option to see a list of&lt;br /&gt;
	      available input formats.&lt;br /&gt;
&lt;br /&gt;
	      The format name may optionally be followed by a  colon-separated&lt;br /&gt;
	      list of options, where each option takes the form key=value.&lt;br /&gt;
&lt;br /&gt;
	      Example for loading a binary file with options:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -i example.bin&lt;br /&gt;
			     -I binary:numchannels=4:samplerate=1mhz [...]&lt;br /&gt;
&lt;br /&gt;
       -o, --output-file &amp;lt;filename&amp;gt;&lt;br /&gt;
	      Save  output  to	a  file  instead  of writing it to stdout. The&lt;br /&gt;
	      default format used when saving is the sigrok session file  for-&lt;br /&gt;
	      mat. This can be changed with the --output-format option.&lt;br /&gt;
&lt;br /&gt;
	      Example for saving data in the sigrok session format:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli [...] -o example.sr&lt;br /&gt;
&lt;br /&gt;
       -O, --output-format &amp;lt;format&amp;gt;&lt;br /&gt;
	      Set  the	output	format	to  use. Use the -L (--list-supported)&lt;br /&gt;
	      option to see a list of available output formats.&lt;br /&gt;
&lt;br /&gt;
	      The format name may optionally be followed by a  colon-separated&lt;br /&gt;
	      list of options, where each option takes the form key=value.&lt;br /&gt;
&lt;br /&gt;
	      For  example, the bits or hex formats, for an ASCII bit or ASCII&lt;br /&gt;
	      hexadecimal display, can take a &amp;quot;width&amp;quot; option,  specifying  the&lt;br /&gt;
	      number  of  samples  (in	bits)  to  display  per  line. Thus -O&lt;br /&gt;
	      hex:width=128 will display 128 bits per line, in hexadecimal:&lt;br /&gt;
&lt;br /&gt;
	       0:ffff ffff ffff ffff ffff ffff ffff ffff&lt;br /&gt;
	       1:ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00&lt;br /&gt;
&lt;br /&gt;
	      The lines always start with the  channel	number	(or  name,  if&lt;br /&gt;
	      defined),  followed  by  a  colon. If no format is specified, it&lt;br /&gt;
	      defaults to bits:width=64, like this:&lt;br /&gt;
&lt;br /&gt;
	       0:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
	       1:11111111 00000000 11111111 00000000 [...]&lt;br /&gt;
&lt;br /&gt;
	      Example for saving data in the CSV format with options:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli [...] -o example.csv -O csv:dedup:header=false&lt;br /&gt;
&lt;br /&gt;
	      Notice that boolean options are true when no value  gets	speci-&lt;br /&gt;
	      fied.&lt;br /&gt;
&lt;br /&gt;
       -C, --channels &amp;lt;channellist&amp;gt;&lt;br /&gt;
	      A comma-separated list of channels to be used in the session.&lt;br /&gt;
&lt;br /&gt;
	      Note  that  sigrok  always  names  the channels according to how&lt;br /&gt;
	      they&amp;#039;re shown on the enclosure of the hardware.  If  your  logic&lt;br /&gt;
	      analyzer	numbers the channels 0-15, that&amp;#039;s how you must specify&lt;br /&gt;
	      them with this option. An oscilloscope&amp;#039;s channels  would	gener-&lt;br /&gt;
	      ally  be referred to as &amp;quot;CH1&amp;quot;, &amp;quot;CH2&amp;quot;, and so on.	Use the --show&lt;br /&gt;
	      option to see a list of channel names for your device.&lt;br /&gt;
&lt;br /&gt;
	      The default is to use all the channels available	on  a  device.&lt;br /&gt;
	      You  can	name  a channel like this: 1=CLK.  A range of channels&lt;br /&gt;
	      can also be given, in the form 1-5.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli --driver fx2lafw --samples 100&lt;br /&gt;
			     --channels 1=CLK,2-4,7&lt;br /&gt;
	       CLK:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 2:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 3:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 4:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
		 7:11111111 11111111 11111111 11111111 [...]&lt;br /&gt;
&lt;br /&gt;
	      The comma-separated list is processed from left to  right,  i.e.&lt;br /&gt;
	      items  farther to the right override previous items. For example&lt;br /&gt;
	      1=CS,CS=MISO will set the name of channel 1 to MISO.&lt;br /&gt;
&lt;br /&gt;
       -g, --channel-group &amp;lt;channel group&amp;gt;&lt;br /&gt;
	      Specify the channel group to operate on. Some  devices  organize&lt;br /&gt;
	      channels	into groups, the settings of which can only be changed&lt;br /&gt;
	      as a group. The list of channel groups,  if  any,  is  displayed&lt;br /&gt;
	      with the --show command.&lt;br /&gt;
&lt;br /&gt;
	      Examples:&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -g CH1 [...]&lt;br /&gt;
&lt;br /&gt;
		$ sigrok-cli -d demo -g Logic -c pattern=graycode [...]&lt;br /&gt;
&lt;br /&gt;
       -t, --triggers &amp;lt;triggerlist&amp;gt;&lt;br /&gt;
	      A  comma-separated  list	of triggers to use, of the form &amp;lt;chan-&lt;br /&gt;
	      nel&amp;gt;=&amp;lt;trigger&amp;gt;.  You can use the name or number of the  channel,&lt;br /&gt;
	      and the trigger itself is a series of characters:&lt;br /&gt;
&lt;br /&gt;
	      0 or 1: A low or high value on the pin.&lt;br /&gt;
	      r  or  f: A rising or falling value on the pin. An r effectively&lt;br /&gt;
	      corresponds to 01.&lt;br /&gt;
	      e: Any kind of change on a pin (either a	rising	or  a  falling&lt;br /&gt;
	      edge).&lt;br /&gt;
&lt;br /&gt;
	      Not  every  device  supports all of these trigger types. Use the&lt;br /&gt;
	      --show command to see which triggers your device supports.&lt;br /&gt;
&lt;br /&gt;
       -w, --wait-trigger&lt;br /&gt;
	      Don&amp;#039;t output any sample data (even  if  it&amp;#039;s  actually  received&lt;br /&gt;
	      from the hardware) before the trigger condition is met. In other&lt;br /&gt;
	      words, do not output any pre-trigger data. This option is useful&lt;br /&gt;
	      if  you  don&amp;#039;t  care about the data that came before the trigger&lt;br /&gt;
	      (but the hardware delivers this data to sigrok nonetheless).&lt;br /&gt;
&lt;br /&gt;
       -P, --protocol-decoders &amp;lt;list&amp;gt;&lt;br /&gt;
	      This option allows the user to specify a comma-separated list of&lt;br /&gt;
	      protocol	decoders  to be used in this session. The decoders are&lt;br /&gt;
	      specified by their ID, as shown  in  the	-L  (--list-supported)&lt;br /&gt;
	      output.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c&lt;br /&gt;
&lt;br /&gt;
	      Each protocol decoder can optionally be followed by a colon-sep-&lt;br /&gt;
	      arated list  of  options,  where	each  option  takes  the  form&lt;br /&gt;
	      key=value.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt;&lt;br /&gt;
			    -P uart:baudrate=115200:parity_type=odd&lt;br /&gt;
&lt;br /&gt;
	      The  list  of supported options depends entirely on the protocol&lt;br /&gt;
	      decoder. Every protocol decoder has different  options  it  sup-&lt;br /&gt;
	      ports.&lt;br /&gt;
&lt;br /&gt;
	      Any  &amp;quot;options&amp;quot;  specified  for  a protocol decoder which are not&lt;br /&gt;
	      actually supported options, will be interpreted as being channel&lt;br /&gt;
	      name/number assignments.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt;&lt;br /&gt;
			    -P spi:wordsize=9:miso=1:mosi=5:clk=3:cs=0&lt;br /&gt;
&lt;br /&gt;
	      In this example, wordsize is an option supported by the spi pro-&lt;br /&gt;
	      tocol decoder. Additionally, the user tells sigrok to decode the&lt;br /&gt;
	      SPI  protocol  using channel 1 as MISO signal for SPI, channel 5&lt;br /&gt;
	      as MOSI, channel 3 as CLK, and channel 0 as CS# signal.&lt;br /&gt;
&lt;br /&gt;
	      Notice that the sigrok-cli application does  not	support  &amp;quot;name&lt;br /&gt;
	      matching&amp;quot;.  Instead  it&amp;#039;s  assumed  that the traces in the input&lt;br /&gt;
	      stream match the order of the decoder&amp;#039;s input signals,  or  that&lt;br /&gt;
	      users  explicitly  specify  the  input channel to decoder signal&lt;br /&gt;
	      mapping.&lt;br /&gt;
&lt;br /&gt;
	      When multiple decoders are specified in the same -P option, they&lt;br /&gt;
	      will be stacked on top of each other in the specified order.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,eeprom24xx&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P uart:baudrate=31250,midi&lt;br /&gt;
&lt;br /&gt;
	      When multiple -P options are specified, each of them creates one&lt;br /&gt;
	      decoder stack, which  executes  in  parallel  to	other  decoder&lt;br /&gt;
	      stacks.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P uart:tx=D0:rx=D1 -P timing:data=D2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       -A, --protocol-decoder-annotations &amp;lt;annotations&amp;gt;&lt;br /&gt;
	      By  default,  all  annotation output of all protocol decoders is&lt;br /&gt;
	      shown. With this option a specific decoder&amp;#039;s annotations can  be&lt;br /&gt;
	      selected for display, by specifying the decoder ID:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid -A i2c&lt;br /&gt;
&lt;br /&gt;
	      If  a  protocol decoder has multiple annotation classes, you can&lt;br /&gt;
	      also specify which one of them to show by specifying  its  short&lt;br /&gt;
	      description like this:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read&lt;br /&gt;
&lt;br /&gt;
	      Select  multiple	annotation  classes  by separating them with a&lt;br /&gt;
	      colon:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read:data-write&lt;br /&gt;
&lt;br /&gt;
	      You can also select multiple protocol decoders, with an optional&lt;br /&gt;
	      selected annotation class each, by separating them with commas:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -P i2c,i2cfilter,edid&lt;br /&gt;
			    -A i2c=data-read:data-write,edid&lt;br /&gt;
&lt;br /&gt;
       -M, --protocol-decoder-meta &amp;lt;pdname&amp;gt;&lt;br /&gt;
	      When given, show protocol decoder meta output instead of annota-&lt;br /&gt;
	      tions.  The argument is the name of the decoder whose meta  out-&lt;br /&gt;
	      put to show.&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -M i2c&lt;br /&gt;
&lt;br /&gt;
	      Not every decoder generates meta output.&lt;br /&gt;
&lt;br /&gt;
       -B, --protocol-decoder-binary &amp;lt;binaryspec&amp;gt;&lt;br /&gt;
	      When  given,  decoder  &amp;quot;raw&amp;quot; data of various kinds is written to&lt;br /&gt;
	      stdout instead of annotations (this could be raw binary UART/SPI&lt;br /&gt;
	      bytes,  or  WAV  files, PCAP files, PNG files, or anything else;&lt;br /&gt;
	      this is entirely dependent on the  decoder  and  what  kinds  of&lt;br /&gt;
	      binary output make sense for that decoder).&lt;br /&gt;
&lt;br /&gt;
	      No  other  information is printed to stdout, so this is suitable&lt;br /&gt;
	      for piping into other programs or saving to a file.&lt;br /&gt;
&lt;br /&gt;
	      Protocol decoders that support binary output publish a  list  of&lt;br /&gt;
	      binary classes, for example the UART decoder might have &amp;quot;TX&amp;quot; and&lt;br /&gt;
	      &amp;quot;RX&amp;quot;. To select TX for output, the argument to this option would&lt;br /&gt;
	      be:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -B uart=tx&lt;br /&gt;
&lt;br /&gt;
	      If only the protocol decoder is specified, without binary class,&lt;br /&gt;
	      all classes are written to stdout:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli -i &amp;lt;file.sr&amp;gt; -B uart&lt;br /&gt;
&lt;br /&gt;
	      (this is only useful in rare cases, generally you would  specify&lt;br /&gt;
	      a certain binary class you&amp;#039;re interested in)&lt;br /&gt;
&lt;br /&gt;
	      Not every decoder generates binary output.&lt;br /&gt;
&lt;br /&gt;
       --protocol-decoder-samplenum&lt;br /&gt;
	      When  given,  decoder  annotations  will include sample numbers,&lt;br /&gt;
	      too.  This allows consumers to receive machine  readable	timing&lt;br /&gt;
	      information.&lt;br /&gt;
&lt;br /&gt;
       -l, --loglevel &amp;lt;level&amp;gt;&lt;br /&gt;
	      Set  the	libsigrok  and libsigrokdecode loglevel. At the moment&lt;br /&gt;
	      sigrok-cli doesn&amp;#039;t support setting the  two  loglevels  indepen-&lt;br /&gt;
	      dently.  The  higher  the  number, the more debug output will be&lt;br /&gt;
	      printed. Valid loglevels are:&lt;br /&gt;
&lt;br /&gt;
	      0   None&lt;br /&gt;
	      1   Error&lt;br /&gt;
	      2   Warnings&lt;br /&gt;
	      3   Informational&lt;br /&gt;
	      4   Debug&lt;br /&gt;
	      5   Spew&lt;br /&gt;
&lt;br /&gt;
       --show&lt;br /&gt;
	      Show information about the selected option. For example, to  see&lt;br /&gt;
	      options for a connected fx2lafw device:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver fx2lafw --show&lt;br /&gt;
&lt;br /&gt;
	      In  order to properly get device options for your hardware, some&lt;br /&gt;
	      drivers might need a serial port specified:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver ols:conn=/dev/ttyACM0 --show&lt;br /&gt;
&lt;br /&gt;
	      This also works for protocol decoders, input modules and	output&lt;br /&gt;
	      modules:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --protocol-decoders i2c --show&lt;br /&gt;
	       $ sigrok-cli --input-format csv --show&lt;br /&gt;
	       $ sigrok-cli --output-format bits --show&lt;br /&gt;
&lt;br /&gt;
       --scan Scan for devices that can be detected automatically.&lt;br /&gt;
&lt;br /&gt;
	      Example:&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --scan&lt;br /&gt;
	       The following devices were found:&lt;br /&gt;
	       demo - Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0&lt;br /&gt;
	      A1 A2 A3&lt;br /&gt;
	       fx2lafw:conn=3.26 - CWAV USBee SX with 8 channels: 0 1 2 3 4  5&lt;br /&gt;
	      6 7&lt;br /&gt;
&lt;br /&gt;
	      However,	not  all devices are auto-detectable (e.g. serial port&lt;br /&gt;
	      based ones).  For those you&amp;#039;ll have to provide  a  conn  option,&lt;br /&gt;
	      see above.&lt;br /&gt;
&lt;br /&gt;
	       $ sigrok-cli --driver digitek-dt4000zc:conn=/dev/ttyUSB0 --scan&lt;br /&gt;
	       The following devices were found:&lt;br /&gt;
	       Digitek DT4000ZC with 1 channel: P1&lt;br /&gt;
&lt;br /&gt;
       --time &amp;lt;ms&amp;gt;&lt;br /&gt;
	      Sample for &amp;lt;ms&amp;gt; milliseconds, then quit.&lt;br /&gt;
&lt;br /&gt;
	      You can optionally follow the number by s to specify the time to&lt;br /&gt;
	      sample in seconds.&lt;br /&gt;
&lt;br /&gt;
	      For example, --time 2s will sample for two seconds.&lt;br /&gt;
&lt;br /&gt;
       --samples &amp;lt;numsamples&amp;gt;&lt;br /&gt;
	      Acquire &amp;lt;numsamples&amp;gt; samples, then quit.&lt;br /&gt;
&lt;br /&gt;
	      You can optionally follow the number by k, m, or	g  to  specify&lt;br /&gt;
	      the  number  of samples in kilosamples, megasamples, or gigasam-&lt;br /&gt;
	      ples, respectively.&lt;br /&gt;
&lt;br /&gt;
	      For example, --samples 3m will acquire 3000000 samples.&lt;br /&gt;
&lt;br /&gt;
       --frames &amp;lt;numframes&amp;gt;&lt;br /&gt;
	      Acquire &amp;lt;numframes&amp;gt; frames, then quit.&lt;br /&gt;
&lt;br /&gt;
       --continuous&lt;br /&gt;
	      Sample continuously until stopped. Not all devices support this.&lt;br /&gt;
&lt;br /&gt;
       --get &amp;lt;variable&amp;gt;&lt;br /&gt;
	      Get the value of &amp;lt;variable&amp;gt; from the specified device and  print&lt;br /&gt;
	      it.&lt;br /&gt;
&lt;br /&gt;
       --set  Set  one	or  more variables specified with the --config option,&lt;br /&gt;
	      without doing any acquisition.&lt;br /&gt;
&lt;br /&gt;
EXAMPLES&lt;br /&gt;
       In order to get exactly 100 samples  from  the  connected  fx2lafw-sup-&lt;br /&gt;
       ported logic analyzer hardware, run the following command:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --samples 100&lt;br /&gt;
&lt;br /&gt;
       If you want to sample data for 3 seconds (3000 ms), use:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --time 3000&lt;br /&gt;
&lt;br /&gt;
       Alternatively, you can also use:&lt;br /&gt;
&lt;br /&gt;
	 sigrok-cli --driver fx2lafw --time 3s&lt;br /&gt;
&lt;br /&gt;
       To  capture  data  from	the first 4 channels using the Openbench Logic&lt;br /&gt;
       Sniffer lasting 100ms at 10 MHz starting at the trigger condition&lt;br /&gt;
	      0:high, 1:rising, 2:low, 3:high, use:&lt;br /&gt;
&lt;br /&gt;
       sigrok-cli --driver ols:conn=/dev/ttyACM0 --config samplerate=10m \&lt;br /&gt;
	      --output-format bits --channels 0-3 --wait-trigger \&lt;br /&gt;
	      --triggers 0=1,1=r,2=0,3=1 --time 100&lt;br /&gt;
&lt;br /&gt;
       To turn on internal logging on a Lascar EL-USB series device:&lt;br /&gt;
&lt;br /&gt;
       sigrok-cli --driver lascar-el-usb:conn=10c4.0002 \&lt;br /&gt;
	      --config datalog=on --set&lt;br /&gt;
&lt;br /&gt;
EXIT STATUS&lt;br /&gt;
       sigrok-cli exits with 0 on success, 1 on most failures.&lt;br /&gt;
&lt;br /&gt;
SEE ALSO&lt;br /&gt;
       pulseview(1)&lt;br /&gt;
&lt;br /&gt;
BUGS&lt;br /&gt;
       Please report any bugs via Bugzilla (http://sigrok.org/bugzilla) or  on&lt;br /&gt;
       the sigrok-devel mailing list (sigrok-devel@lists.souceforge.net).&lt;br /&gt;
&lt;br /&gt;
LICENSE&lt;br /&gt;
       sigrok-cli  is  covered	by  the GNU General Public License (GPL). Some&lt;br /&gt;
       portions are licensed under the &amp;quot;GPL v2 or later&amp;quot;, some under  &amp;quot;GPL  v3&lt;br /&gt;
       or later&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
AUTHORS&lt;br /&gt;
       Please see the individual source code files.&lt;br /&gt;
&lt;br /&gt;
       This  manual  page was written by Uwe Hermann &amp;lt;uwe@hermann-uwe.de&amp;gt;.  It&lt;br /&gt;
       is licensed under the terms of the GNU GPL (version 2 or later).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
			       October 22, 2018 		 SIGROK-CLI(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Screenshots ==&lt;br /&gt;
&lt;br /&gt;
=== sigrok-cli in action: logic data, decoder output, analog data ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sigrok-cli-screenshot-1.png]]&lt;/div&gt;</summary>
		<author><name>AtomicFS</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Input_output_formats&amp;diff=16557</id>
		<title>Input output formats</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Input_output_formats&amp;diff=16557"/>
		<updated>2023-07-06T15:46:22Z</updated>

		<summary type="html">&lt;p&gt;AtomicFS: /* Supported input/output formats */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[libsigrok]] supports a number of different input modules (a.k.a. file formats) and output modules, and has a generic API which allows easily adding more input/output modules.&lt;br /&gt;
&lt;br /&gt;
== Supported input/output formats ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width: 12em;&amp;quot; | Name&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:analog|Analog]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Text output of analog data and types.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:ascii|ASCII]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| ASCII art.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:binary|Binary]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Raw binary data output without any metadata attached.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:bits|Bits]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| 0/1 digits.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space: nowrap;&amp;quot; | [[File format:chronovu_la8|ChronoVu LA8]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| [[ChronoVu LA8]] software file format (usually with .kdt file extension).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:csv|CSV]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Comma-separated values (also usable for generating data and config files for gnuplot).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:hex|hex]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Hexadecimal digits.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:logicport|Intronix Logicport LA1034]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| [[Intronix Logicport LA1034]] *.lpf files.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:ols|ols]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The file format used by the [http://www.lxtreme.nl/ols/ &amp;quot;Alternative&amp;quot; Java client] for the [[Openbench Logic Sniffer]].&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:saleae|saleae]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| Files exported by the Saleae Logic application.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:srzip|srzip]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The current (v2) sigrok session file format (*.sr).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:stf|STF]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| &amp;quot;Sigma Test File&amp;quot;. Native format of the Asix Sigma/Omega vendor software.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:vcd|VCD]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The [http://en.wikipedia.org/wiki/Value_change_dump Value Change Dump] format (can also be visualized in [http://gtkwave.sourceforge.net/ gtkwave], for instance).&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:wav|WAV]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| The [http://en.wikipedia.org/wiki/WAV waveform audio] (WAV) file format.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:raw_analog|Raw analog]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| Analog signals without header (configurable sample size, format, and endianness).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:trace32_ad|Lauterbach Trace32]]&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| The Lauterbach Trace32 logic analyzer data file format.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:wavedrom|WaveDrom]]&lt;br /&gt;
| bgcolor=&amp;quot;yellow&amp;quot; | &amp;amp;mdash;&lt;br /&gt;
| bgcolor=&amp;quot;lime&amp;quot; | supported&lt;br /&gt;
| Digital timing diagrams in JSON syntax&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;WARNING:&amp;lt;/b&amp;gt; The output formats apply only to unprocessed raw data. Data processed by decoders can&amp;#039;t be saved into output file by argument, only be redirection of &amp;lt;code&amp;gt;STDOUT&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Supported transform modules ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width: 8em;&amp;quot; | Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| nop&lt;br /&gt;
| Do nothing.&lt;br /&gt;
|-&lt;br /&gt;
| scale&lt;br /&gt;
| Scale analog values by a specified factor.&lt;br /&gt;
|-&lt;br /&gt;
| invert&lt;br /&gt;
| Invert values.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Possible candidates for future input/output formats ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; style=&amp;quot;font-size: smaller&amp;quot; class=&amp;quot;alternategrey sortable sigroktable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Scanalogic&lt;br /&gt;
| Used by the [[IKALOGIC Scanalogic-2]] and [[IKALOGIC ScanaPLUS]] logic analyzers.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_rof|Rigol ROF]]&lt;br /&gt;
| Used by the [[Rigol DP800 series]] power supplies.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_raf|Rigol RAF]]&lt;br /&gt;
| Used by the Rigol DG1000Z, DG4000, and DG5000 series signal generators. See [http://www.batronix.com/pdf/Rigol/UserGuide/DG1000Z_UserGuide_EN.pdf DG1000Z User Guide] page 2-75, also [http://www.eevblog.com/forum/testgear/rigol-dg4000-series-raf-file-format/msg559443/ this post] at eevblog.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:rigol_wfm|Rigol WFM]]&lt;br /&gt;
| Used by the Rigol DS series oscilloscopes. See https://github.com/mabl/pyRigolWFM/blob/master/wfm.py&lt;br /&gt;
|-&lt;br /&gt;
| [[File_format:Rigol_WFM4|Rigol WFM4]]&lt;br /&gt;
| Used by the Rigol DS4000 series oscilloscopes.&lt;br /&gt;
|-&lt;br /&gt;
| Vector MDF (v3.3) / ASAM MDF (v4.x)&lt;br /&gt;
| Automotive industry standard format. Docs can be found [http://vector.com/vi_mdf_de.html here] and [http://vector.com/downloads/mdf_specification.pdf here]. Validator is [http://vector.com/downloads/MDFValidator2.1.8.zip here]. Some code is [https://code.google.com/p/mdfreader/ here] and [http://sourceforge.net/p/mdfdatafile/code/HEAD/tree/ here].&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Comtrade COMTRADE]&lt;br /&gt;
| File format used by devices in power engineering (e.g. protective relays, fault recorders). Can contain digital and analog data with constant or variable sample rate.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:pwl|PWL]]&lt;br /&gt;
| Trivial file format that can be used to define the signal of voltage/current sources in a SPICE simulation.&lt;br /&gt;
|-&lt;br /&gt;
| [[File format:tektronix_wfm|Tektronix WFM]]&lt;br /&gt;
| Used by the Tektronix TDS series oscilloscopes. A parser for Matlab can be found [http://www.mathworks.com/matlabcentral/fileexchange/5873-tektronix-binary-file-readers/content/wfmread.m here].&lt;br /&gt;
|-&lt;br /&gt;
| EVCD/IDX/FST/GHW&lt;br /&gt;
| File formats generated by hardware simulation tools. See the [http://gtkwave.sourceforge.net/gtkwave.pdf GtkWave manual] for some of them, and conversion utilities.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.ni.com/hu-hu/support/documentation/supplemental/06/the-ni-tdms-file-format.html NI TDMS]&lt;br /&gt;
| File formats used by various National Instruments software like LabVIEW or DAQExpress.&lt;br /&gt;
|-&lt;br /&gt;
| IMC data format&lt;br /&gt;
| File formats used by imc GmbH softwares. File format description can be found in the [https://www.imcdataworks.com/secure-dl/?file=fileadmin/Download-Center/Manuals/imc_FAMOS/imcSharedComponents.pdf imc Software Shared Components documentation]. (Registration required.)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AtomicFS</name></author>
	</entry>
	<entry>
		<id>https://sigrok.org/w/index.php?title=Protocol_decoder_HOWTO&amp;diff=16556</id>
		<title>Protocol decoder HOWTO</title>
		<link rel="alternate" type="text/html" href="https://sigrok.org/w/index.php?title=Protocol_decoder_HOWTO&amp;diff=16556"/>
		<updated>2023-07-06T13:20:52Z</updated>

		<summary type="html">&lt;p&gt;AtomicFS: /* Unit tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page serves as a quick-start guide for people who want to write their own [[libsigrokdecode]] protocol decoders ([[Protocol decoders|PDs]]).&lt;br /&gt;
&lt;br /&gt;
It is &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; intended to replace the [[Protocol decoder API]] page, but rather to give a short overview/tutorial and some tips.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Protocol decoders are written entirely in Python (&amp;gt;= 3.0).&lt;br /&gt;
&lt;br /&gt;
== Files ==&lt;br /&gt;
&lt;br /&gt;
Every protocol decoder is a Python module and has its own subdirectory in libsigrokdecode&amp;#039;s &amp;#039;&amp;#039;&amp;#039;[http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=tree;f=decoders decoders]&amp;#039;&amp;#039;&amp;#039; directory.&lt;br /&gt;
&lt;br /&gt;
This is a minimalistic example of how a protocol decoder looks like, in this case the &amp;#039;&amp;#039;&amp;#039;[[Protocol_decoder:I2c|i2c]]&amp;#039;&amp;#039;&amp;#039; decoder (license header, comments, and some other parts omitted).&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note&amp;#039;&amp;#039;&amp;#039;: Do not start new protocol decoders by copying code from here. Instead, it&amp;#039;s recommended to select an already existing decoder in the source code which is similar to the one you plan to write, and copy that as a starting point.&lt;br /&gt;
&lt;br /&gt;
=== __init__.py ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 I²C (Inter-Integrated Circuit) is a bidirectional, multi-master&lt;br /&gt;
 bus using two signals (SCL = serial clock line, SDA = serial data line).&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;Insert notes and hints for the user here&amp;gt;&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 from .pd import Decoder&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a standard Python file, required in every Python module. It contains a module-level docstring, which is accessible by frontends via the [http://sigrok.org/api/libsigrokdecode/unstable/index.html libsigrokdecode API]. It should contain a (very) short description of what the protocol (in this case [[Protocol_decoder:I2c|I²C]]) is about, and some notes and hints for the user of this protocol decoder (which can be shown in GUIs when the user selects/browses different PDs).&lt;br /&gt;
&lt;br /&gt;
This docstring should &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; contain the full, extensive protocol description. Instead, the per-PD wiki page should be used for protocol description, photos of devices or photos of example acquisition setups, and so on. Each decoder has one unique wiki page at the URL &amp;#039;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;http://sigrok.org/wiki/Protocol_decoder:&amp;lt;pd&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;#039;, where &amp;#039;&amp;#039;&amp;#039;&amp;lt;pd&amp;gt;&amp;#039;&amp;#039;&amp;#039; is the Python module name of the decoder (&amp;#039;&amp;#039;&amp;#039;i2c&amp;#039;&amp;#039;&amp;#039; in this case). Some examples for such per-PD wiki pages: [[Protocol_decoder:Uart|UART]], [[Protocol_decoder:Pan1321|PAN1321]], [[Protocol_decoder:Mx25lxx05d|MX25Lxx05D]], [[Protocol_decoder:Dcf77|DCF77]].&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;#039;&amp;#039;&amp;#039;from .pd import Decoder&amp;#039;&amp;#039;&amp;#039;&amp;quot; line will make sure the code from &amp;#039;&amp;#039;&amp;#039;pd.py&amp;#039;&amp;#039;&amp;#039; gets properly imported when this module is used.&lt;br /&gt;
&lt;br /&gt;
=== pd.py ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 import sigrokdecode as srd&lt;br /&gt;
 &lt;br /&gt;
 class Decoder(srd.Decoder):&lt;br /&gt;
     api_version = 3&lt;br /&gt;
     id = &amp;#039;i2c&amp;#039;&lt;br /&gt;
     name = &amp;#039;I²C&amp;#039;&lt;br /&gt;
     longname = &amp;#039;Inter-Integrated Circuit&amp;#039;&lt;br /&gt;
     desc = &amp;#039;Two-wire, multi-master, serial bus.&amp;#039;&lt;br /&gt;
     license = &amp;#039;gplv2+&amp;#039;&lt;br /&gt;
     inputs = [&amp;#039;logic&amp;#039;]&lt;br /&gt;
     outputs = [&amp;#039;i2c&amp;#039;]&lt;br /&gt;
     channels = (&lt;br /&gt;
         {&amp;#039;id&amp;#039;: &amp;#039;scl&amp;#039;, &amp;#039;name&amp;#039;: &amp;#039;SCL&amp;#039;, &amp;#039;desc&amp;#039;: &amp;#039;Serial clock line&amp;#039;},&lt;br /&gt;
         {&amp;#039;id&amp;#039;: &amp;#039;sda&amp;#039;, &amp;#039;name&amp;#039;: &amp;#039;SDA&amp;#039;, &amp;#039;desc&amp;#039;: &amp;#039;Serial data line&amp;#039;},&lt;br /&gt;
     )&lt;br /&gt;
     optional_channels = ()&lt;br /&gt;
     options = (&lt;br /&gt;
         {&amp;#039;id&amp;#039;: &amp;#039;address_format&amp;#039;, &amp;#039;desc&amp;#039;: &amp;#039;Displayed slave address format&amp;#039;,&lt;br /&gt;
            &amp;#039;default&amp;#039;: &amp;#039;shifted&amp;#039;, &amp;#039;values&amp;#039;: (&amp;#039;shifted&amp;#039;, &amp;#039;unshifted&amp;#039;)},&lt;br /&gt;
     )&lt;br /&gt;
     annotations = (&lt;br /&gt;
         (&amp;#039;start&amp;#039;, &amp;#039;Start condition&amp;#039;),&lt;br /&gt;
         (&amp;#039;repeat-start&amp;#039;, &amp;#039;Repeat start condition&amp;#039;),&lt;br /&gt;
         (&amp;#039;stop&amp;#039;, &amp;#039;Stop condition&amp;#039;),&lt;br /&gt;
         (&amp;#039;ack&amp;#039;, &amp;#039;ACK&amp;#039;),&lt;br /&gt;
         (&amp;#039;nack&amp;#039;, &amp;#039;NACK&amp;#039;),&lt;br /&gt;
         (&amp;#039;bit&amp;#039;, &amp;#039;Data/address bit&amp;#039;),&lt;br /&gt;
         (&amp;#039;address-read&amp;#039;, &amp;#039;Address read&amp;#039;),&lt;br /&gt;
         (&amp;#039;address-write&amp;#039;, &amp;#039;Address write&amp;#039;),&lt;br /&gt;
         (&amp;#039;data-read&amp;#039;, &amp;#039;Data read&amp;#039;),&lt;br /&gt;
         (&amp;#039;data-write&amp;#039;, &amp;#039;Data write&amp;#039;),&lt;br /&gt;
         (&amp;#039;warnings&amp;#039;, &amp;#039;Human-readable warnings&amp;#039;),&lt;br /&gt;
     )&lt;br /&gt;
     annotation_rows = (&lt;br /&gt;
         (&amp;#039;bits&amp;#039;, &amp;#039;Bits&amp;#039;, (5,)),&lt;br /&gt;
         (&amp;#039;addr-data&amp;#039;, &amp;#039;Address/Data&amp;#039;, (0, 1, 2, 3, 4, 6, 7, 8, 9)),&lt;br /&gt;
         (&amp;#039;warnings&amp;#039;, &amp;#039;Warnings&amp;#039;, (10,)),&lt;br /&gt;
     )&lt;br /&gt;
 &lt;br /&gt;
     def __init__(self, **kwargs):&lt;br /&gt;
         self.state = &amp;#039;FIND START&amp;#039;&lt;br /&gt;
         # And various other variable initializations...&lt;br /&gt;
 &lt;br /&gt;
     def metadata(self, key, value):&lt;br /&gt;
         if key == srd.SRD_CONF_SAMPLERATE:&lt;br /&gt;
             self.samplerate = value&lt;br /&gt;
&lt;br /&gt;
     def reset(self):&lt;br /&gt;
         #reset inner states &lt;br /&gt;
 &lt;br /&gt;
     def start(self):&lt;br /&gt;
         self.out_ann = self.register(srd.OUTPUT_ANN)&lt;br /&gt;
 &lt;br /&gt;
     def decode(self):&lt;br /&gt;
         decode_the_sample(self.wait())&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The recommended name for the actual decoder file is &amp;#039;&amp;#039;&amp;#039;pd.py&amp;#039;&amp;#039;&amp;#039;. This file contains some meta information about the decoder, and the actual code itself, mostly in the &amp;#039;&amp;#039;&amp;#039;decode()&amp;#039;&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
If needed, large unwieldy lists or similar things can also be factored out into another *.py file (examples: [http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=tree;f=decoders/midi midi], [http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=tree;f=decoders/z80 z80]).&lt;br /&gt;
&lt;br /&gt;
== Copyright and license ==&lt;br /&gt;
&lt;br /&gt;
Every protocol decoder &amp;#039;&amp;#039;&amp;#039;must&amp;#039;&amp;#039;&amp;#039; come with source code in the form of &amp;#039;&amp;#039;&amp;#039;*.py&amp;#039;&amp;#039;&amp;#039; files. No pre-compiled code should be present, Python or otherwise. The PD must not use any helpers that are not provided as source code under the same license as the PD itself.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;Decoder&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; class must have a license declaration (see above), stating the license under which all the contents in the decoder&amp;#039;s directory are provided. This is usually &amp;lt;tt&amp;gt;&amp;#039;gplv2+&amp;#039;&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;&amp;#039;gplv3+&amp;#039;&amp;lt;/tt&amp;gt;, whichever you prefer. In either case, the decoder license must be compatible with the [[libsigrokdecode]] license (which is &amp;quot;GPL, version 3 or later&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;tt&amp;gt;channels&amp;lt;/tt&amp;gt; &amp;amp; &amp;lt;tt&amp;gt;optional_channels&amp;lt;/tt&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The following excerpt from the [[Protocol_decoder:spi|SPI]] PD shows how to use &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;channels&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;optional_channels&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;. To decode SPI, the clock signal is always needed, the chip-select signal is optional and only used when provided. To give the user the flexibility to provide only one of the MOSI/MISO signals, they are both also defined as optional:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 class Decoder(srd.Decoder):&lt;br /&gt;
     ...&lt;br /&gt;
     id = &amp;#039;spi&amp;#039;&lt;br /&gt;
     ...&lt;br /&gt;
     channels = (&lt;br /&gt;
         {&amp;#039;id&amp;#039;: &amp;#039;clk&amp;#039;, &amp;#039;name&amp;#039;: &amp;#039;CLK&amp;#039;, &amp;#039;desc&amp;#039;: &amp;#039;Clock&amp;#039;},&lt;br /&gt;
     )&lt;br /&gt;
     optional_channels = (&lt;br /&gt;
         {&amp;#039;id&amp;#039;: &amp;#039;miso&amp;#039;, &amp;#039;name&amp;#039;: &amp;#039;MISO&amp;#039;, &amp;#039;desc&amp;#039;: &amp;#039;Master in, slave out&amp;#039;},&lt;br /&gt;
         {&amp;#039;id&amp;#039;: &amp;#039;mosi&amp;#039;, &amp;#039;name&amp;#039;: &amp;#039;MOSI&amp;#039;, &amp;#039;desc&amp;#039;: &amp;#039;Master out, slave in&amp;#039;},&lt;br /&gt;
         {&amp;#039;id&amp;#039;: &amp;#039;cs&amp;#039;, &amp;#039;name&amp;#039;: &amp;#039;CS#&amp;#039;, &amp;#039;desc&amp;#039;: &amp;#039;Chip-select&amp;#039;},&lt;br /&gt;
     )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;data&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;, the argument of the decoder&amp;#039;s [[Protocol decoder API#decode-function|&amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;decode()&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;]] function that contains the data to decode, is a list of tuples. These tuples contain the (absolute) number of the sample and the data at that sample. To process all samples, the SPI decoder loops over &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;data&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 def decode(self, ss, es, data):&lt;br /&gt;
     ...&lt;br /&gt;
     for (self.samplenum, pins) in data:&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;channels&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;optional_channels&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; contain in total four channels, therefore the second member of the tuple is an object of Python&amp;#039;s [https://docs.python.org/3/library/stdtypes.html#typebytes &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;bytes&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;] class containing 4 bytes, one for each channel. The decoder unpacks the bytes into the variables &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;clk&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;miso&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;mosi&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;cs&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; as shown below.&lt;br /&gt;
&lt;br /&gt;
Then, it checks for the optional channels, if their value is either 0 or 1. If it is not, that optional channel is not provided to the decoder. In the case that neither of them is supplied, an exception is raised:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 (clk, miso, mosi, cs) = pins&lt;br /&gt;
 self.have_miso = (miso in (0, 1))&lt;br /&gt;
 self.have_mosi = (mosi in (0, 1))&lt;br /&gt;
 self.have_cs = (cs in (0, 1))&lt;br /&gt;
 &lt;br /&gt;
 # Either MISO or MOSI (but not both) can be omitted.&lt;br /&gt;
 if not (self.have_miso or self.have_mosi):&lt;br /&gt;
     raise ChannelError(&amp;#039;Either MISO or MOSI (or both) pins required.&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;tt&amp;gt;annotations&amp;lt;/tt&amp;gt; &amp;amp; &amp;lt;tt&amp;gt;annotation_rows&amp;lt;/tt&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
To make the relation between the &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;annotations&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; and the &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;annotation_rows&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; members of a decoder object more clear, take a look at how the [[Protocol_decoder:Ir_nec|ir_nec]] PD uses them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 class Decoder(srd.Decoder):&lt;br /&gt;
     ...&lt;br /&gt;
     id = &amp;#039;ir_nec&amp;#039;&lt;br /&gt;
     ...&lt;br /&gt;
     annotations = (                        # Implicitly assigned annotation type ID&lt;br /&gt;
         (&amp;#039;bit&amp;#039;, &amp;#039;Bit&amp;#039;),                    # 0&lt;br /&gt;
         (&amp;#039;agc-pulse&amp;#039;, &amp;#039;AGC pulse&amp;#039;),        # 1&lt;br /&gt;
         (&amp;#039;longpause&amp;#039;, &amp;#039;Long pause&amp;#039;),       # 2&lt;br /&gt;
         (&amp;#039;shortpause&amp;#039;, &amp;#039;Short pause&amp;#039;),     # 3&lt;br /&gt;
         (&amp;#039;stop-bit&amp;#039;, &amp;#039;Stop bit&amp;#039;),          # 4&lt;br /&gt;
         (&amp;#039;leader-code&amp;#039;, &amp;#039;Leader code&amp;#039;),    # 5&lt;br /&gt;
         (&amp;#039;addr&amp;#039;, &amp;#039;Address&amp;#039;),               # 6&lt;br /&gt;
         (&amp;#039;addr-inv&amp;#039;, &amp;#039;Address#&amp;#039;),          # 7&lt;br /&gt;
         (&amp;#039;cmd&amp;#039;, &amp;#039;Command&amp;#039;),                # 8&lt;br /&gt;
         (&amp;#039;cmd-inv&amp;#039;, &amp;#039;Command#&amp;#039;),           # 9&lt;br /&gt;
         (&amp;#039;repeat-code&amp;#039;, &amp;#039;Repeat code&amp;#039;),    # 10&lt;br /&gt;
         (&amp;#039;remote&amp;#039;, &amp;#039;Remote&amp;#039;),              # 11&lt;br /&gt;
         (&amp;#039;warnings&amp;#039;, &amp;#039;Warnings&amp;#039;),          # 12&lt;br /&gt;
     )&lt;br /&gt;
     annotation_rows = (&lt;br /&gt;
         (&amp;#039;bits&amp;#039;, &amp;#039;Bits&amp;#039;, (0, 1, 2, 3, 4)),&lt;br /&gt;
         (&amp;#039;fields&amp;#039;, &amp;#039;Fields&amp;#039;, (5, 6, 7, 8, 9, 10)),&lt;br /&gt;
         (&amp;#039;remote&amp;#039;, &amp;#039;Remote&amp;#039;, (11,)),&lt;br /&gt;
         (&amp;#039;warnings&amp;#039;, &amp;#039;Warnings&amp;#039;, (12,)),&lt;br /&gt;
     )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It groups the first five annotation types together into the &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;bits&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; row and the next six into the &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;fields&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; row. The rows &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;remote&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;warnings&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; both only contain one annotation type.&lt;br /&gt;
&lt;br /&gt;
Without &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;annotation_rows&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;, [[PulseView]] would have to put each annotation type in its own row (which is unhandy if the decoder has many annotations) or it would have to put them all on the same row (which would result in unreadable output due to overlaps). But because of the &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;annotation_rows&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;, the output of the [[Protocol_decoder:Ir_nec|ir_nec]] decoder is grouped together as shown in the following picture (note how different annotation types, distinguishable by their different colors, share the same row):&lt;br /&gt;
&lt;br /&gt;
[[File:Pv example ir nec cropped.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, as you can imagine, handling numeric IDs is quite bothersome - especially if they change and all affected IDs have to be changed throughout the PD. To avoid this, you can use a pseudo-enum:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 ann_bit, ann_agc_pulse, ann_long_pause, ann_short_pause, ann_stop_bit, ann_leader_code, ann_addr, ann_addr_inv, ann_cmd, ann_cmd_inv, ann_repeat_code, ann_remote, ann_warning = range(13)&lt;br /&gt;
&lt;br /&gt;
 class Decoder(srd.Decoder):&lt;br /&gt;
     ...&lt;br /&gt;
     id = &amp;#039;ir_nec&amp;#039;&lt;br /&gt;
     ...&lt;br /&gt;
     annotations = (                        # Implicitly assigned annotation type ID&lt;br /&gt;
         (&amp;#039;bit&amp;#039;, &amp;#039;Bit&amp;#039;),                    # 0  = ann_bit&lt;br /&gt;
         (&amp;#039;agc-pulse&amp;#039;, &amp;#039;AGC pulse&amp;#039;),        # 1  = ann_agc_pulse&lt;br /&gt;
         (&amp;#039;longpause&amp;#039;, &amp;#039;Long pause&amp;#039;),       # 2  = ann_long_pause&lt;br /&gt;
         (&amp;#039;shortpause&amp;#039;, &amp;#039;Short pause&amp;#039;),     # 3  = ann_short_pause&lt;br /&gt;
         (&amp;#039;stop-bit&amp;#039;, &amp;#039;Stop bit&amp;#039;),          # 4  = ann_stop_bit&lt;br /&gt;
         (&amp;#039;leader-code&amp;#039;, &amp;#039;Leader code&amp;#039;),    # 5  = ann_leader_code&lt;br /&gt;
         (&amp;#039;addr&amp;#039;, &amp;#039;Address&amp;#039;),               # 6  = ann_addr&lt;br /&gt;
         (&amp;#039;addr-inv&amp;#039;, &amp;#039;Address#&amp;#039;),          # 7  = ann_addr_inv&lt;br /&gt;
         (&amp;#039;cmd&amp;#039;, &amp;#039;Command&amp;#039;),                # 8  = ann_cmd&lt;br /&gt;
         (&amp;#039;cmd-inv&amp;#039;, &amp;#039;Command#&amp;#039;),           # 9  = ann_cmd_inv&lt;br /&gt;
         (&amp;#039;repeat-code&amp;#039;, &amp;#039;Repeat code&amp;#039;),    # 10 = ann_repeat_code&lt;br /&gt;
         (&amp;#039;remote&amp;#039;, &amp;#039;Remote&amp;#039;),              # 11 = ann_remote&lt;br /&gt;
         (&amp;#039;warnings&amp;#039;, &amp;#039;Warnings&amp;#039;),          # 12 = ann_warning&lt;br /&gt;
     )&lt;br /&gt;
     annotation_rows = (&lt;br /&gt;
         (&amp;#039;bits&amp;#039;, &amp;#039;Bits&amp;#039;, (ann_bit, ann_agc_pulse, ann_long_pause, ann_short_pause, ann_stop_bit)),&lt;br /&gt;
         (&amp;#039;fields&amp;#039;, &amp;#039;Fields&amp;#039;, (ann_leader_code, ann_addr, ann_addr_inv, ann_cmd, ann_cmd_inv, ann_repeat_code)),&lt;br /&gt;
         (&amp;#039;remote&amp;#039;, &amp;#039;Remote&amp;#039;, (ann_remote,)),&lt;br /&gt;
         (&amp;#039;warnings&amp;#039;, &amp;#039;Warnings&amp;#039;, (ann_warning,)),&lt;br /&gt;
     )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This way, all you need to ensure is that the order of the enum entries is the same as in the annotations array and you&amp;#039;re set. There is one downside, though, as always: pseudo-enums are pitifully slow in python, so if you use them and you use them in a lot of places, your protocol decoder may be significantly slower (up to 4x has been observed), so choose wisely. You can use the PD test facility to compare, using e.g. &amp;#039;time ./pdtest -r $YOUR_PD&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== Random notes, tips and tricks ==&lt;br /&gt;
&lt;br /&gt;
* You should usually only use &amp;#039;&amp;#039;&amp;#039;raise&amp;#039;&amp;#039;&amp;#039; in a protocol decoder to raise exceptions in cases which are a clear bug in how the protocol decoder is invoked (e.g. if no samplerate was provided for a PD which needs the samplerate, or if some of the required channels were not provided by the user, and so on).&lt;br /&gt;
* Use the &amp;lt;code&amp;gt;has_channel()&amp;lt;/code&amp;gt; method to check whether an optional channel has been provided or not.&lt;br /&gt;
* A simple and fast way to calculate a parity (i.e., count the number of 1 bits) over a number (0x55 in this example) is:&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 ones = bin(0x55).count(&amp;#039;1&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
* A simple function to convert a BCD number (max. 8 bits) to an integer is:&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 def bcd2int(b):&lt;br /&gt;
     return (b &amp;amp; 0x0f) + ((b &amp;gt;&amp;gt; 4) * 10)&lt;br /&gt;
&amp;lt;/source&amp;gt; This is available as &amp;lt;code&amp;gt;from common.srdhelper import bcd2int&amp;lt;/code&amp;gt;&lt;br /&gt;
* An elegant way to convert a sequence of bus pins to a numeric value:&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 from functools import reduce&lt;br /&gt;
&lt;br /&gt;
 def reduce_bus(bus):&lt;br /&gt;
     if 0xFF in bus:&lt;br /&gt;
         return None # unassigned bus channels&lt;br /&gt;
     else:&lt;br /&gt;
         return reduce(lambda a, b: (a &amp;lt;&amp;lt; 1) | b, reversed(bus))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
* A nice way to construct method names according to e.g. protocol commands is (assuming &amp;#039;&amp;#039;&amp;#039;cmd&amp;#039;&amp;#039;&amp;#039; is 8, this would call the function &amp;#039;&amp;#039;&amp;#039;self.handle_cmd_0x08&amp;#039;&amp;#039;&amp;#039;):&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 fn = getattr(self, &amp;#039;handle_cmd_0x%02x&amp;#039; % cmd);&lt;br /&gt;
 fn(arg1, arg2, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
* A cheap way to deal with Python&amp;#039;s lack of enumerations (useful for states, pin indices, annotation indices, etc.):&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 class Cycle:&lt;br /&gt;
     NONE, MEMRD, MEMWR, IORD, IOWR, FETCH, INTACK = range(7)&lt;br /&gt;
&amp;lt;/source&amp;gt;Please be aware, though, that using this mechanism may slow down your decoder significantly. It may make sense to perform some basic profiling to see if this affects you, e.g. using &amp;lt;code&amp;gt;time ./pdtest -r $YOUR_PD&amp;lt;/code&amp;gt;.&lt;br /&gt;
** A class &amp;lt;code&amp;gt;SrdIntEnum&amp;lt;/code&amp;gt; is now available from &amp;lt;code&amp;gt;common.srdhelper&amp;lt;/code&amp;gt; based on Python&amp;#039;s native [https://docs.python.org/3/library/enum.html#enum.IntEnum &amp;lt;code&amp;gt;IntEnum&amp;lt;/code&amp;gt;]&lt;br /&gt;
* &amp;lt;div id=&amp;quot;SIGROKDECODE_DIR&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;You don&amp;#039;t need to reinstall the whole [[libsigrokdecode]] project every time you make a change on your decoder. Instead, you can use the environment variable &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;SIGROKDECODE_DIR&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; to point the software to your development directory:&amp;lt;br /&amp;gt;&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;$ SIGROKDECODE_DIR=/path/to/libsigrokdecode/decoders/ sigrok-cli … -P &amp;lt;decodername&amp;gt;&amp;lt;/source&amp;gt;Because this environment variable is evaluated by the [[libsigrokdecode]] code itself, it can be used for any program that uses the library, for example when calling [[PulseView]] or the &amp;#039;&amp;#039;&amp;#039;&amp;lt;tt&amp;gt;pdtest&amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;&amp;#039; unit test utility from the [http://sigrok.org/gitweb/?p=sigrok-test.git;a=summary sigrok-test] repository.&amp;lt;br /&amp;gt;If you compiled a recent [[libsigrokdecode]] by yourself ([http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commit;h=40c6ac1d3fbded276dcbff23e8bc099896ab2fb5 newer than this commit]), you can also put decoders into your home directory, without the need for an additional environment variable. On Linux systems, this name follows the [http://standards.freedesktop.org/basedir-spec/latest/ar01s03.html XDG base directory specification], which by default resolves to &amp;lt;tt&amp;gt;~/.local/share/libsigrokdecode/decoders&amp;lt;/tt&amp;gt;. If that folder does not exist, you can simply create it and drop your decoders there, in their own subdirectory, like you would do in the libsigrokdecode source tree. On Windows systems additional decoders are read from &amp;lt;tt&amp;gt;%ProgramData%\libsigrokdecode\decoders&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* To debug the Python implementation of a decoder during development, maintenance or research either add &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt; statements at appropriate locations. Or get WinPDB and use the remote debugging feature as outlined below (add this hook somewhere in pd.py, then &amp;quot;File -&amp;gt; Attach&amp;quot; to the running process). Decoders cannot be used in &amp;quot;regular&amp;quot; debuggers since they expect a rather specific environment to execute in, for all of receiving their input as well as having their output saved or presented as well as processing samples (data types, runtime routines). Remote debugging works in both the sigrok-cli and pulseview context. Adding another &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt; statement before starting the embedded debugger can help identify the moment in time when to attach.&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 def __init__():&lt;br /&gt;
     import rpdb2&lt;br /&gt;
     rpdb2.start_embedded_debugger(&amp;quot;pd&amp;quot;)&lt;br /&gt;
     ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Windows you might want to use the following code, adapting it to your Python and WinPDB-reborn version:&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 def __init__():&lt;br /&gt;
     import sys&lt;br /&gt;
     sys.path.insert(0, &amp;#039;c:/Program Files (x86)/Python38-32/Lib/site-packages/winpdb_reborn-2.0.0.1-py3.8.egg&amp;#039;)&lt;br /&gt;
     import rpdb2&lt;br /&gt;
     rpdb2.start_embedded_debugger(&amp;quot;pd&amp;quot;, fAllowRemote=True)&lt;br /&gt;
     ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Unit tests ==&lt;br /&gt;
&lt;br /&gt;
In order to keep protocol decoders in a running state even when we make changes to a decoder or libsigrokdecode itself, we use unit tests for as many decoders as we can. These are stored in the [http://sigrok.org/gitweb/?p=sigrok-test.git sigrok-test repository]. If you want to add, modify or run one of them, clone that repository and [https://sigrok.org/gitweb/?p=sigrok-test.git;a=blob;f=README check the README] for documentation.&lt;br /&gt;
We greatly appreciate it when you submit unit tests for your decoder so we can keep it in good health!&lt;br /&gt;
&lt;br /&gt;
The following is step-by step guide.&lt;br /&gt;
&lt;br /&gt;
=== libsigrokdecode ===&lt;br /&gt;
Assuming that you have cloned the [https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=summary libsigrokdecode] repository and are ready to run some testing.&lt;br /&gt;
&lt;br /&gt;
=== Clone and build sigrok-util ===&lt;br /&gt;
Clone and build [https://sigrok.org/gitweb/?p=sigrok-util.git;a=summary sigrok-util]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ git clone git://sigrok.org/sigrok-util&lt;br /&gt;
 $ cd sigrok-util/cross-compile/linux&lt;br /&gt;
 $ ./sigrok-cross-linux&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will take a while, but should create &amp;lt;code&amp;gt;~/sr/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==== Test error ====&lt;br /&gt;
If you see following error ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 Running tests...&lt;br /&gt;
 Test project ~/devel/sigrok-util/cross-compile/linux/build/pulseview/build&lt;br /&gt;
    Start 1: test&lt;br /&gt;
 1/1 Test #1: test .............................***Failed    9.69 sec&lt;br /&gt;
 &lt;br /&gt;
 0% tests passed, 1 tests failed out of 1&lt;br /&gt;
 &lt;br /&gt;
 Total Test time (real) =   9.69 sec&lt;br /&gt;
 &lt;br /&gt;
 The following tests FAILED:&lt;br /&gt;
 	 1 - test (Failed)&lt;br /&gt;
 Errors while running CTest&lt;br /&gt;
 Output from these tests are in: ~/devel/sigrok-util/cross-compile/linux/build/pulseview/build/Testing/Temporary/LastTest.log&lt;br /&gt;
 Use &amp;quot;--rerun-failed --output-on-failure&amp;quot; to re-run the failed cases verbosely.&lt;br /&gt;
 make: *** [Makefile:91: test] Error 8&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... and the log contains only these failed tests ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 Output:&lt;br /&gt;
 ----------------------------------------------------------&lt;br /&gt;
 Running 11 test cases...&lt;br /&gt;
 ~/devel/sigrok-util/cross-compile/linux/build/pulseview/test/util.cpp(220): error: in &amp;quot;UtilTest/format_time_minutes_test&amp;quot;: check fmt(ts(12000), 0) == &amp;quot;+3:20:00&amp;quot; has failed [+3:19:60 != +3:20:00]&lt;br /&gt;
 ~/devel/sigrok-util/cross-compile/linux/build/pulseview/test/util.cpp(221): error: in &amp;quot;UtilTest/format_time_minutes_test&amp;quot;: check fmt(ts(15000), 0) == &amp;quot;+4:10:00&amp;quot; has failed [+4:09:60 != +4:10:00]&lt;br /&gt;
 &lt;br /&gt;
 *** 2 failures are detected in the test module &amp;quot;Master Test Suite&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;end of output&amp;gt;&lt;br /&gt;
 Test time =   4.43 sec&lt;br /&gt;
 ----------------------------------------------------------&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... you can ignore the error.&lt;br /&gt;
&lt;br /&gt;
=== Clone and build sigrok-dumps ===&lt;br /&gt;
Clone and build [https://sigrok.org/gitweb/?p=sigrok-dumps.git;a=summary sigrok-dumps]. This repository should be in the same location as &amp;lt;code&amp;gt;libsigrokdecode&amp;lt;/code&amp;gt; repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ git clone git://sigrok.org/sigrok-dumps&lt;br /&gt;
 $ cd sigrok-dumps&lt;br /&gt;
 $ make install&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Clone and build sigrok-test ===&lt;br /&gt;
Clone and build [https://sigrok.org/gitweb/?p=sigrok-test.git;a=summary sigrok-test].&lt;br /&gt;
&lt;br /&gt;
Do not forget to change the &amp;lt;code&amp;gt;--with-decodersdir=/path/to/decoders&amp;lt;/code&amp;gt; to point to &amp;lt;code&amp;gt;decoders&amp;lt;/code&amp;gt; directory in your cloned &amp;lt;code&amp;gt;libsigrokdecode&amp;lt;/code&amp;gt; repository.&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ git clone git://sigrok.org/sigrok-test&lt;br /&gt;
 $ cd sigrok-test&lt;br /&gt;
 $ ./autogen.sh&lt;br /&gt;
 $ PKG_CONFIG_PATH=$HOME/sr/lib/pkgconfig ./configure --with-decodersdir=/path/to/decoders&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Run tests ===&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 $ LD_LIBRARY_PATH=$HOME/sr/lib ./decoder/pdtest -r -v -a&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information see [https://sigrok.org/gitweb/?p=sigrok-test.git;a=blob_plain;f=README;hb=HEAD README.md in sigrok-test] repository.&lt;br /&gt;
&lt;br /&gt;
== Submitting your decoder ==&lt;br /&gt;
&lt;br /&gt;
When you&amp;#039;ve finished your decoder and everything is working nicely, please contribute the decoder to the sigrok project so that other people can benefit from it (and test it, improve upon it, and so on).&lt;br /&gt;
&lt;br /&gt;
* Check the decoder&amp;#039;s operation in the most recent version of the software. You expect the decoder to get accepted in the project&amp;#039;s mainline codebase. So it should work in that environment. Either build from up-to-date sources, or download nightly builds.&lt;br /&gt;
* Tell us about the location of your public git repo on the &amp;#039;&amp;#039;&amp;#039;#sigrok&amp;#039;&amp;#039;&amp;#039; IRC channel on libera.chat. As an alternative send the decoder to the [https://lists.sourceforge.net/lists/listinfo/sigrok-devel sigrok-devel] mailing list (preferrably against current master and as a full commit instead of a mere diff). Remember that pushing to a public git repo is preferred over email attachments.&lt;br /&gt;
* Please also make example data files (*.sr) including a small README available. Developers need these in order to properly review and test your decoder. Users need these to learn what the captures are about in the first place. Preferrably these files should also come as patches against the latest git master of the [http://sigrok.org/gitweb/?p=sigrok-dumps.git;a=tree sigrok-dumps] repository. See [[Example dumps]] for details. Submitting captures before any decoder materializes or work on a decoder even starts is very useful.&lt;br /&gt;
* Finally, please also consider adding a few &amp;quot;unit tests&amp;quot; for your decoder in the [http://sigrok.org/gitweb/?p=sigrok-test.git;a=tree sigrok-test] repository. These test will automatically run the decoder against various input files specified in &amp;#039;&amp;#039;&amp;#039;test.conf&amp;#039;&amp;#039;&amp;#039; and check whether the expected output is produced (examples: [http://sigrok.org/gitweb/?p=sigrok-test.git;a=blob;f=decoder/test/rfm12/test.conf rfm12], [http://sigrok.org/gitweb/?p=sigrok-test.git;a=blob;f=decoder/test/nrf24l01/test.conf nrf24l01]). This allows us to notice and fix any regressions in the decoder and/or the [[libsigrokdecode]] backend that may arise over time.&lt;br /&gt;
&lt;br /&gt;
Thanks a lot!&lt;br /&gt;
&lt;br /&gt;
[[Category:APIs]]&lt;/div&gt;</summary>
		<author><name>AtomicFS</name></author>
	</entry>
</feed>