Thread (5 messages) 5 messages, 2 authors, 2009-03-02

Re: Notification when a new device is added or removed

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2009-03-01 10:23:33
Subsystem: input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Dmitry Torokhov, Linus Torvalds

On Sat, Feb 28, 2009 at 06:58:05PM -0800, Alessio Sangalli wrote:
Dmitry Torokhov wrote:
quoted
You should be able to poll (select) /proc/bus/input/devices.
Yeah that would be great; anyway, I tried and... well nothing happens. I
am obviously missing something here:
Hmm, it turns out poll is completely busted. The patch below should
help.

-- 
Dmitry

Input: fix polling of /proc/bus/input/devices

Signed-off-by: Dmitry Torokhov <redacted>
---

 drivers/input/input.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 46e9ce1..913392f 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -744,11 +744,11 @@ static inline void input_wakeup_procfs_readers(void)
 
 static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait)
 {
-	int state = input_devices_state;
-
 	poll_wait(file, &input_devices_poll_wait, wait);
-	if (state != input_devices_state)
+	if (file->f_version != input_devices_state) {
+		file->f_version = input_devices_state;
 		return POLLIN | POLLRDNORM;
+	}
 
 	return 0;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help