Difference between revisions of "File format:Sigrok/v2"

From sigrok
Jump to navigation Jump to search
m
(Document current format.)
Line 9: Line 9:


== ZIP file contents ==
== ZIP file contents ==
 
<!--
=== mimetype ===
=== mimetype ===


Line 21: Line 21:
  >30  string  mimetype
  >30  string  mimetype
  >>38 string  application/vnd.sigrok.session
  >>38 string  application/vnd.sigrok.session
 
-->
=== version ===
=== version ===


This ASCII file contains the sigrok session file format version number (a single integer number). Currently this is '''1'''. It is increased every time the file format changes.
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 ===
=== metadata ===


This ASCII file contains various metadata about the sigrok session. The file format must use the usual "INI"-style syntax (see below).
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).
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).


TODO: Allow comments via '''#''' lines?
Empty lines and lines beginning with "#" are ignored.
 
TODO: Allow leading/trailing whitespace in lines?


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.
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.
Line 40: Line 38:
Section names can contain the following characters: A-Z, a-z, 0-9, <space>.
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.
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>, <underscore>.
The keys can contain the following characters: A-Z, a-z, 0-9, <space>, <minus>.


==== Section: global ====
==== Section: global ====
Line 50: Line 48:
==== Section: device ''X'' ====
==== Section: device ''X'' ====


* driver
* driver (optional)
* capturefile
* capturefile
* unitsize
* unitsize
* total probes
* total probes
* total analog
* samplerate
* samplerate
* probeX
* probe''X''
* analog''X''


=== logic-* ===
=== logic-* ===


There can be one or more binary files in the ZIP file, which contain the actual logic analyzer samples. These files have a file name of '''logic-1''', '''logic-2''', and so on.
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).


TODO: Format, contents, endianness, etc.
<!-- TODO: Format, contents, endianness, etc. -->

Revision as of 20:02, 31 May 2017

This page contains the sigrok session file format specification.

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).