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 π
So bestie, this is the sergensio_baud.3(3) page, living in the Library Functions Manual. It's literally a whole crew of functions that all hang out together and fiddle with serial port settings. Obsessed. Let's get into it. β¨
π¦ SYNOPSIS π¦
#include <gensio/sergensio.h>
typedef void (*sergensio_done)(struct sergensio *sio, int err,
unsigned int val, void *cb_data);
typedef void (*sergensio_done_sig)(struct sergensio *sio, int err,
const char *sig, unsigned int len,
void *cb_data);
int sergensio_baud(struct sergensio *sio, unsigned int baud,
sergensio_done done, void *cb_data);
int sergensio_datasize(struct sergensio *sio, unsigned int datasize,
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
int sergensio_parity(struct sergensio *sio, unsigned int parity,
sergensio_done done, void *cb_data);
int sergensio_stopbits(struct sergensio *sio, unsigned int stopbits,
sergensio_done done, void *cb_data);
#define SERGENSIO_FLOWCONTROL_NONE
#define SERGENSIO_FLOWCONTROL_XON_XOFF
#define SERGENSIO_FLOWCONTROL_RTS_CTS
int sergensio_flowcontrol(struct sergensio *sio,
unsigned int flowcontrol,
sergensio_done done, void *cb_data);
#define SERGENSIO_FLOWCONTROL_DCD
#define SERGENSIO_FLOWCONTROL_DTR
#define SERGENSIO_FLOWCONTROL_DSR
int sergensio_iflowcontrol(struct sergensio *sio,
unsigned int iflowcontrol,
sergensio_done done, void *cb_data);
#define SERGENSIO_BREAK_ON
#define SERGENSIO_BREAK_OFF
int sergensio_sbreak(struct sergensio *sio, unsigned int breakv,
sergensio_done done, void *cb_data);
int sergensio_send_break(struct sergensio *sio);
#define SERGENSIO_DTR_ON
#define SERGENSIO_DTR_OFF
int sergensio_dtr(struct sergensio *sio, unsigned int dtr,
sergensio_done done, void *cb_data);
#define SERGENSIO_RTS_ON
#define SERGENSIO_RTS_OFF
int sergensio_rts(struct sergensio *sio, unsigned int rts,
sergensio_done done, void *cb_data);
#define SERGENSIO_CTS_AUTO
#define SERGENSIO_CTS_OFF
int sergensio_cts(struct sergensio *sio, unsigned int cts,
sergensio_done done, void *cb_data);
#define SERGENSIO_DCD_DSR_ON
#define SERGENSIO_DCD_DSR_OFF
int sergensio_dcd_dsr(struct sergensio *sio, unsigned int dcd_dsr,
sergensio_done done, void *cb_data);
#define SERGENSIO_RI_ON
#define SERGENSIO_RI_OFF
int sergensio_ri(struct sergensio *sio, unsigned int ri,
sergensio_done done, void *cb_data);
int sergensio_signature(struct sergensio *sio,
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
int sergensio_linestate(struct sergensio *sio, unsigned int linestate);
#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
int sergensio_modemstate(struct sergensio *sio,
unsigned int modemstate);
int sergensio_flowcontrol_state(struct sergensio *sio, bool val);
#define SERGENSIO_FLUSH_RCV_BUFFER
#define SERGENSIO_FLUSH_XMIT_BUFFER
#define SERGENSIO_FLUSH_RCV_XMIT_BUFFERS
int sergensio_flush(struct sergensio *sio, unsigned int val);
int sergensio_send_break(struct sergensio *sio);
πΈ DESCRIPTION πΈ
Handle various serial port functions. That's the whole vibe. It's the toolbox, bestie. π§°
β¨ SERIAL PORT CONTROLS β¨
Okay so on a client sergensio, all these functions set various settings on the serial port. Important: the setting is not necessarily applied right away, because it might have to get sent as a message first. It's giving "I'll get to it." π
If you hand it a done function, that function gets called once the set operation is known to be complete. And heads up β the set operation may not work at all (the hardware might just not support it, etc.), and in that case your done function will report the current value of the setting back to you. So always check. π
If you only want the current value of a setting and don't wanna change anything? Just pass in a zero to any of the functions below and it'll just report the value through the done function. No cap, that's the whole trick. π
There are blocking functions for all of these β go read sergensio_b_alloc(3) for the details on those. The ones on this page are all non-blocking. β‘
sergensio_baudβ Set the baud rate to the integer value. Not every system and not every piece of hardware supports every baud rate, so fr fr check thedonefunction to see what the baud rate actually got set to. πsergensio_datasizeβ Set the data size;5,6,7,8are supported.sergensio_parityβ Set the parity value.sergensio_stopbitsβ Set the number of stop bits, either1or2.sergensio_flowcontrolβ Set the outgoing flow-control type.sergensio_iflowcontrolβ Set the incoming flow control type.sergensio_sbreakβ Turn on or off the break signal.sergensio_dtrβ Set the DTR value.sergensio_rtsβ Set the RTS value.sergensio_send_breakβ Send a break signal (on for a bit then off) on the line.
On a server gensio, those same functions up there are used to respond to an event that's setting the value. So you pass in the actual value. The done value is ignored on the server side. It said what it said. π€·
And on a connection that's on the modem side of the serial port (like ipmisol), there's a whole different set of control commands, and the ones above may or may not work. π
Instead, use these. And lowkey watch out: passing 0 to these may or may not return the current value β they might just return an error. π«
sergensio_ctsβ Set the CTS value to auto (managed by the hardware) or off (tell the other end not to send d<ata).sergensio_dcd_rtsβ Set the DCD and RTS value to be enabled or disabled.sergensio_riβ Set the ring indicator value to be enabled or disabled.
π SIGNATURE π
So this isn't really part of serial port control, but the telnet RFC2217 spec has a signature that can be used to identify the server. The sergensio_signature function fetches that signature (on the client side) or responds to a request for the signature (on the server side). Main character energy for a little string of bytes, honestly. π¦
β STATE FUNCTIONS β
On the client side, the serial port state functions set the state info you are 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'd receive linestate events with parity errors. Slay. π
On the server side, these are used to report state information. And ngl, the gensio itself doesn't track what the client has requested β that is up to the server code itself. So that's on you, bestie. π
sergensio_linestateβ Various information (mostly error) about what has happened on the serial line. Not all sergensios support requesting this information.sergensio_modemstateβ CTS, DSR, RI, and CD line on the serial port. On the client side, the user should set what values they want to receive with those_CHANGEDvalues. 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 functions do other miscellaneous functions on a serial port. The little side quests. π§
sergensio_flowcontrol_stateβ Tell the remote end of the serial port to stop sending using flow control.sergensio_flushβ Flush all data from buffers to the serial port.sergensio_send_breakβ Send a short break signal on the serial port. The length is implementation dependent.
π RETURN VALUES π
Zero is returned on success, or a gensio error on failure. That's it, that's the tea. β
π₯ SEE ALSO π₯
π AUTHOR π
Corey Minyard <minyard@acm.org> β thank you for your service, legend. π«Ά
okay bestie that's the whole page, mwah π This was the Library Functions Manual entry sergensio_baud.3(3), dated 20 Jul 2020 β yes she's vintage, and she still ate. π
β¨πΈ
π¦ where this page comes from
- alpine 3.22: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- alpine 3.23: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- alpine 3.24: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- debian bookworm: libgensio-dev 2.6.2-4 Β· GPL-2.0-only
- debian trixie: libgensio-dev 2.8.13-7 Β· GPL-2.0-only
- epel 9: libgensio-devel 2.8.15-1.el9 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 2.8.15-5.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 2.8.15-5.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- ubuntu noble: libgensio-dev 2.8.2-6.1build1 Β· GPL-2.0-only
- ubuntu questing: libgensio-dev 2.8.13-7
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms