Re: [Question: Drivers/input/evdev.c] What is the use of write function in evdev_fops?
flat view
From: Peter Hutterer <hidden>
Date: 2014-08-18 01:58:03
On Fri, Aug 15, 2014 at 02:01:48AM +0530, Aniroop Mathur wrote: [...]
quoted
quoted
quoted
quoted
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