libevdev  0.4
A wrapper library for evdev devices
 All Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Typedefs | Enumerations | Functions | Variables
libevdev.h File Reference
#include <linux/input.h>
#include <stdarg.h>

Go to the source code of this file.

Macros

#define LIBEVDEV_DEPRECATED
 

Typedefs

typedef void(* libevdev_log_func_t )(enum libevdev_log_priority priority, void *data, const char *file, int line, const char *func, const char *format, va_list args)
 Logging function called by library-internal logging. More...
 

Enumerations

enum  libevdev_read_flag { LIBEVDEV_READ_FLAG_SYNC, LIBEVDEV_READ_FLAG_NORMAL, LIBEVDEV_READ_FLAG_FORCE_SYNC, LIBEVDEV_READ_FLAG_BLOCKING }
 
enum  libevdev_log_priority { LIBEVDEV_LOG_ERROR, LIBEVDEV_LOG_INFO, LIBEVDEV_LOG_DEBUG }
 
enum  libevdev_grab_mode { LIBEVDEV_GRAB, LIBEVDEV_UNGRAB }
 
enum  libevdev_read_status { LIBEVDEV_READ_STATUS_SUCCESS, LIBEVDEV_READ_STATUS_SYNC }
 
enum  libevdev_led_value { LIBEVDEV_LED_ON, LIBEVDEV_LED_OFF }
 

Functions

struct libevdev * libevdev_new (void)
 Initialize a new libevdev device. More...
 
int libevdev_new_from_fd (int fd, struct libevdev **dev)
 Initialize a new libevdev device from the given fd. More...
 
void libevdev_free (struct libevdev *dev)
 Clean up and free the libevdev struct. More...
 
void libevdev_set_log_function (libevdev_log_func_t logfunc, void *data)
 Set a printf-style logging handler for library-internal logging. More...
 
void libevdev_set_log_priority (enum libevdev_log_priority priority)
 Define the minimum level to be printed to the log handler. More...
 
enum libevdev_log_priority libevdev_get_log_priority (void)
 
int libevdev_grab (struct libevdev *dev, enum libevdev_grab_mode grab)
 Grab or ungrab the device through a kernel EVIOCGRAB. More...
 
int libevdev_set_fd (struct libevdev *dev, int fd)
 Set the fd for this struct and initialize internal data. More...
 
int libevdev_change_fd (struct libevdev *dev, int fd)
 Change the fd for this device, without re-reading the actual device. More...
 
int libevdev_get_fd (const struct libevdev *dev)
 
int libevdev_next_event (struct libevdev *dev, unsigned int flags, struct input_event *ev)
 Get the next event from the device. More...
 
int libevdev_has_event_pending (struct libevdev *dev)
 Check if there are events waiting for us. More...
 
const char * libevdev_get_name (const struct libevdev *dev)
 
void libevdev_set_name (struct libevdev *dev, const char *name)
 
const char * libevdev_get_phys (const struct libevdev *dev)
 Virtual devices such as uinput devices have no phys location. More...
 
void libevdev_set_phys (struct libevdev *dev, const char *phys)
 
const char * libevdev_get_uniq (const struct libevdev *dev)
 
void libevdev_set_uniq (struct libevdev *dev, const char *uniq)
 
int libevdev_get_id_product (const struct libevdev *dev)
 
void libevdev_set_id_product (struct libevdev *dev, int product_id)
 
int libevdev_get_id_vendor (const struct libevdev *dev)
 
void libevdev_set_id_vendor (struct libevdev *dev, int vendor_id)
 
int libevdev_get_id_bustype (const struct libevdev *dev)
 
void libevdev_set_id_bustype (struct libevdev *dev, int bustype)
 
int libevdev_get_id_version (const struct libevdev *dev)
 
void libevdev_set_id_version (struct libevdev *dev, int version)
 
int libevdev_get_driver_version (const struct libevdev *dev)
 
int libevdev_has_property (const struct libevdev *dev, unsigned int prop)
 
int libevdev_enable_property (struct libevdev *dev, unsigned int prop)
 
