summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-09-23 21:38:14 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-09-23 21:38:14 +0200
commit010be3c6cffa85ac398135b156dc7c9e6b86ec96 (patch)
treecaae742f7ea18817935efb8bc85d0de20ad82b5b
parente9b84b7e4612da198576c7b7e64e0c72674597cf (diff)
Quick fix.
-rw-r--r--src/input.c4
-rw-r--r--src/input.h1
-rw-r--r--src/main.c6
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: