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...")
 
Line 5: Line 5:
== 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: 10em; text-align: left;" | Transport
| valign="top" | Serial port
!
| A string of the form <code>/dev/ttyS0</code> (POSIX) or <code>COM1</code> (Windows).
|-
|-
| valign="top" | Serial
| valign="top" | USB
| Serial communication specification, in the form:
| Either the device's VID and PID as hex digits separated by a period (<code>1d6b.0001</code>, or the bus and address separated by a period (<code>2.43</code>).
|}
 
== SR_CONF_SERIALCOMM ==
 
Serial communication specification, in the form:


<code>&lt;baudrate&gt;/&lt;databits&gt;&lt;parity&gt;&lt;stopbits&gt;</code>
<code>&lt;baudrate&gt;/&lt;databits&gt;&lt;parity&gt;&lt;stopbits&gt;</code>


Example: 9600/8n1
Example: <code>9600/8n1</code>


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


{|
{| border="0" style="width: 100%" class="alternategrey sigroktable"
|-
|-
| style="width: 5em;" | rts
| style="width: 5em;" | <code>rts</code>
| 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
| <code>dtr</code>
| 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
| <code>flow</code>
| 0
| 0
| no flow control
| no flow control
Line 42: Line 51:
| 2
| 2
| software-based (XON/XOFF) flow control
| software-based (XON/XOFF) flow control
|}

Revision as of 02:04, 12 January 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 A string of the form /dev/ttyS0 (POSIX) or COM1 (Windows).
USB Either the device's VID and PID as hex digits separated by a period (1d6b.0001, or the bus and address separated by a period (2.43).

SR_CONF_SERIALCOMM

Serial communication specification, in the form:

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

Example: 9600/8n1

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