int libevdev_has_event_type (const struct libevdev *dev, unsigned int type)
 
int libevdev_has_event_code (const struct libevdev *dev, unsigned int type, unsigned int code)
 
int libevdev_get_abs_minimum (const struct libevdev *dev, unsigned int code)
 Get the minimum axis value for the given axis, as advertised by the kernel. More...
 
int libevdev_get_abs_maximum (const struct libevdev *dev, unsigned int code)
 Get the maximum axis value for the given axis, as advertised by the kernel. More...
 
int libevdev_get_abs_fuzz (const struct libevdev *dev, unsigned int code)
 Get the axis fuzz for the given axis, as advertised by the kernel. More...
 
int libevdev_get_abs_flat (const struct libevdev *dev, unsigned int code)
 Get the axis flat for the given axis, as advertised by the kernel. More...
 
int libevdev_get_abs_resolution (const struct libevdev *dev, unsigned int code)
 Get the axis resolution for the given axis, as advertised by the kernel. More...
 
struct input_absinfo * libevdev_get_abs_info (const struct libevdev *dev, unsigned int code)
 Get the axis info for the given axis, as advertised by the kernel. More...
 
int libevdev_get_event_value (const struct libevdev *dev, unsigned int type, unsigned int code)
 Behaviour of this function is undefined if the device does not provide the event. More...
 
int libevdev_set_event_value (struct libevdev *dev, unsigned int type, unsigned int code, int value)
 Set the value for a given event type and code. More...
 
int libevdev_fetch_event_value (const struct libevdev *dev, unsigned int type, unsigned int code, int *value)
 Fetch the current value of the event type. More...
 
int libevdev_get_slot_value (const struct libevdev *dev, unsigned int slot, unsigned int code)
 Return the current value of the code for the given slot. More...
 
int libevdev_set_slot_value (struct libevdev *dev, unsigned int slot, unsigned int code, int value)
 Set the value for a given code for the given slot. More...
 
int libevdev_fetch_slot_value (const struct libevdev *dev, unsigned int slot, unsigned int code, int *value)
 Fetch the current value of the code for the given slot. More...
 
int libevdev_get_num_slots (const struct libevdev *dev)
 Get the number of slots supported by this device. More...
 
int libevdev_get_current_slot (const struct libevdev *dev)
 Get the currently active slot. More...
 
void libevdev_set_abs_minimum (struct libevdev *dev, unsigned int code, int min)
 Change the minimum for the given EV_ABS event code, if the code exists. More...
 
void libevdev_set_abs_maximum (struct libevdev *dev, unsigned int code, int max)
 Change the maximum for the given EV_ABS event code, if the code exists. More...
 
void libevdev_set_abs_fuzz (struct libevdev *dev, unsigned int code, int fuzz)
 Change the fuzz for the given EV_ABS event code, if the code exists. More...
 
void libevdev_set_abs_flat (struct libevdev *dev, unsigned int code, int flat)
 Change the flat for the given EV_ABS event code, if the code exists. More...
 
void libevdev_set_abs_resolution (struct libevdev *dev, unsigned int code, int resolution)
 Change the resolution for the given EV_ABS event code, if the code exists. More...
 
void libevdev_set_abs_info (struct libevdev *dev, unsigned int code, const struct input_absinfo *abs)
 Change the abs info for the given EV_ABS event code, if the code exists. More...
 
int libevdev_enable_event_type (struct libevdev *dev, unsigned int type)
 Forcibly enable an event type on this device, even if the underlying device does not support it. More...
 
int libevdev_disable_event_type (struct libevdev *dev, unsigned int type)
 Forcibly disable an event type on this device, even if the underlying device provides it. More...
 
int libevdev_enable_event_code (struct libevdev *dev, unsigned int type, unsigned int code, const void *data)
 Forcibly enable an event type on this device, even if the underlying device does not support it. More...
 
int libevdev_disable_event_code (struct libevdev *dev, unsigned int type, unsigned int code)
 Forcibly disable an event code on this device, even if the underlying device provides it. More...
 
