File format:sigrok/v2

From sigrok
Jump to navigation Jump to search

This page contains the sigrok session file format specification. See File_format:Sigrok/v3 for the next version of the srzip file format, which currently is under development.

Overview

The sigrok session file is a standard ZIP file with certain contents and some special requirements.

The recommended file extension is .sr.

ZIP file contents

version

This ASCII file (must always exist) contains the sigrok session file format version number (a single integer number). Currently this is 2. It is increased every time the file format changes.

metadata

This ASCII file (must always exist) contains various metadata about the sigrok session. The file format must use the usual "INI"-style syntax (see below).

The file must consist of lines which end with either \r or \n or \r\n or \n\r. The maximum line length is 4093 characters (not including any trailing newline and carriage return characters).

Empty lines and lines beginning with "#" are ignored.

Sections are started via lines containing only [<sectionname>] where <setionname> is the name of this specific section. No whitespace is allowed between <sectionname> and the brackets.

Section names can contain the following characters: A-Z, a-z, 0-9, <space>.

Every section can contain zero or more lines. Each line must be of the key=value format. Whitespace before and after "=" is ignored.

The keys can contain the following characters: A-Z, a-z, 0-9, <space>, <minus>.

Section: global

  • sigrok version

Section: device X

  • driver (optional)
  • capturefile
  • unitsize
  • total probes
  • total analog
  • samplerate
  • probeX
  • analogX

logic-*

There can be one or more binary files in the ZIP file, which contain logic analyzer samples. These have a name of

  • logic-1 (one large file; deprecated, but still supported), or
  • logic-1-1, logic-1-2, logic-1-3, and so on (many smaller files).

analog-*

There can be one or more binary files in the ZIP file, which contain analog samples. These have a name of

  • analog-1-<chan>-1, analog-1-<chan>-2, analog-1-<chan>-3, and so on (where <chan> is the analog channel number).