[PATCH v2 libevdev 2/4] Let libevdev manage the /dev/uinput node if required

David Herrmann dh.herrmann at gmail.com
Fri Aug 16 05:36:02 PDT 2013


Hi

On Fri, Aug 16, 2013 at 8:50 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Same API as before, but if the fd is LIBEVDEV_UINPUT_OPEN_MANAGED, libevdev
> opens the uinput node itself. That value is intentionally different to -1, to avoid
> code like the below from accidentally working:
>
>         fd = open("/dev/uinput", O_RDWR); /* fails, fd is -1 */
>         libevdev_uinput_create_from_device(dev, fd, &uidev); /* may hide the error */
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Changes to v1:
> - O_CLOEXEC
> - actually do what the commit message says, and return -EBADF for neg file
>   descriptors
> - add a comment to explain -2
> - add a test for invalid create

Reviewed-by: David Herrmann <dh.herrmann at gmail.com>

Regards
David


More information about the Input-tools mailing list