Skip to contentSkip to conversation

Behaviour of input-polldev?

DISCUSSION Florian Echtler 3 participants 3 messages Sep 3, 2013 HID

lore
Share & tools
lore
#0 lore raw

Hello everyone,

I'm in the process of writing an input driver for the Microsoft Pixelsense (formerly Surface 2.0). The device only has bulk endpoints and consequently needs to be polled regularly. My beta driver uses input-polldev for this, and it appears to work nicely, however, I couldn't find out how input-polldev behaves if one polling cycle takes longer than expected and a new poll would already be triggered while the first one is still running?

Thanks & BR, Florian

Signature · 1 line
SENT FROM MY DEC VT50 TERMINAL
#1 lore raw

Hi Florian

Quoted 9 lines · Florian Echtler

Hello everyone,

I'm in the process of writing an input driver for the Microsoft Pixelsense (formerly Surface 2.0). The device only has bulk endpoints and consequently needs to be polled regularly. My beta driver uses input-polldev for this, and it appears to work nicely, however, I couldn't find out how input-polldev behaves if one polling cycle takes longer than expected and a new poll would already be triggered while the first one is still running?

(CC'ing polldev author Dmitry in case I'm missing something)

input-polldev uses the system-freezable-wq. The related code is ./drivers/input/input-polldev.c:33:
queue_delayed_work(system_freezable_wq, &dev->work, delay);

Since the wq-rewrite all default workqueues are non-reentrant. That is, the new work is still scheduled but only executed after the previous worker returned (in this case, once your ->poll() callback returns).

Regards
David

#2 lore raw
Quoted 12 lines · David Herrmann

Hi Florian

Quoted 9 lines · Florian Echtler

Hello everyone,

I'm in the process of writing an input driver for the Microsoft Pixelsense (formerly Surface 2.0). The device only has bulk endpoints and consequently needs to be polled regularly. My beta driver uses input-polldev for this, and it appears to work nicely, however, I couldn't find out how input-polldev behaves if one polling cycle takes longer than expected and a new poll would already be triggered while the first one is still running?

With input-polldev new poll can not get scheduled until driver's poll() method returns:

static void input_polled_device_work(struct work_struct *work)

{
	struct input_polled_dev *dev =
		container_of(work, struct input_polled_dev, work.work);

	dev->poll(dev);
	input_polldev_queue_work(dev);
}

The expectation here is that poll function is quick and does not introduce much skew into scheduling of polls (although of course error is accumulating).

Signature · 1 line
Dmitry