serial: Improved docs.

This commit is contained in:
Matthias Heidbrink 2014-01-03 14:37:39 +01:00 committed by Bert Vermeulen
parent 8ae157d976
commit 48d3238e66
2 changed files with 39 additions and 7 deletions

View File

@ -51,6 +51,7 @@ The following drivers/devices do not need any firmware upload:
- agilent-dmm - agilent-dmm
- alsa - alsa
- bbcgm-m2110
- brymen-dmm - brymen-dmm
- cem-dt-885x - cem-dt-885x
- center-3xx - center-3xx
@ -58,6 +59,7 @@ The following drivers/devices do not need any firmware upload:
- colead-slm - colead-slm
- demo - demo
- fluke-dmm - fluke-dmm
- gmc-mh-1x-2x-rs232
- ikalogic-scanalogic2 - ikalogic-scanalogic2
- ikalogic-scanaplus - ikalogic-scanaplus
- kecheng-kc-330b - kecheng-kc-330b
@ -93,11 +95,13 @@ Example:
The following drivers/devices require a serial port specification: The following drivers/devices require a serial port specification:
- agilent-dmm - agilent-dmm
- bbcgm-m2110
- brymen-dmm - brymen-dmm
- cem-dt-885x - cem-dt-885x
- center-3xx - center-3xx
- colead-slm - colead-slm
- fluke-dmm - fluke-dmm
- gmc-mh-1x-2x-rs232
- link-mso19 - link-mso19
- mic-985xx - mic-985xx
- norma-dmm - norma-dmm
@ -126,6 +130,20 @@ The following drivers/devices do not require a serial port specification:
- zeroplus-logic-cube - zeroplus-logic-cube
Specifiying serial port parameters
----------------------------------
Every serial device's driver has default serial port parameters like baud
rate, number of data bits, stop bits and handshake status. If a device requires
different parameters, pass them as option "serialcomm" with the driver name.
See libsigrok, docs for function serial_set_paramstr() for complete specs.
Example:
$ sigrok-cli --driver <somedriver>:conn=<someconn>:serialcomm=9600/7n1/dtr=1
Permissions of serial port based devices Permissions of serial port based devices
---------------------------------------- ----------------------------------------
@ -264,7 +282,12 @@ unless a certain action has been performed by the user beforehand. This is
usually mentioned in the vendor manual of the respective device, but here's usually mentioned in the vendor manual of the respective device, but here's
a short list for convenience: a short list for convenience:
- bbcgm-m2110: Press button "Start/Reset" on interface panel on top.
- Digitek DT4000ZC: Briefly press the "RS232" button. - Digitek DT4000ZC: Briefly press the "RS232" button.
- gmc-mh-1x-2x-rs232: Switch on device with buttons "DATA" pressed.
Additionally Metrahit 2x devices must be configured for interface "RS232".
- norma-dmm: If the interface does not work (e.g. USB-RS232 converter), switch
on device with "FUNC" button pressed to power interface from multimeter.
- PCE PCE-DM32: Briefly press the "RS232" button. - PCE PCE-DM32: Briefly press the "RS232" button.
- RadioShack 22-812: Press and hold "SELECT" and "RANGE" together. - RadioShack 22-812: Press and hold "SELECT" and "RANGE" together.
- TekPower TP4000ZC: Briefly press the "RS232" button. - TekPower TP4000ZC: Briefly press the "RS232" button.

View File

@ -374,21 +374,30 @@ SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, int baudrate,
} }
/** /**
* Set serial parameters for the specified serial port. * Set serial parameters for the specified serial port from parameter string.
* *
* @param serial Previously initialized serial port structure. * @param serial Previously initialized serial port structure.
* @param[in] paramstr A serial communication parameters string, in the form * @param[in] paramstr A serial communication parameters string of the form
* of \<speed\>/\<data bits\>\<parity\>\<stopbits\>\<flow\>, for example * "<baudrate>/<bits><parity><stopbits>{/<option>}".\n
* "9600/8n1" or "600/7o2" or "460800/8n1/flow=2" where flow is 0 for none, * Examples: "9600/8n1", "600/7o2/dtr=1/rts=0" or "460800/8n1/flow=2".\n
* 1 for rts/cts and 2 for xon/xoff. * \<baudrate\>=integer Baud rate.\n
* * \<bits\>=5|6|7|8 Number of data bits.\n
* \<parity\>=n|e|o None, even, odd.\n
* \<stopbits\>=1|2 One or two stop bits.\n
* Options:\n
* dtr=0|1 Set DTR off resp. on.\n
* flow=0|1|2 Flow control. 0 for none, 1 for RTS/CTS, 2 for XON/XOFF.\n
* rts=0|1 Set RTS off resp. on.\n
* Please note that values and combinations of these parameters must be
* supported by the concrete serial interface hardware and the drivers for it.
* @retval SR_OK Success. * @retval SR_OK Success.
* @retval SR_ERR Failure. * @retval SR_ERR Failure.
*/ */
#define SERIAL_COMM_SPEC "^(\\d+)/([5678])([neo])([12])(.*)$"
SR_PRIV int serial_set_paramstr(struct sr_serial_dev_inst *serial, SR_PRIV int serial_set_paramstr(struct sr_serial_dev_inst *serial,
const char *paramstr) const char *paramstr)
{ {
#define SERIAL_COMM_SPEC "^(\\d+)/([5678])([neo])([12])(.*)$"
GRegex *reg; GRegex *reg;
GMatchInfo *match; GMatchInfo *match;
int speed, databits, parity, stopbits, flow, rts, dtr, i; int speed, databits, parity, stopbits, flow, rts, dtr, i;