Skip to contentSkip to conversation

Two questions regarding evdev

DISCUSSION David Härdeman 2 participants 2 messages Mar 24, 2010 HID

lore
Share & tools
lore
#0 lore raw

I've been going over the evdev (drivers/input/evdev.c) code since I'm using it as inspiration for a small project I'm hacking on. So far I have two questions with regard to the code:

First, evdev_event passes a new event to all connected clients (writing it to each client's event fifo) and then calls wake_up_interruptible. However, given that all clients will have at least one new event to read after evdev_event is done, shouldn't wake_up_interruptible_all be called instead?

Second, evdev_poll never sets the POLLOUT flag, but evdev can accept writes (which will be passed to input_inject_event), so shouldn't the POLLOUT flag always be set?

Regards,
David

#1 lore raw

Hi David,

Quoted 9 lines · David Härdeman

I've been going over the evdev (drivers/input/evdev.c) code since I'm using it as inspiration for a small project I'm hacking on. So far I have two questions with regard to the code:

First, evdev_event passes a new event to all connected clients (writing it to each client's event fifo) and then calls wake_up_interruptible. However, given that all clients will have at least one new event to read after evdev_event is done, shouldn't wake_up_interruptible_all be called instead?

wake_up() vs. wake_up_all() only matters if there is exclusive waiters which evdev does not use. PLease see comment/explanation for wake up here:

	http://lxr.linux.no/linux+v2.6.33/kernel/sched.c#L5685
Quoted 4 lines

Second, evdev_poll never sets the POLLOUT flag, but evdev can accept writes (which will be passed to input_inject_event), so shouldn't the POLLOUT flag always be set?

We could but I guess nobody tries to pull evdev for writing, everyone is interested in reading.

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html