linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Alessio Sangalli <alesan@manoweb.com>
Cc: linux-input@vger.kernel.org
Subject: Re: Notification when a new device is added or removed
Date: Sun, 1 Mar 2009 02:23:19 -0800	[thread overview]
Message-ID: <20090301022212.ZZRA012@mailhub.coreip.homeip.net> (raw)
In-Reply-To: <49A9F9BD.2090604@manoweb.com>

On Sat, Feb 28, 2009 at 06:58:05PM -0800, Alessio Sangalli wrote:
> Dmitry Torokhov wrote:
> 
> > 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 <dtor@mail.ru>
---

 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;
 }

  reply	other threads:[~2009-03-01 10:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-28  4:35 Notification when a new device is added or removed Alessio Sangalli
2009-03-01  2:39 ` Dmitry Torokhov
2009-03-01  2:58   ` Alessio Sangalli
2009-03-01 10:23     ` Dmitry Torokhov [this message]
2009-03-02 23:41       ` Alessio Sangalli
2009-03-09 12:06       ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090301022212.ZZRA012@mailhub.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=alesan@manoweb.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).