libevdev
1.6.0
A wrapper library for evdev devices
|
Functions for printing or querying event ranges. More...
Functions | |
int | libevdev_event_is_type (const struct input_event *ev, unsigned int type) |
Helper function to check if an event is of a specific type. More... | |
int | libevdev_event_is_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_event_type_get_name (unsigned int type) |
const char * | libevdev_event_code_get_name (unsigned int type, unsigned int code) |
const char * | libevdev_event_value_get_name (unsigned int type, unsigned int code, int value) |
This function resolves the event value for a code. More... | |
const char * | libevdev_property_get_name (unsigned int prop) |
int | libevdev_event_type_get_max (unsigned int type) |
int | libevdev_event_type_from_name (const char *name) |
Look up an event-type by its name. More... | |
int | libevdev_event_type_from_name_n (const char *name, size_t len) |
Look up an event-type by its name. More... | |
int | libevdev_event_code_from_name (unsigned int type, const char *name) |
Look up an event code by its type and name. More... | |
int | libevdev_event_code_from_name_n (unsigned int type, const char *name, size_t len) |
Look up an event code by its type and name. More... | |
int | libevdev_event_value_from_name (unsigned int type, unsigned int code, const char *name) |
Look up an event value by its type, code and name. More... | |
int | libevdev_event_value_from_name_n (unsigned int type, unsigned int code, const char *name, size_t len) |
Look up an event value by its type, code and name. More... | |
int | libevdev_property_from_name (const char *name) |
Look up an input property by its name. More... | |
int | libevdev_property_from_name_n (const char *name, size_t len) |
Look up an input property by its name. More... | |
Functions for printing or querying event ranges.
The list of names is compiled into libevdev and is independent of the run-time kernel. Likewise, the max for each event type is compiled in and does not check the kernel at run-time.
int libevdev_event_code_from_name | ( | unsigned int | type, |
const char * | name | ||
) |
Look up an event code by its type and name.
Event codes start with a fixed prefix followed by their name (eg., "ABS_X"). The prefix must be included in the name. It returns the constant assigned to the event code or -1 if not found.
You have to pass the event type where to look for the name. For instance, to resolve "ABS_X" you need to pass EV_ABS as type and "ABS_X" as string. Supported event codes are codes starting with SYN_, KEY_, BTN_, REL_, ABS_, MSC_, SND_, SW_, LED_, REP_, FF_.
type | The event type (EV_* constant) where to look for the name. |
name | A non-NULL string describing an input-event code ("KEY_A", "ABS_X", "BTN_Y", ...), zero-terminated. |
int libevdev_event_code_from_name_n | ( | unsigned int | type, |
const char * | name, | ||
size_t | len | ||
) |
Look up an event code by its type and name.
Event codes start with a fixed prefix followed by their name (eg., "ABS_X"). The prefix must be included in the name. It returns the constant assigned to the event code or -1 if not found.
You have to pass the event type where to look for the name. For instance, to resolve "ABS_X" you need to pass EV_ABS as type and "ABS_X" as string. Supported event codes are codes starting with SYN_, KEY_, BTN_, REL_, ABS_, MSC_, SND_, SW_, LED_, REP_, FF_.
type | The event type (EV_* constant) where to look for the name. |
name | A non-NULL string describing an input-event code ("KEY_A", "ABS_X", "BTN_Y", ...). |
len | The length of the string in name excluding any terminating 0 character. |
const char* libevdev_event_code_get_name | ( | unsigned int | type, |
unsigned int | code | ||
) |
type | The event type for the code to query (EV_SYN, EV_REL, etc.) |
code | The event code to return the name for (e.g. ABS_X) |
int libevdev_event_is_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.
ev | The input event to check |
type | Input event type to compare the event against (EV_REL, EV_ABS, etc.) |
code | Input event code to compare the event against (ABS_X, REL_X, etc.) |
int libevdev_event_is_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.
ev | The input event to check |
type | Input event type to compare the event against (EV_REL, EV_ABS, etc.) |
int libevdev_event_type_from_name | ( | const char * | name | ) |
Look up an event-type by its name.
Event-types start with "EV_" followed by the name (eg., "EV_ABS"). The "EV_" prefix must be included in the name. It returns the constant assigned to the event-type or -1 if not found.
name | A non-NULL string describing an input-event type ("EV_KEY", "EV_ABS", ...), zero-terminated. |
int libevdev_event_type_from_name_n | ( | const char * | name, |
size_t | len | ||
) |
Look up an event-type by its name.
Event-types start with "EV_" followed by the name (eg., "EV_ABS"). The "EV_" prefix must be included in the name. It returns the constant assigned to the event-type or -1 if not found.
name | A non-NULL string describing an input-event type ("EV_KEY", "EV_ABS", ...). |
len | The length of the passed string excluding any terminating 0 character. |
int libevdev_event_type_get_max | ( | unsigned int | type | ) |
type | The event type to return the maximum for (EV_ABS, EV_REL, etc.). No max is defined for EV_SYN. |
const char* libevdev_event_type_get_name | ( | unsigned int | type | ) |
type | The event type to return the name for. |
int libevdev_event_value_from_name | ( | unsigned int | type, |
unsigned int | code, | ||
const char * | name | ||
) |
Look up an event value by its type, code and name.
Event values start with a fixed prefix followed by their name (eg., "MT_TOOL_PALM"). The prefix must be included in the name. It returns the constant assigned to the event code or -1 if not found.
You have to pass the event type and code where to look for the name. For instance, to resolve "MT_TOOL_PALM" you need to pass EV_ABS as type, ABS_MT_TOOL_TYPE as code and "MT_TOOL_PALM" as string.
As of kernel 4.17, only EV_ABS/ABS_MT_TOOL_TYPE support name resolution.
type | The event type (EV_* constant) where to look for the name. |
code | The event code (ABS_* constant) where to look for the name. |
name | A non-NULL string describing an input-event value ("MT_TOOL_TYPE", ...) |
int libevdev_event_value_from_name_n | ( | unsigned int | type, |
unsigned int | code, | ||
const char * | name, | ||
size_t | len | ||
) |
Look up an event value by its type, code and name.
Event values start with a fixed prefix followed by their name (eg., "MT_TOOL_PALM"). The prefix must be included in the name. It returns the constant assigned to the event code or -1 if not found.
You have to pass the event type and code where to look for the name. For instance, to resolve "MT_TOOL_PALM" you need to pass EV_ABS as type, ABS_MT_TOOL_TYPE as code and "MT_TOOL_PALM" as string.
As of kernel 4.17, only EV_ABS/ABS_MT_TOOL_TYPE support name resolution.
type | The event type (EV_* constant) where to look for the name. |
code | The event code (ABS_* constant) where to look for the name. |
name | A non-NULL string describing an input-event value ("MT_TOOL_TYPE", ...) |
len | The length of the string in name excluding any terminating 0 character. |
const char* libevdev_event_value_get_name | ( | unsigned int | type, |
unsigned int | code, | ||
int | value | ||
) |
This function resolves the event value for a code.
For almost all event codes this will return NULL as the value is just a numerical value. As of kernel 4.17, the only event code that will return a non-NULL value is EV_ABS/ABS_MT_TOOL_TYPE.
type | The event type for the value to query (EV_ABS, etc.) |
code | The event code for the value to query (e.g. ABS_MT_TOOL_TYPE) |
value | The event value to return the name for (e.g. MT_TOOL_PALM) |
int libevdev_property_from_name | ( | const char * | name | ) |
Look up an input property by its name.
Properties start with the fixed prefix "INPUT_PROP_" followed by their name (eg., "INPUT_PROP_POINTER"). The prefix must be included in the name. It returns the constant assigned to the property or -1 if not found.
name | A non-NULL string describing an input property |
int libevdev_property_from_name_n | ( | const char * | name, |
size_t | len | ||
) |
Look up an input property by its name.
Properties start with the fixed prefix "INPUT_PROP_" followed by their name (eg., "INPUT_PROP_POINTER"). The prefix must be included in the name. It returns the constant assigned to the property or -1 if not found.
name | A non-NULL string describing an input property |
len | The length of the string in name excluding any terminating 0 character. |
const char* libevdev_property_get_name | ( | unsigned int | prop | ) |
prop | The input prop to return the name for (e.g. INPUT_PROP_BUTTONPAD) |