Thread (14 messages) 14 messages, 3 authors, 2014-08-18

Re: [Question: Drivers/input/evdev.c] What is the use of write function in evdev_fops?

flat view

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2014-08-13 17:06:42

Hi Aniroop,

On Wed, Aug 13, 2014 at 10:16:34PM +0530, Aniroop Mathur wrote:
Dear Mr. Torokhov and Linux-Input Community,
Greetings of the day !! :)

I have not seen some good use of write function in input subsystem.
I am trying find the good uses of write function in Input subsystem,
but could not find the solution over internet.
Can you please help in answering my query below:

As you know, in evdev.c file, fops is defined as below
struct file_operations evdev_fops = {
.read           = evdev_read,
.write          = evdev_write,
...
}

So in what cases, evdev_write function is used ?
One case I can think of is that, it can be used in input device simulator
to write the recorded data back into buffer.
You are right, majority of times you are reading from the buffer. Still,
sometimes you want to control hardware state, for example, toggle keyboard LED.
That can be achieved by writing appropriate event to the event device.

For simulators I think uinput is suited the best.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help