|
|
8aa464b |
From 909cc5e8d1a51184259803ca66a1fc352c547e02 Mon Sep 17 00:00:00 2001
|
|
|
8aa464b |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
8aa464b |
Date: Wed, 5 Oct 2016 14:40:00 +0200
|
|
|
8aa464b |
Subject: [PATCH 3/7] inputthread: Fix inputthread not listening if a fd gets
|
|
|
8aa464b |
re-added immediately after removal
|
|
|
8aa464b |
|
|
|
8aa464b |
When a fd is removed dev->state gets set to device_state_removed,
|
|
|
8aa464b |
if the fd then gets re-added before InputThreadDoWork() deals with
|
|
|
8aa464b |
the removal, the InputThreadDevice struct gets reused, but its
|
|
|
8aa464b |
state would stay device_state_removed, so it would still get removed
|
|
|
8aa464b |
on the first InputThreadDoWork() run, resulting in a non functioning
|
|
|
8aa464b |
input device.
|
|
|
8aa464b |
|
|
|
8aa464b |
This commit fixes this by (re-)setting dev->state to device_state_running
|
|
|
8aa464b |
when a InputThreadDevice struct gets reused.
|
|
|
8aa464b |
|
|
|
8aa464b |
This fixes input devices sometimes no longer working after a vt-switch.
|
|
|
8aa464b |
|
|
|
8aa464b |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
8aa464b |
---
|
|
|
8aa464b |
os/inputthread.c | 2 ++
|
|
|
8aa464b |
1 file changed, 2 insertions(+)
|
|
|
8aa464b |
|
|
|
8aa464b |
diff --git a/os/inputthread.c b/os/inputthread.c
|
|
|
8aa464b |
index 6aa0a9c..ab1559f 100644
|
|
|
8aa464b |
--- a/os/inputthread.c
|
|
|
8aa464b |
+++ b/os/inputthread.c
|
|
|
8aa464b |
@@ -206,6 +206,8 @@ InputThreadRegisterDev(int fd,
|
|
|
8aa464b |
if (dev) {
|
|
|
8aa464b |
dev->readInputProc = readInputProc;
|
|
|
8aa464b |
dev->readInputArgs = readInputArgs;
|
|
|
8aa464b |
+ /* Override possible unhandled state == device_state_removed */
|
|
|
8aa464b |
+ dev->state = device_state_running;
|
|
|
8aa464b |
} else {
|
|
|
8aa464b |
dev = calloc(1, sizeof(InputThreadDevice));
|
|
|
8aa464b |
if (dev == NULL) {
|
|
|
8aa464b |
--
|
|
|
8aa464b |
2.9.3
|
|
|
8aa464b |
|