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

# sergensio\_event(3)

Event handler for events from a sergensio

## NAME

sergensio\_event - Event handler for events from a sergensio

## SYNOPSIS

**#include \<gensio/sergensio.h\>**

## DESCRIPTION

When an event happens on a sergensio that is reported to the user, the gensio library calls the *gensio\_event* type handler that was registered with the gensio, just like any other event on a gensio.  See [gensio\_event(3)](/gensio_event/3.md) for details on how this happens.

This document the sergensio-specific events.  These report an unsigned integer value unless otherwise specified in the description, the **buf** parameter to the gensio\_event handler is a pointer to the unsigned integer value.

### SERIAL PORT CONTROLS

These are controls for serial port settings.  These are received on the server side only.  It should respond by setting the value (if possible and the value isn't zero) and responding with the current value with sergensio\_xxx().

GENSIO\_EVENT\_SER\_BAUD\
 GENSIO\_EVENT\_SER\_DATASIZE\
 GENSIO\_EVENT\_SER\_PARITY\
 GENSIO\_EVENT\_SER\_STOPBITS\
 GENSIO\_EVENT\_SER\_FLOWCONTROL\
 GENSIO\_EVENT\_SER\_IFLOWCONTROL\
 GENSIO\_EVENT\_SER\_SBREAK\
 GENSIO\_EVENT\_SER\_DTR\
 GENSIO\_EVENT\_SER\_RTS

### SIGNATURE

**GENSIO\_EVENT\_SER\_SIGNATURE** is received on the server side only and is a request for the signature.  The server should respond by send the signature with sergensio\_signature().  No value is passed in this case.

### STATE FUNCTIONS

GENSIO\_EVENT\_SER\_MODEMSTATE\_MASK\
 GENSIO\_EVENT\_SER\_LINESTATE\_MASK\
 These are received on the server side to request updating the mask of reported values.  The server should respond by returning the current mask with the **sergensio\_modemstate** or **sergensio\_linestate** functions.  The server need not handle all the bits requested by the user.

GENSIO\_EVENT\_SER\_MODEMSTATE\
 GENSIO\_EVENT\_SER\_LINESTATE

On the client side, these are reporting current modemstate and linestate changes as an unsigned integer.  See [sergensio\_modemstate(3)](/sergensio_modemstate/3.md) and [sergensio\_linestate(3)](/sergensio_linestate/3.md) for a meaning of the bits in the integer.

### OTHER SERIAL PORT CONTROLS

These are server-only, these are received requesting the various operations.  The server should do them, but no response is required. You may notice that break is not here, break is handled through the GENSIO\_EVENT\_SEND\_BREAK event.

GENSIO\_EVENT\_SER\_FLOW\_STATE\
 GENSIO\_EVENT\_SER\_FLUSH

### SYNC

GENSIO\_EVENT\_SER\_SYNC is a special operation that comes in when a TCP sync event is received.  It may be received on both sides.  A server should send a break.  The client can do whatever it wants with the information, that is not defined by the RFC2217 specification.

## RETURN VALUES

Return value are currently ignored for all these events, but you should return 0 on success, GE\_NOTSUP if the function isn't supported, or other gensio errors as necessary.

## SEE ALSO

[sergensio(5)](/sergensio/5.md), [gensio\_event(3)](/gensio_event/3.md), [gensio\_err(3)](/gensio_err/3.md)
