From 010be3c6cffa85ac398135b156dc7c9e6b86ec96 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 23 Sep 2017 21:38:14 +0200 Subject: Quick fix. --- src/input.c | 4 ++-- src/input.h | 1 + src/main.c | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/input.c b/src/input.c index 96fc01d..8685127 100644 --- a/src/input.c +++ b/src/input.c @@ -154,7 +154,7 @@ int relabsd_input_read libevdev_next_event ( input->dev, - (LIBEVDEV_READ_FLAG_NORMAL /*| LIBEVDEV_READ_FLAG_BLOCKING*/), + (LIBEVDEV_READ_FLAG_NORMAL | LIBEVDEV_READ_FLAG_BLOCKING), &event ); @@ -224,7 +224,7 @@ int relabsd_input_wait_for_next_event &ready_to_read, (fd_set *) NULL, (fd_set *) NULL, - &(curr_timeout) + (input->timed_out) ? NULL : &(curr_timeout) ); if (errno != 0) diff --git a/src/input.h b/src/input.h index e48b970..2e1b502 100644 --- a/src/input.h +++ b/src/input.h @@ -9,6 +9,7 @@ struct relabsd_input { struct libevdev * dev; int fd; + int timed_out; }; /* diff --git a/src/main.c b/src/main.c index 0566e77..bd5375c 100644 --- a/src/main.c +++ b/src/main.c @@ -54,7 +54,7 @@ static void handle_relative_axis_event static void convert_input ( struct relabsd_config * const conf, - const struct relabsd_input * const input, + struct relabsd_input * const input, const struct relabsd_device * const dev ) { @@ -63,6 +63,8 @@ static void convert_input RELABSD_S_DEBUG(RELABSD_DEBUG_PROGRAM_FLOW, "Handling input events..."); + input->timed_out = 1; + while (RELABSD_RUN == 1) { if (conf->enable_timeout) @@ -70,10 +72,12 @@ static void convert_input switch (relabsd_input_wait_for_next_event(input, conf)) { case 1: + input->timed_out = 0; break; case 0: relabsd_device_set_axes_to_zero(dev, conf); + input->timed_out = 1; break; case -1: -- cgit v1.2.3-70-g09d2