Difference between revisions of "Driver options"

From sigrok
Jump to navigation Jump to search
(Created page with "Every libsigrok driver can take options. These relate to the driver finding and connecting to the device; once it's discovered these options are not used. The following optio...")
 
m
 
(7 intermediate revisions by 2 users not shown)
Line 3: Line 3:
The following options are available, listen by configuration key:
The following options are available, listen by configuration key:


== SR_CONF_CONN ==
=== SR_CONF_CONN ===


This option should be available in every driver, and identifies a connection string. The syntax of the string depends on the transport that driver can use to get to reach the device. Some driver can use more than one transport, for example on devices that have both a USB and serial port.
This option should be available in every driver, and identifies a connection string. The syntax of the string depends on the transport that driver can use to get to reach the device. Some drivers can use more than one transport, for example on devices that have both a USB and serial port.


Drivers must always support this option, because it allows the frontend to specify more than one device of the same type to connect to, for example two multimeters on two different serial ports.
The following syntaxes are available:
{| border="0" style="width: 100%" class="alternategrey sigroktable"
{| border="0" style="width: 100%" class="alternategrey sigroktable"
|-
| style="width: 7em; vertical-align: top;" | Serial port
| style="width: 7em; vertical-align: top;" | <code>/dev/ttyS0</code>
<code>COM1</code>
| style="vertical-align: top;" | A string representing a valid serial port on the system. This includes USB-serial adapters.
|-
| style="vertical-align: top;" | USB
| style="vertical-align: top;" | <code>1d6b.0001</code>
<code>2.43</code>
| style="vertical-align: top;" | Either the device's VID and PID as hex digits separated by a period , or the bus and address separated by a period.
|-
|-
! style="width: 10em; text-align: left;" | Transport
| style="vertical-align: top;" | VXI-11
!
| style="vertical-align: top;" | <code>vxi/scope.example.com</code>
| style="vertical-align: top;" | A device supporting VXI-11, where specifying a hostname or IP address.
|-
|-
| valign="top" | Serial
| style="vertical-align: top;" | Raw TCP port
| Serial communication specification, in the form:
| style="vertical-align: top; white-space: nowrap;" | <code>tcp-raw/scope.example.com</code>
| style="vertical-align: top;" | The device protocol over a TCP transport, without any further encapsulation.
|-
| style="vertical-align: top;" | Rigol TCP port
| style="vertical-align: top; white-space: nowrap;" | <code>tcp-rigol/scope.example.com</code>
| style="vertical-align: top;" | The device protocol over a TCP transport, Where the first 4 bytes are a little-endian integer representing the length of the data to follow.
|}
 
=== SR_CONF_SERIALCOMM ===
 
Serial communication specification, in the form:
 
<b><code>&lt;baudrate&gt;/&lt;databits&gt;&lt;parity&gt;&lt;stopbits&gt;</code></b>


<code>&lt;baudrate&gt;/&lt;databits&gt;&lt;parity&gt;&lt;stopbits&gt;</code>
{| border="0" style="width: 100%" class="alternategrey sigroktable"


Example: 9600/8n1
|-
| style="width: 5em;" | <b><code>baudrate</code></b>
| style="width: 4em;" | Integer
| Baud rate


The string may also be followed by one or more special settings, in the form "/key=value". Supported keys and their allowed values are:
|-
| style="width: 5em;" | <b><code>databits</code></b>
| style="width: 4em;" | 5, 6, 7, 8
| Number of data bits


{|
|-
|-
| style="width: 5em;" | rts
| style="width: 5em;" | <b><code>parity</code></b>
| style="width: 4em;" | n, e, o
| None, even, odd.
 
|-
| style="width: 5em;" | <b><code>stopbits</code></b>
| style="width: 4em;" | 1, 2
| Number of stop bits.
 
|-
|}
 
The string may also be followed by one or more special settings, in the form <b><code>/key=value</code></b>. Supported keys and their allowed values are:
 
{| border="0" style="width: 100%" class="alternategrey sigroktable"
|-
| style="width: 5em;" | <b><code>rts</code></b>
| style="width: 4em;" | 0, 1
| style="width: 4em;" | 0, 1
| set the port's RTS pin to low or high
| set the port's RTS pin to low or high
|-
|-
| dtr
| <b><code>dtr</code></b>
| 0, 1
| 0, 1
| set the port's DTR pin to low or high
| set the port's DTR pin to low or high
|-
|-
| flow
| rowspan="3" | <b><code>flow</code></b>
| 0
| 0
| no flow control
| no flow control
|-
|-
|
| 1
| 1
| hardware-based (RTS/CTS) flow control
| Hardware-based (RTS/CTS) flow control
|-
|-
|
| 2
| 2
| software-based (XON/XOFF) flow control
| Software-based (XON/XOFF) flow control
|}
|}
Examples: <b><code>9600/8n1</code></b> , <b><code>600/7o2/dtr=1/rts=0</code></b> , <b><code>460800/8n1/flow=2</code></b> .
Please note that values and combinations of these parameters must be supported by the concrete serial interface hardware and the drivers for it. E. g. many [[Serial port#USB to serial converters|USB to serial converters]] support only 7 or 8 data bits.

Latest revision as of 17:13, 2 November 2014

Every libsigrok driver can take options. These relate to the driver finding and connecting to the device; once it's discovered these options are not used.

The following options are available, listen by configuration key:

SR_CONF_CONN

This option should be available in every driver, and identifies a connection string. The syntax of the string depends on the transport that driver can use to get to reach the device. Some drivers can use more than one transport, for example on devices that have both a USB and serial port.

Drivers must always support this option, because it allows the frontend to specify more than one device of the same type to connect to, for example two multimeters on two different serial ports.

The following syntaxes are available:

Serial port /dev/ttyS0

COM1

A string representing a valid serial port on the system. This includes USB-serial adapters.
USB 1d6b.0001

2.43

Either the device's VID and PID as hex digits separated by a period , or the bus and address separated by a period.
VXI-11 vxi/scope.example.com A device supporting VXI-11, where specifying a hostname or IP address.
Raw TCP port tcp-raw/scope.example.com The device protocol over a TCP transport, without any further encapsulation.
Rigol TCP port tcp-rigol/scope.example.com The device protocol over a TCP transport, Where the first 4 bytes are a little-endian integer representing the length of the data to follow.

SR_CONF_SERIALCOMM

Serial communication specification, in the form:

<baudrate>/<databits><parity><stopbits>

baudrate Integer Baud rate
databits 5, 6, 7, 8 Number of data bits
parity n, e, o None, even, odd.
stopbits 1, 2 Number of stop bits.

The string may also be followed by one or more special settings, in the form /key=value. Supported keys and their allowed values are:

rts 0, 1 set the port's RTS pin to low or high
dtr 0, 1 set the port's DTR pin to low or high
flow 0 no flow control
1 Hardware-based (RTS/CTS) flow control
2 Software-based (XON/XOFF) flow control

Examples: 9600/8n1 , 600/7o2/dtr=1/rts=0 , 460800/8n1/flow=2 .

Please note that values and combinations of these parameters must be supported by the concrete serial interface hardware and the drivers for it. E. g. many USB to serial converters support only 7 or 8 data bits.