Virtual mouse

From Qi-Hardware
Jump to: navigation, search


[edit] Keymouse

There's a little program called keymouse that uses the uinput system to inject simulated events to keyboard / mouse devices.

This can be quite interesting in order to have a virtual mouse enabled system-wide on nn.

Its configuration is quite straightforward, we only have to include uinput in the kernel or compile it as a module (as long as mouse support).

[edit] Kernel Options

I compiled a kernel for debian with mouse and uinput support. kconfigs and uImage can be found here.

See Debian/Kernel

Relevant bits are:


but really don't sure if all this stuff is really needed :p (specially the evdev).

[edit] Compiling keymouse

wget + configure + make + make install, no mistery here. yeah, we should package this :)

[edit] Config File

If we don't know the keycodes, we can switch the dump=1 on the /etc/keymouse.cfg.

Red = 100
Fn  = 29
Alt = 56

my first testing is:

red+arrow -> move
fn+voldown -> left click
fn+volup -> right click

[edit] Launching Keymouse

First, make sure that you have uinput support (there is a /dev/input/uinput). Lauch keymouse:

 keymouse <config file> <debug level>

Debug level 4 is useful to debug stuff.

If everything goes well, you should see two new devices appearing, /dev/event2 and /dev/mouse0. This is what they look like when moving mouse down:

Keymouse output:

(DD) Moving cursor relative x: 0 y: 2
(DD) Moving cursor relative x: 0 y: 4
(DD) Moving cursor relative x: 0 y: 6
(DD) Moving cursor relative x: 0 y: 8
(DD) Moving cursor relative x: 0 y: 10
(DD) Moving cursor relative x: 0 y: 12
(DD) Moving cursor relative x: 0 y: 14

hexdump /dev/input/event2:

00001c0 3dd4 4c27 99e8 0004 0002 0001 0016 0000
00001d0 3dd4 4c27 9a26 0004 0000 0000 0000 0000
00001e0 3dd4 4c27 3642 0005 0002 0001 0018 0000
00001f0 3dd4 4c27 3680 0005 0000 0000 0000 0000
0000200 3dd4 4c27 d26a 0005 0002 0001 001a 0000
0000210 3dd4 4c27 d2aa 0005 0000 0000 0000 0000

hexdump /dev/input/mouse0:

0000110 29dc da00 0029 29d8 d600 0029 29d4 d200
0000120 0029 29d0 ce00 0029 29cc ca00 0029 29c8
0000130 c600 0029 29c4 c200 0029 29c0 be00 0029
0000140 29bc ba00 0029 29b8 b600 0029 29b4 b200
0000150 0029 29fe fc00 0029 29fa f800 0029 29f6
0000160 f400 0029 29f2 f000 0029 29ee ec00 0029
0000170 29ea e800 0029 29e6 e400 0029 29e2 e000 voila! /dev/input/mice will aggregate all of your /dev/input/mouseX. Now you can play scummvm :p or any other app (fb - X) that requires the awful rats.

[edit] References

Personal tools