linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hutterer <peter.hutterer@who-t.net>
To: Aniroop Mathur <aniroop.mathur@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [Question: Drivers/input/evdev.c] What is the use of write function in evdev_fops?
Date: Mon, 18 Aug 2014 11:57:59 +1000	[thread overview]
Message-ID: <20140818015759.GA13994@jelly.redhat.com> (raw)
In-Reply-To: <CADYu308JT8owRimn4i9mW4eKa3T--yjCdbGns1O9R_WWx_uF-w@mail.gmail.com>

On Fri, Aug 15, 2014 at 02:01:48AM +0530, Aniroop Mathur wrote:
[...]
> >> >>
> >> >>2 separate file descriptors like below ?
> >> >>int fd1 = open("/dev/uinput", O_RDWR);
> >> >>int fd2 = open("/dev/uinput", O_RDWR);
> >> >>
> >> >>But my reading data will still come in struct input_event as mentioned
> >> >>above.
> >> >>It has only time, type, code and value.
> >> >>So, how we can use bitmask here ?
> >> >>
> >> >>struct input_event {
> >> >>struct timeval time;
> >> >>__u16 type;
> >> >>__u16 code;
> >> >>__s32 value;
> >> >> };
> >> >
> >> > By opening 2 fds you'll end up creating 2 separate input devices with separate evdev nodes, etc, so you will not mix up input events.
> >> >
> >> > I think at this time you should just try actually using uinput and that should clear things for you.
> >> >
> >>
> >> Can you please explain what do you mean by separate evdev nodes ?
> >> Do you mean two separate evdev nodes for uinput ?
> >> But as we discussed before, there is only one node in case of uinput
> >> i.e. /dev/uinput.
> >
> > Uinput allows to creating input devices driven from userspace. You can
> > create as many separate input devices as you want by opening
> > /dev/uinput several times since it creates a device per file descriptor.
> > Each of these input devices will get evdev attached to it and will get
> > it's own /dev/input/eventX node created.
> >
> > Really, please try using uinput, it will clear a lot if things for you.
> > For example, see what http://www.freedesktop.org/wiki/Evemu/ does.
> >
> 
> 
> Thank you Mr. Torokhov for the discussion and answering my queries. :)
> I will try to explore more.

I recommend you look at libevdev if you're planning to use uinput. evemu
uses that now too and it makes a whole bunch of stuff easier and less likely
to go wrong.
http://freedesktop.org/wiki/Software/libevdev/

specifically:
http://www.freedesktop.org/software/libevdev/doc/1.2/group__uinput.html

Cheers,
   Peter


  reply	other threads:[~2014-08-18  1:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 16:46 [Question: Drivers/input/evdev.c] What is the use of write function in evdev_fops? Aniroop Mathur
2014-08-13 17:06 ` Dmitry Torokhov
2014-08-13 18:11   ` Aniroop Mathur
2014-08-13 18:58     ` Dmitry Torokhov
2014-08-13 19:10       ` Aniroop Mathur
2014-08-13 19:20         ` Dmitry Torokhov
2014-08-13 19:28           ` Aniroop Mathur
2014-08-13 19:42             ` Dmitry Torokhov
2014-08-13 20:03               ` Aniroop Mathur
2014-08-14 19:25               ` Aniroop Mathur
2014-08-14 20:19                 ` Dmitry Torokhov
2014-08-14 20:31                   ` Aniroop Mathur
2014-08-18  1:57                     ` Peter Hutterer [this message]
2014-08-18 16:04                       ` Aniroop Mathur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140818015759.GA13994@jelly.redhat.com \
    --to=peter.hutterer@who-t.net \
    --cc=aniroop.mathur@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).