[PATCH 2/2] input: make the Input Core be the last in the poller queue

Sascha Hauer s.hauer at pengutronix.de
Wed Mar 16 00:17:41 PDT 2016


On Mon, Mar 14, 2016 at 07:26:33PM +0300, Aleksey Kuleshov wrote:
> Genius USB keyboard can't work with interrupt msgs, only control msgs.
> Then, with control msgs if there were no report requests during ~10 secs, EHCI stack
> in Barebox reports "timeout error" infinitely until 'usb' command will be exectued
> (i.e. until EHCI halt + reset).
> 
> So:
> 
> 1) usb_kbd can detect "timeout error" (or some other error) so your patch, as for now,
> lacks status checking from idev->poll().
> 
> 2) I know this is a WIP patch, but
> 
> > +static void input_devices_poller_func(struct poller_struct *poller)
> >  {
> > - struct input_console *ic = ctx;
> > + struct input_device *idev;
> > + static uint64_t last_poll;
> > + struct input_notifier *in;
> > +
> > + if (!is_timeout(last_poll, 10 * MSECOND))
> > + return;
> 
> the last_poll var was never set and why 'is_timeout' is here if you have async_calls?

The intention was to limit input polling to every 10ms. Indeed the above
doesn't work as expected and could be better done with an async poller.

> Maybe it should be like this?:
> 
> static struct poller_async input_poller;
> static void input_devices_poller_func(void *arg)
> {
>         struct input_device *idev;
>         struct input_notifier *in;
> 
>         list_for_each_entry(idev, &input_devices, list) {
>                 idev->poll(idev);
> 
>                 if (idev->event.value && is_timeout(idev->start, idev->timeout)) {
>                         list_for_each_entry(in, &input_consumers, list)
>                                 in->notify(in, &idev->event);
>                         idev->timeout = 40 * MSECOND;
>                         idev->start = get_time_ns();
>                 }
>         }
> 
>         poller_call_async(&input_poller, 10 * MSECOND, input_devices_poller_func, NULL);
> }

Yes, looks better.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list