libevdev  0.1
A wrapper library for evdev devices
 All Files Functions Typedefs Enumerations Enumerator Groups
Functions
Event handling

Functions to handle events and fetch the current state of the event. More...

Functions

int libevdev_next_event (struct libevdev *dev, unsigned int flags, struct input_event *ev)
 Get the next event from the device. More...
 

Detailed Description

Functions to handle events and fetch the current state of the event.

Generally, libevdev updates its internal state as the event is processed and forwarded to the caller. Thus, the libevdev state of the device should always be identical to the caller's state. It may however lag behind the actual state of the device.

Function Documentation

int libevdev_next_event ( struct libevdev *  dev,
unsigned int  flags,
struct input_event *  ev 
)

Get the next event from the device.

This function operates in two different modes: normal mode or sync mode.

In normal mode, this function returns 0 and returns the event in the parameter ev. If no events are available at this time, it returns -EAGAIN and ev is undefined.

If a SYN_DROPPED is read from the device, this function returns 1. The caller should now call this function with the LIBEVDEV_READ_SYNC flag set, to get the set of events that make up the device state delta. This function returns 1 for each event part of that delta, until it returns -EAGAIN once all events have been synced.

If a device needs to be synced by the caller but the caller does not call with the LIBEVDEV_READ_SYNC flag set, all events from the diff are dropped and event processing continues as normal.

Parameters
devThe evdev device, already initialized with libevdev_set_fd()
flagsSet of flags to determine behaviour. If LIBEVDEV_READ_NORMAL is set, the next event is read in normal mode. If LIBEVDEV_READ_SYNC is set, the next event is read in sync mode.
evOn success, set to the current event.
Returns
On failure, a negative errno is returned.
Return values
0One or more events where read of the device
-EAGAINNo events are currently available on the device
1A SYN_DROPPED event was received, or a synced event was returned.
Note
This function is signal-safe.