* uinput really needs a custom sleep time?
@ 2017-01-31 2:00 Marcos Paulo de Souza
2017-01-31 2:21 ` Dmitry Torokhov
2017-02-02 22:19 ` Peter Hutterer
0 siblings, 2 replies; 7+ messages in thread
From: Marcos Paulo de Souza @ 2017-01-31 2:00 UTC (permalink / raw)
To: linux-input
Hi input guys,
after playing with uinput, it seems an sleep call is necessary before emitting new events. If this really required?
While reading code of cwiid project, another user of uinput interface, it seems this sleep time isn't necessary[1].
In the other hang, when trying to send a simple event in my desktop, an sleep is necessary, take a look in my example[2].
Another interesting fact: kernel documentation lacks of an uinput example. Do you think this would be interesting to have one?
Thanks for your time,
Marcos
[1] https://github.com/abstrakraft/cwiid/blob/master/wminput/uinput.c#L193
[2] https://github.com/marcosps/kernel_experiments/blob/master/userspace/uinput.c#L65
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: uinput really needs a custom sleep time?
2017-01-31 2:00 uinput really needs a custom sleep time? Marcos Paulo de Souza
@ 2017-01-31 2:21 ` Dmitry Torokhov
2017-02-01 1:11 ` Marcos Paulo de Souza
2017-02-02 22:19 ` Peter Hutterer
1 sibling, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2017-01-31 2:21 UTC (permalink / raw)
To: Marcos Paulo de Souza; +Cc: linux-input@vger.kernel.org
On Mon, Jan 30, 2017 at 6:00 PM, Marcos Paulo de Souza
<marcos.souza.org@gmail.com> wrote:
> Hi input guys,
>
> after playing with uinput, it seems an sleep call is necessary before emitting new events. If this really required?
>
> While reading code of cwiid project, another user of uinput interface, it seems this sleep time isn't necessary[1].
>
> In the other hang, when trying to send a simple event in my desktop, an sleep is necessary, take a look in my example[2].
The sleep is not necessary for sending events, but you need to give
time for the rest of the system to notice that there is new input
device, decide what to do with it, and open it, so that you can
actually observe the events you sent, as opposed for them to be
dropped because there are no users of that input device.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: uinput really needs a custom sleep time?
2017-01-31 2:21 ` Dmitry Torokhov
@ 2017-02-01 1:11 ` Marcos Paulo de Souza
0 siblings, 0 replies; 7+ messages in thread
From: Marcos Paulo de Souza @ 2017-02-01 1:11 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input@vger.kernel.org
On Mon, Jan 30, 2017 at 06:21:59PM -0800, Dmitry Torokhov wrote:
> On Mon, Jan 30, 2017 at 6:00 PM, Marcos Paulo de Souza
> <marcos.souza.org@gmail.com> wrote:
> > Hi input guys,
> >
> > after playing with uinput, it seems an sleep call is necessary before emitting new events. If this really required?
> >
> > While reading code of cwiid project, another user of uinput interface, it seems this sleep time isn't necessary[1].
> >
> > In the other hang, when trying to send a simple event in my desktop, an sleep is necessary, take a look in my example[2].
>
> The sleep is not necessary for sending events, but you need to give
> time for the rest of the system to notice that there is new input
> device, decide what to do with it, and open it, so that you can
> actually observe the events you sent, as opposed for them to be
> dropped because there are no users of that input device.
Makes sense to wait to the Window Manager to "discover" the new input
device and to receive the events. Thanks for the clarification!
>
> Thanks.
>
> --
> Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: uinput really needs a custom sleep time?
2017-01-31 2:00 uinput really needs a custom sleep time? Marcos Paulo de Souza
2017-01-31 2:21 ` Dmitry Torokhov
@ 2017-02-02 22:19 ` Peter Hutterer
2017-02-03 0:56 ` Marcos Paulo de Souza
2017-02-03 2:20 ` Marcos Paulo de Souza
1 sibling, 2 replies; 7+ messages in thread
From: Peter Hutterer @ 2017-02-02 22:19 UTC (permalink / raw)
To: Marcos Paulo de Souza; +Cc: linux-input
On Tue, Jan 31, 2017 at 12:00:40AM -0200, Marcos Paulo de Souza wrote:
> Hi input guys,
>
> after playing with uinput, it seems an sleep call is necessary before
> emitting new events. If this really required?
>
> While reading code of cwiid project, another user of uinput interface, it
> seems this sleep time isn't necessary[1].
>
> In the other hang, when trying to send a simple event in my desktop, an
> sleep is necessary, take a look in my example[2].
>
> Another interesting fact: kernel documentation lacks of an uinput example.
> Do you think this would be interesting to have one?
I'm obviously biased but imo you should really use libevdev for uinput
devices, it makes things a lot easier. Example is here:
https://www.freedesktop.org/software/libevdev/doc/latest/group__uinput.html
it also makes any sleep calls obsolete because it won't return until the
device node is available.
Cheers,
Peter
>
> Thanks for your time,
> Marcos
>
> [1] https://github.com/abstrakraft/cwiid/blob/master/wminput/uinput.c#L193
> [2] https://github.com/marcosps/kernel_experiments/blob/master/userspace/uinput.c#L65
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: uinput really needs a custom sleep time?
2017-02-02 22:19 ` Peter Hutterer
@ 2017-02-03 0:56 ` Marcos Paulo de Souza
2017-02-03 2:20 ` Marcos Paulo de Souza
1 sibling, 0 replies; 7+ messages in thread
From: Marcos Paulo de Souza @ 2017-02-03 0:56 UTC (permalink / raw)
To: Peter Hutterer; +Cc: linux-input
Hi Peter,
On Fri, Feb 03, 2017 at 08:19:16AM +1000, Peter Hutterer wrote:
> On Tue, Jan 31, 2017 at 12:00:40AM -0200, Marcos Paulo de Souza wrote:
> > Hi input guys,
> >
> > after playing with uinput, it seems an sleep call is necessary before
> > emitting new events. If this really required?
> >
> > While reading code of cwiid project, another user of uinput interface, it
> > seems this sleep time isn't necessary[1].
> >
> > In the other hang, when trying to send a simple event in my desktop, an
> > sleep is necessary, take a look in my example[2].
> >
> > Another interesting fact: kernel documentation lacks of an uinput example.
> > Do you think this would be interesting to have one?
>
> I'm obviously biased but imo you should really use libevdev for uinput
> devices, it makes things a lot easier. Example is here:
> https://www.freedesktop.org/software/libevdev/doc/latest/group__uinput.html
>
> it also makes any sleep calls obsolete because it won't return until the
> device node is available.
So, I had some problems to understand the relation to EV_KEY, EV_TYPE,
and other stuff to configure uinput, and reading about evdev[1], I think
I really should take a look on it.
Thanks a lot for pointing evdev as a "competitor" of uinput!
[1]
http://who-t.blogspot.com.br/2016/05/the-difference-between-uinput-and-evdev.html
>
> Cheers,
> Peter
>
> >
> > Thanks for your time,
> > Marcos
> >
> > [1] https://github.com/abstrakraft/cwiid/blob/master/wminput/uinput.c#L193
> > [2] https://github.com/marcosps/kernel_experiments/blob/master/userspace/uinput.c#L65
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-input" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: uinput really needs a custom sleep time?
2017-02-02 22:19 ` Peter Hutterer
2017-02-03 0:56 ` Marcos Paulo de Souza
@ 2017-02-03 2:20 ` Marcos Paulo de Souza
2017-02-03 2:59 ` Peter Hutterer
1 sibling, 1 reply; 7+ messages in thread
From: Marcos Paulo de Souza @ 2017-02-03 2:20 UTC (permalink / raw)
To: Peter Hutterer; +Cc: linux-input
On Fri, Feb 03, 2017 at 08:19:16AM +1000, Peter Hutterer wrote:
> On Tue, Jan 31, 2017 at 12:00:40AM -0200, Marcos Paulo de Souza wrote:
> > Hi input guys,
> >
> > after playing with uinput, it seems an sleep call is necessary before
> > emitting new events. If this really required?
> >
> > While reading code of cwiid project, another user of uinput interface, it
> > seems this sleep time isn't necessary[1].
> >
> > In the other hang, when trying to send a simple event in my desktop, an
> > sleep is necessary, take a look in my example[2].
> >
> > Another interesting fact: kernel documentation lacks of an uinput example.
> > Do you think this would be interesting to have one?
>
> I'm obviously biased but imo you should really use libevdev for uinput
> devices, it makes things a lot easier. Example is here:
> https://www.freedesktop.org/software/libevdev/doc/latest/group__uinput.html
>
> it also makes any sleep calls obsolete because it won't return until the
> device node is available.
I created another example[1], basically converting my uinput code now using
libevdev, but it doesn't work as it should...
Am I missing something, or forgetting to set some bit?
Thanks.
[1]
https://github.com/marcosps/kernel_experiments/blob/master/userspace/evdev.c
>
> Cheers,
> Peter
>
> >
> > Thanks for your time,
> > Marcos
> >
> > [1] https://github.com/abstrakraft/cwiid/blob/master/wminput/uinput.c#L193
> > [2] https://github.com/marcosps/kernel_experiments/blob/master/userspace/uinput.c#L65
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-input" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: uinput really needs a custom sleep time?
2017-02-03 2:20 ` Marcos Paulo de Souza
@ 2017-02-03 2:59 ` Peter Hutterer
0 siblings, 0 replies; 7+ messages in thread
From: Peter Hutterer @ 2017-02-03 2:59 UTC (permalink / raw)
To: Marcos Paulo de Souza; +Cc: linux-input
On Fri, Feb 03, 2017 at 12:20:19AM -0200, Marcos Paulo de Souza wrote:
> On Fri, Feb 03, 2017 at 08:19:16AM +1000, Peter Hutterer wrote:
> > On Tue, Jan 31, 2017 at 12:00:40AM -0200, Marcos Paulo de Souza wrote:
> > > Hi input guys,
> > >
> > > after playing with uinput, it seems an sleep call is necessary before
> > > emitting new events. If this really required?
> > >
> > > While reading code of cwiid project, another user of uinput interface, it
> > > seems this sleep time isn't necessary[1].
> > >
> > > In the other hang, when trying to send a simple event in my desktop, an
> > > sleep is necessary, take a look in my example[2].
> > >
> > > Another interesting fact: kernel documentation lacks of an uinput example.
> > > Do you think this would be interesting to have one?
> >
> > I'm obviously biased but imo you should really use libevdev for uinput
> > devices, it makes things a lot easier. Example is here:
> > https://www.freedesktop.org/software/libevdev/doc/latest/group__uinput.html
> >
> > it also makes any sleep calls obsolete because it won't return until the
> > device node is available.
>
> I created another example[1], basically converting my uinput code now using
> libevdev, but it doesn't work as it should...
>
> Am I missing something, or forgetting to set some bit?
you're missing a SYN_REPORT after the key down.
Cheers,
Peter
>
> Thanks.
>
> [1]
> https://github.com/marcosps/kernel_experiments/blob/master/userspace/evdev.c
>
> >
> > Cheers,
> > Peter
> >
> > >
> > > Thanks for your time,
> > > Marcos
> > >
> > > [1] https://github.com/abstrakraft/cwiid/blob/master/wminput/uinput.c#L193
> > > [2] https://github.com/marcosps/kernel_experiments/blob/master/userspace/uinput.c#L65
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-input" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > >
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-02-03 2:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31 2:00 uinput really needs a custom sleep time? Marcos Paulo de Souza
2017-01-31 2:21 ` Dmitry Torokhov
2017-02-01 1:11 ` Marcos Paulo de Souza
2017-02-02 22:19 ` Peter Hutterer
2017-02-03 0:56 ` Marcos Paulo de Souza
2017-02-03 2:20 ` Marcos Paulo de Souza
2017-02-03 2:59 ` Peter Hutterer
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).