From 0c68e544b113f0493b9b80511c26c1e4584bd1e7 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Fri, 3 Jan 2020 19:59:43 +0100 Subject: ... --- include/relabsd/config/parameters.h | 22 +++++++++++++++++ include/relabsd/device/axis.h | 17 +++++++++++++ include/relabsd/device/physical_device.h | 2 +- include/relabsd/device/physical_device_types.h | 2 +- include/relabsd/device/virtual_device.h | 33 +++++++++++++++----------- include/relabsd/device/virtual_device_types.h | 6 ++--- 6 files changed, 63 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/relabsd/config/parameters.h b/include/relabsd/config/parameters.h index e1c67a4..8a5df32 100644 --- a/include/relabsd/config/parameters.h +++ b/include/relabsd/config/parameters.h @@ -1,7 +1,17 @@ #pragma once +/**** LIBEVDEV ****************************************************************/ +#include + +/**** RELABSD *****************************************************************/ #include +#include + +/******************************************************************************/ +/**** EXPORTED FUNCTIONS ******************************************************/ +/******************************************************************************/ + /**** Utility *****************************************************************/ int relabsd_parameters_parse_execution_mode ( @@ -25,6 +35,12 @@ int relabsd_parameters_argument_count_for void relabsd_parameters_print_usage (const char exec [const restrict static 1]); +int relabsd_parameters_are_compatible_with +( + const struct libevdev * const restrict libevdev/*[const restrict static 1]*/, + const struct relabsd_parameters parameters [const restrict static 1] +); + /**** Accessors ***************************************************************/ void relabsd_parameters_initialize_options ( @@ -55,3 +71,9 @@ enum relabsd_parameters_run_mode relabsd_parameters_get_execution_mode ( const struct relabsd_parameters parameters [const restrict static 1] ); + +struct relabsd_axis * relabsd_parameters_get_axis +( + const enum relabsd_axis_name i, + const struct relabsd_parameters parameters [const restrict static 1] +); diff --git a/include/relabsd/device/axis.h b/include/relabsd/device/axis.h index 815bbb8..792a1cd 100644 --- a/include/relabsd/device/axis.h +++ b/include/relabsd/device/axis.h @@ -1,7 +1,14 @@ #pragma once +/**** LIBEVDEV ****************************************************************/ +#include + +/**** RELABSD *****************************************************************/ #include +/******************************************************************************/ +/**** EXPORTED FUNCTIONS ******************************************************/ +/******************************************************************************/ /* * Gives the relabsd_axis and EV_ABS event code equivalent to an EV_REL event * code. @@ -65,3 +72,13 @@ int relabsd_axis_enable_option_from_name ); void relabsd_axis_enable (struct relabsd_axis axis [const restrict static 1]); +int relabsd_axis_is_enabled +( + const struct relabsd_axis axis [const restrict static 1] +); + +void relabsd_axis_to_absinfo +( + struct relabsd_axis axis [const restrict static 1], + struct input_absinfo absinfo [const restrict static 1] +); diff --git a/include/relabsd/device/physical_device.h b/include/relabsd/device/physical_device.h index 3e55823..910d46f 100644 --- a/include/relabsd/device/physical_device.h +++ b/include/relabsd/device/physical_device.h @@ -31,7 +31,7 @@ void relabsd_physical_device_close */ int relabsd_physical_device_read ( - const struct relabsd_physical_device device [const restrict static 1], + struct relabsd_physical_device device [const restrict static 1], unsigned int input_type [const restrict static 1], unsigned int input_code [const restrict static 1], int input_value [const restrict static 1] diff --git a/include/relabsd/device/physical_device_types.h b/include/relabsd/device/physical_device_types.h index 0c2cec7..fc15cc7 100644 --- a/include/relabsd/device/physical_device_types.h +++ b/include/relabsd/device/physical_device_types.h @@ -6,5 +6,5 @@ struct relabsd_physical_device { struct libevdev * libevdev; int file; - int timed_out; + int is_late; }; diff --git a/include/relabsd/device/virtual_device.h b/include/relabsd/device/virtual_device.h index 646422a..5ffd1c9 100644 --- a/include/relabsd/device/virtual_device.h +++ b/include/relabsd/device/virtual_device.h @@ -1,40 +1,45 @@ #pragma once +#include + #include /* * - Clones the (real) input device. * - Adds ABS event support to the clone. - * - Adds the ABS axis described in 'config' to the clone (overwriting if + * - Adds the ABS axis described in 'parameters' to the clone (overwriting if * needed). * - Disables the associated REL events from the clone. * * Returns -1 on (fatal) error, * 0 on success. * - * 'dev' does not need to be initialized, as the function will to that for you - * (on success). - * On success, 'dev' will need to be closed. + * 'device' does not need to be initialized, as the function will to that for + * you (on success). + * On success, 'device' will need to be closed. * This opens the (real) input device in read only mode to copy its properties. */ -int relabsd_device_create +int relabsd_virtual_device_create_from ( - struct relabsd_device * const dev, - const struct relabsd_config * const config + const struct relabsd_parameters parameters [const restrict static 1], + struct relabsd_virtual_device device [const restrict static 1] ); -void relabsd_device_destroy (const struct relabsd_device * const dev); +void relabsd_virtual_device_destroy +( + const struct relabsd_virtual_device device [const restrict static 1] +); /* - * Write an event to 'dev'. At this time, every event written to 'dev' is + * Write an event to 'device'. At this time, every event written to 'device' is * followed by an EV_SYN event. * * Returns 0 if both the event and the EV_SYN were successful, * -1 if either failed. */ -int relabsd_device_write_evdev_event +int relabsd_virtual_device_write_evdev_event ( - const struct relabsd_device * const dev, + const struct relabsd_virtual_device device [const restrict static 1], unsigned int const type, unsigned int const code, int const value @@ -44,8 +49,8 @@ int relabsd_device_write_evdev_event * Send an event for each enabled axis, setting it to zero. * An EV_SYN event is sent afterwards. */ -void relabsd_device_set_axes_to_zero +void relabsd_virtual_device_set_axes_to_zero ( - const struct relabsd_device * const dev, - const struct relabsd_config * const config + const struct relabsd_parameters parameters [const restrict static 1], + const struct relabsd_virtual_device device [const restrict static 1] ); diff --git a/include/relabsd/device/virtual_device_types.h b/include/relabsd/device/virtual_device_types.h index d20fafe..7c0c05a 100644 --- a/include/relabsd/device/virtual_device_types.h +++ b/include/relabsd/device/virtual_device_types.h @@ -16,8 +16,8 @@ #define RELABSD_UINPUT_OPEN_MANAGED LIBEVDEV_UINPUT_OPEN_MANAGED #endif -struct relabsd_device +struct relabsd_virtual_device { - struct libevdev * dev; - struct libevdev_uinput * uidev; + struct libevdev * libevdev; + struct libevdev_uinput * uinput_device; }; -- cgit v1.2.3-70-g09d2