---
name: "sergensio_send_break"
section: "3"
platform: "linux"
package: "libgensio-dev"
version: "2.8.13-7"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/sergensio_baud"
---

# sergensio\_send\_break(3)

Control serial parameters on a sergensio

Part of [sergensio\_baud(3)](/sergensio_baud/3.md).

## 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\>**

- **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.

### 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)](/sergensio_b_alloc/3.md) for detais on those.  These are all non-blocking.

- sergensio\_baud - Set the baud rate to the integer value. Not all

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

- sergensio\_datasize - Set the data size, 5, 6, 7, 8 are supported.

  - sergensio\_parity - Set the parity value

  - sergensio\_stopbits - Set the number of stop bits, either 1 or 2.

  - 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, 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.

- 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

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.

- 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 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.

- 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.

## SEE ALSO

[sergensio(5)](/sergensio/5.md), [sergensio\_b\_alloc(3)](/sergensio_b_alloc/3.md)

## AUTHOR

Corey Minyard \<minyard@acm.org\>
