Reputation: 623
Ok, so here's the problem: I have to write a linux kernel module that will control the mouse cursor. For example, to move the cursor around the screen to given x/y coords, send random mouse clicks, etc.
The reason why I have to write that is that I'm writing an application that uses mobile phone as a touchpad. Because it's a project for my uni, the computer-side controller has to be a linux kernel module. So, the question is, how can I control mouse behaviour from kernel module? I've googled for some time, but I didn't find anything conclusive in the depths of the 'net, sadly :(
Upvotes: 3
Views: 2540
Reputation: 184
hack in the Linux input subsystem. You can create a input module with a input_handler, and then the input file will be craeted in /sys. Then write a user program to read/write from that file in /sys
Upvotes: 0
Reputation: 70939
Poke around in the devices subsystem to see what is presenting /dev/input/mouse0.
Has any of the kernel input documentation been of much help?
Note that there are tons of libraries between the typical application and the mouse. However, since you explicitly mentioned kernel drivers, it seems safe to rule out inclusion of the X11 stack and other items built on top of it.
Upvotes: 3
Reputation:
The kernel is the wrong place for this -- the kernel is completely unaware of the existence of anything so concrete as a "mouse cursor". The input layer is about as close as it gets, and that only transfers relative mouse motion events (e.g, "someone moved the mouse an inch to the left").
Check out the XTEST X11 extension. It has a number of functions which relate directly to what you're trying to do.
http://www.xfree86.org/current/xtestlib.pdf
Upvotes: 3