Reputation: 5349
As far as I know, in Linux, inputs from hardware devices can be thought as writing data to files, so I think that it is quite possible to write something to /dev/input/mice
for simulating mouse click without using X
.
This is what I have done:
root@linux:~$ sudo cat /dev/input/mice >> right-click
(click the right button of your mouse, and then press ctrl+c to terminate it.)
root@linux:~$ sudo cat right-click >> /dev/input/mice
I did this for testing whether writing something to /dev/input/mice
can simulate mouse click or not, but obviously it failed. Any reasons?
Upvotes: 0
Views: 931
Reputation: 1168
The reasons that writing to a device fails is that the kernel mouse driver does not take bytes from the device file and send them back to the device file.
Suppose you had a serial mouse. Writing bytes to a serial port, would you expect to read those bytes back from the same serial port? Bytes written to a device file might be read by the device, they should not be expected to be readable back from the device file.
Upvotes: 1