File format:sigrok/v2

From sigrok
Revision as of 18:36, 29 August 2014 by Uwe Hermann (talk | contribs)
Jump to navigation Jump to search

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

mimetype

Every sigrok session file must contain an (ASCII) mimetype file. This file must be the first file in the ZIP file. It must be stored uncompressed and with no "extra field".

The mimetype file must contain (only) the following string: application/vnd.sigrok.session.

This is an entry that can be used with the UNIX file(1) command's magic(4) file:

0    string   PK\003\004
>30  string   mimetype
>>38 string   application/vnd.sigrok.session

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.

metadata

This ASCII file 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).

TODO: Allow comments via # lines?

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.

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.

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

Section: global

  • sigrok version

Section: device X

  • driver
  • capturefile
  • unitsize
  • total probes
  • samplerate
  • probeX

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.

TODO: Format, contents, endianness, etc.