Scroll to navigation

sergensio_baud.3(3) Library Functions Manual sergensio_baud.3(3)

NAME

sergensio_baud, sergensio_datasize, sergensio_parity, sergensio_stopbits, sergensio_flowcontrol, sergensio_iflowcontrol, sergensio_sbreak, sergensio_dtr, sergensio_rts, sergensio_signature, sergensio_linestate, sergensio_modemstate, sergensio_flowcontrol_state, sergensio_flush, sergensio_send_break - Control serial parameters on a sergensio

SYNOPSIS

#include <gensio/sergensio.h>


unsigned int val, void *cb_data);

const char *sig, unsigned int len,
void *cb_data);

sergensio_done done, void *cb_data);

sergensio_done done, void *cb_data);
#define SERGENSIO_PARITY_NONE

#define SERGENSIO_PARITY_ODD
#define SERGENSIO_PARITY_EVEN
#define SERGENSIO_PARITY_MARK
#define SERGENSIO_PARITY_SPACE

sergensio_done done, void *cb_data);

sergensio_done done, void *cb_data);
#define SERGENSIO_FLOWCONTROL_NONE

#define SERGENSIO_FLOWCONTROL_XON_XOFF
#define SERGENSIO_FLOWCONTROL_RTS_CTS

unsigned int flowcontrol,
sergensio_done done, void *cb_data);
#define SERGENSIO_FLOWCONTROL_DCD

#define SERGENSIO_FLOWCONTROL_DTR
#define SERGENSIO_FLOWCONTROL_DSR

unsigned int iflowcontrol,
sergensio_done done, void *cb_data);
#define SERGENSIO_BREAK_ON

#define SERGENSIO_BREAK_OFF

sergensio_done done, void *cb_data);
#define SERGENSIO_DTR_ON

#define SERGENSIO_DTR_OFF

sergensio_done done, void *cb_data);
#define SERGENSIO_RTS_ON

#define SERGENSIO_RTS_OFF

sergensio_done done, void *cb_data);
#define SERGENSIO_CTS_AUTO

#define SERGENSIO_CTS_OFF

sergensio_done done, void *cb_data);
#define SERGENSIO_DCD_DSR_ON

#define SERGENSIO_DCD_DSR_OFF

sergensio_done done, void *cb_data);
#define SERGENSIO_RI_ON

#define SERGENSIO_RI_OFF

sergensio_done done, void *cb_data);

const char *sig, unsigned int len,
sergensio_done_sig done, void *cb_data);
#define SERGENSIO_LINESTATE_DATA_READY

#define SERGENSIO_LINESTATE_OVERRUN_ERR
#define SERGENSIO_LINESTATE_PARITY_ERR
#define SERGENSIO_LINESTATE_FRAMING_ERR
#define SERGENSIO_LINESTATE_BREAK
#define SERGENSIO_LINESTATE_XMIT_HOLD_EMPTY
#define SERGENSIO_LINESTATE_XMIT_SHIFT_EMPTY
#define SERGENSIO_LINESTATE_TIMEOUT_ERR
#define SERGENSIO_MODEMSTATE_CTS_CHANGED

#define SERGENSIO_MODEMSTATE_DSR_CHANGED
#define SERGENSIO_MODEMSTATE_RI_CHANGED
#define SERGENSIO_MODEMSTATE_CD_CHANGED
#define SERGENSIO_MODEMSTATE_CTS
#define SERGENSIO_MODEMSTATE_DSR
#define SERGENSIO_MODEMSTATE_RI
#define SERGENSIO_MODEMSTATE_CD

unsigned int modemstate);
#define SERGENSIO_FLUSH_RCV_BUFFER

#define SERGENSIO_FLUSH_XMIT_BUFFER
#define SERGENSIO_FLUSH_RCV_XMIT_BUFFERS

DESCRIPTION

Handle various serial port functions.

SERIAL PORT CONTROLS

On a client sergensio, these function set various settings on the serial port. The setting is not necessariy done immediately as it may have to be sent as a message. If you supply a done function, it is called when the set operation is known to be complete. The set operation may not work (the hardware may not support it, etc.), the done function will report the current value of the setting.

If you just want the current value of the setting, you can pass in a zero to all the functions below and it will just report the value in the done function.

There are blocking function for all of these, see sergensio_b_alloc(3) for detais on those. These are all non-blocking.

system and hardware support all baud rates, check the done function to see what the baud rate was actually set to.

sergensio_send_break - Send a break signal (on for a bit then off) on the line.

On a server gensio, the above functions are used to respond to an event setting the value. Pass in the actual value. The done value is ignored on the server.

On a connection that is on the modem side of the serial port (like ipmisol), there are a different set of control commands, the above may or may not work.

Instead, use the following. Note that passing 0 to these may or may not return the current value, they may return an error.

off (tell the other end not to send d<ata).

SIGNATURE

Though not really part of serial port control, the telnet RFC2217 spec has a signature that can be used to identify the server. The sergensio_signature function fetches the signature (on the client side) or reponsed to a request for the signature (on the server side).

STATE FUNCTIONS

On the client side, the serial port state functions set the state information the user is interested in receiving. For instance, if the user wants to know about parity errors, they could set SERGENSIO_LINESTATE_OVERRUN_ERR in the linestate and they would receive linestate events with parity errors.

On the server side, these are used to report state information. The gensio itself doesn't track what the client has requested, that is up to the server code itself.

has happened on the serial line. Not all sergensios support requesting this information.
On the client side, the user should set what values they want to received with that _CHANGED values. The other values are ignored on the client side. On the server side, this is used to report current values and which values have changed to cause the report.

OTHER SERIAL PORT CONTROLS

These function do other miscellaneous functions on a serial port.

stop sending using flow control.
The length is implementation dependent.

RETURN VALUES

Zero is returned on success, or a gensio error on failure.

SEE ALSO

sergensio(5), sergensio_b_alloc(3)

AUTHOR

Corey Minyard <minyard@acm.org>

20 Jul 2020