libevdev  0.3
A wrapper library for evdev devices
 All Files Functions Typedefs Enumerations Enumerator Macros Groups
Functions
Miscellaneous helper functions

Functions for printing or querying event ranges. More...

Functions

int libevdev_is_event_type (const struct input_event *ev, unsigned int type)
 Helper function to check if an event is of a specific type. More...
 
int libevdev_is_event_code (const struct input_event *ev, unsigned int type, unsigned int code)
 Helper function to check if an event is of a specific type and code. More...
 
const char * libevdev_get_event_type_name (unsigned int type)
 
const char * libevdev_get_event_code_name (unsigned int type, unsigned int code)
 
const char * libevdev_get_property_name (unsigned int prop)
 
int libevdev_get_event_type_max (unsigned int type)
 

Detailed Description

Functions for printing or querying event ranges.

The list of names is compiled into libevdev and will not change when the kernel changes. Adding or removing names requires a re-compilation of libevdev. Likewise, the max for each event type is compiled in and does not check the underlying kernel.

Function Documentation

const char* libevdev_get_event_code_name ( unsigned int  type,
unsigned int  code 
)
Parameters
typeThe event type for the code to query (EV_SYN, EV_REL, etc.)
codeThe event code to return the name for (e.g. ABS_X)
Returns
The name of the given event code (e.g. ABS_X) or NULL for an invalid type or code
Note
The list of names is compiled into libevdev. If the kernel adds new defines for new properties libevdev will not automatically pick these up.
int libevdev_get_event_type_max ( unsigned int  type)
Parameters
typeThe event type to return the maximum for (EV_ABS, EV_REL, etc.). No max is defined for EV_SYN.
Returns
The max value defined for the given event type, e.g. ABS_MAX for a type of EV_ABS, or -1 for an invalid type.
Note
The max value is compiled into libevdev. If the kernel changes the max value, libevdev will not automatically pick these up.
const char* libevdev_get_event_type_name ( unsigned int  type)
Parameters
typeThe event type to return the name for.
Returns
The name of the given event type (e.g. EV_ABS) or NULL for an invalid type
Note
The list of names is compiled into libevdev. If the kernel adds new defines for new properties libevdev will not automatically pick these up.
const char* libevdev_get_property_name ( unsigned int  prop)
Parameters
propThe input prop to return the name for (e.g. INPUT_PROP_BUTTONPAD)
Returns
The name of the given input prop (e.g. INPUT_PROP_BUTTONPAD) or NULL for an invalid property
Note
The list of names is compiled into libevdev. If the kernel adds new defines for new properties libevdev will not automatically pick these up.
On older kernels input properties may not be defined and libevdev_get_input_prop_name() will always return NULL
int libevdev_is_event_code ( const struct input_event *  ev,
unsigned int  type,
unsigned int  code 
)

Helper function to check if an event is of a specific type and code.

This is virtually the same as:

 ev->type == type && ev->code == code

with the exception that some sanity checks are performed to ensure type and code are valid.

Parameters
evThe input event to check
typeInput event type to compare the event against (EV_REL, EV_ABS, etc.)
codeInput event code to compare the event against (ABS_X, REL_X, etc.)
Returns
1 if the event type matches the given type and code, 0 otherwise (or if type/code are invalid)
int libevdev_is_event_type ( const struct input_event *  ev,
unsigned int  type 
)

Helper function to check if an event is of a specific type.

This is virtually the same as:

 ev->type == type

with the exception that some sanity checks are performed to ensure type is valid.

Parameters
evThe input event to check
typeInput event type to compare the event against (EV_REL, EV_ABS, etc.)
Returns
1 if the event type matches the given type, 0 otherwise (or if type is invalid)