int libevdev_kernel_set_abs_info (struct libevdev *dev, unsigned int code, const struct input_absinfo *abs)
 Set the device's EV_ABS axis to the value defined in the abs parameter. More...
 
int libevdev_kernel_set_led_value (struct libevdev *dev, unsigned int code, enum libevdev_led_value value)
 Turn an LED on or off. More...
 
int libevdev_kernel_set_led_values (struct libevdev *dev,...)
 Turn multiple LEDs on or off simultaneously. More...
 
int libevdev_set_clock_id (struct libevdev *dev, int clockid)
 Set the clock ID to be used for timestamps. More...
 
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_property_get_name (unsigned int prop)
 
int libevdev_event_type_get_max (unsigned int type)
 
int libevdev_get_repeat (struct libevdev *dev, int *delay, int *period)
 Get the repeat delay and repeat period values for this device. More...
 
int libevdev_kernel_set_abs_value (struct libevdev *dev, unsigned int code, const struct input_absinfo *abs) LIBEVDEV_DEPRECATED
 
void libevdev_set_log_handler (struct libevdev *dev, libevdev_log_func_t logfunc) LIBEVDEV_DEPRECATED
 
int libevdev_get_event_type_max (unsigned int type) LIBEVDEV_DEPRECATED
 replacement: libevdev_event_type_get_max More...
 
const char * libevdev_get_property_name (unsigned int prop)
 replacement: libevdev_property_get_name More...
 
const char * libevdev_get_event_type_name (unsigned int type) LIBEVDEV_DEPRECATED
 replacement: libevdev_event_type_get_name More...
 
const char * libevdev_get_event_code_name (unsigned int type, unsigned int code) LIBEVDEV_DEPRECATED
 replacement: libevdev_event_code_get_name More...
 
int libevdev_is_event_type (const struct input_event *ev, unsigned int type)
 replacement: libevdev_event_is_type More...
 
int libevdev_is_event_code (const struct input_event *ev, unsigned int type, unsigned int code)
 replacement: libevdev_event_is_code More...
 

Variables

LIBEVDEV_DEPRECATED enum
libevdev_read_flag 
LIBEVDEV_READ_SYNC
 
LIBEVDEV_DEPRECATED enum
libevdev_read_flag 
LIBEVDEV_READ_NORMAL
 
LIBEVDEV_DEPRECATED enum
libevdev_read_flag 
LIBEVDEV_FORCE_SYNC
 
LIBEVDEV_DEPRECATED enum
libevdev_read_flag 
LIBEVDEV_READ_BLOCKING
 

Macro Definition Documentation

#define LIBEVDEV_DEPRECATED

Function Documentation

const char* libevdev_get_event_code_name ( unsigned int  type,
unsigned int  code 
)

replacement: libevdev_event_code_get_name

int libevdev_get_event_type_max ( unsigned int  type)

replacement: libevdev_event_type_get_max

const char* libevdev_get_event_type_name ( unsigned int  type)

replacement: libevdev_event_type_get_name

const char* libevdev_get_property_name ( unsigned int  prop)

replacement: libevdev_property_get_name

int libevdev_is_event_code ( const struct input_event *  ev,
unsigned int  type,
unsigned int  code 
)

replacement: libevdev_event_is_code

int libevdev_is_event_type ( const struct input_event *  ev,
unsigned int  type 
)

replacement: libevdev_event_is_type

int libevdev_kernel_set_abs_value ( struct libevdev *  dev,
unsigned int  code,
const struct input_absinfo *  abs 
)
void libevdev_set_log_handler ( struct libevdev *  dev,
libevdev_log_func_t  logfunc 
)

Variable Documentation

LIBEVDEV_DEPRECATED enum libevdev_read_flag LIBEVDEV_FORCE_SYNC
LIBEVDEV_DEPRECATED enum libevdev_read_flag LIBEVDEV_READ_BLOCKING
LIBEVDEV_DEPRECATED enum libevdev_read_flag LIBEVDEV_READ_NORMAL
LIBEVDEV_DEPRECATED enum libevdev_read_flag LIBEVDEV_READ_SYNC