From 60283fb1407fcd1de0586c960ed8d106f59483e9 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Fri, 27 Dec 2019 17:06:53 +0100 Subject: Got a clue about the pesky "SYN" messages. I must not have read libevdev's documentation well enough. Hopefully this new approach will work better. The risk would be that the conversion takes too long and properly handling all events leads to an increasing lag between the physical and the virtual device. I should probably add an option to let users indicate they would prefer dropping missed events. --- src/server/interruption.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/server/interruption.c (limited to 'src/server/interruption.c') diff --git a/src/server/interruption.c b/src/server/interruption.c new file mode 100644 index 0000000..6eb7827 --- /dev/null +++ b/src/server/interruption.c @@ -0,0 +1,23 @@ +static int RELABSD_RUN = 1; + +static void interrupt (int unused_mandatory_parameter) +{ + RELABSD_RUN = 0; + + RELABSD_S_WARNING("Interrupted, will exit at the next input device event."); +} + +static int set_signal_handlers () +{ + RELABSD_S_DEBUG(RELABSD_DEBUG_PROGRAM_FLOW, "Setting signal handlers."); + + if (signal(SIGINT, interrupt) == SIG_ERR) + { + RELABSD_S_FATAL("Unable to set the SIGINT signal handler."); + + return -1; + } + + return 0; +} + -- cgit v1.2.3-70-g09d2