I3MPS - Exercise 9: Input Driver

Introduction
In this exercise a virtual mouse driver will be tested and used on host and on target(devkit8000). There's also an optional part for using devkit buttons for input to drive the virtual mouse.

Virtual Mouse code files
coord.c

Makefile

vms.c

a) On host
Having a look at the input devices for the PC.

rune@ubuntu:~/Dropbox/Semester6-Dropbox/I3MPS/Exercises/Exercise9KDE/vms$ ls -l /dev/input/ total 0 drwxr-xr-x 2 root root   100 nov 27 10:09 by-id drwxr-xr-x 2 root root   160 nov 27 10:09 by-path crw-r- 1 root root 13, 64 nov 27 10:09 event0 crw-r- 1 root root 13, 65 nov 27 10:09 event1 crw-r- 1 root root 13, 74 nov 27 10:09 event10 crw-r- 1 root root 13, 75 nov 27 10:09 event11 crw-r- 1 root root 13, 66 nov 27 10:09 event2 crw-r- 1 root root 13, 67 nov 27 10:09 event3 crw-r- 1 root root 13, 68 nov 27 10:09 event4 crw-r- 1 root root 13, 69 nov 27 10:09 event5 crw-r- 1 root root 13, 70 nov 27 10:09 event6 crw-r- 1 root root 13, 71 nov 27 10:09 event7 crw-r- 1 root root 13, 72 nov 27 10:09 event8 crw-r- 1 root root 13, 73 nov 27 10:09 event9 crw-r- 1 root root 13, 63 nov 27 10:09 mice crw-r- 1 root root 13, 32 nov 27 10:09 mouse0 crw-r- 1 root root 13, 33 nov 27 10:09 mouse1 crw-r- 1 root root 13, 34 nov 27 10:09 mouse2

Inserting the compiled virtual mouse driver.

user@ubuntu:~/Dropbox/Semester6-Dropbox/I3MPS/Exercises/Exercise9KDE/vms$ sudo insmod vms.ko

Having another look at the input devices for the PC.

rune@ubuntu:~/Dropbox/Semester6-Dropbox/I3MPS/Exercises/Exercise9KDE/vms$ ls -l /dev/input/ total 0 drwxr-xr-x 2 root root   100 nov 27 10:09 by-id drwxr-xr-x 2 root root   160 nov 27 10:09 by-path crw-r- 1 root root 13, 64 nov 27 10:09 event0 crw-r- 1 root root 13, 65 nov 27 10:09 event1 crw-r- 1 root root 13, 74 nov 27 10:09 event10 crw-r- 1 root root 13, 75 nov 27 10:09 event11 crw-r- 1 root root 13, 76 nov 27 10:33 event12 crw-r- 1 root root 13, 66 nov 27 10:09 event2 crw-r- 1 root root 13, 67 nov 27 10:09 event3 crw-r- 1 root root 13, 68 nov 27 10:09 event4 crw-r- 1 root root 13, 69 nov 27 10:09 event5 crw-r- 1 root root 13, 70 nov 27 10:09 event6 crw-r- 1 root root 13, 71 nov 27 10:09 event7 crw-r- 1 root root 13, 72 nov 27 10:09 event8 crw-r- 1 root root 13, 73 nov 27 10:09 event9 crw-r- 1 root root 13, 63 nov 27 10:09 mice crw-r- 1 root root 13, 32 nov 27 10:09 mouse0 crw-r- 1 root root 13, 33 nov 27 10:09 mouse1 crw-r- 1 root root 13, 34 nov 27 10:09 mouse2 crw-r- 1 root root 13, 35 nov 27 10:33 mouse3

b) On target
The driver is now compiled for target and transferred to the devkit8000

First we have to see that the driver is inserted as a mouse when the driver is inserted into the kernel.

root@beagleboard:~# ls -l /dev/input/ drwxr-xr-x   2 root     root           120 Jan  1 00:00 by-path crw-r-   1 root     root       13,  64 Jan  1 00:00 event0 crw-r-   1 root     root       13,  65 Jan  1 00:00 event1 crw-r-   1 root     root       13,  66 Jan  1 00:00 event2 crw-r-   1 root     root       13,  67 Jan  1 00:00 event3 crw-r-   1 root     root       13,  63 Jan  1 00:00 mice crw-r-   1 root     root       13,  32 Jan  1 00:00 mouse0 lrwxrwxrwx   1 root     root             6 Jan  1 00:00 touchscreen0 -> event1 root@beagleboard:~# insmod vms.ko root@beagleboard:~# ls -l /dev/input/ drwxr-xr-x   2 root     root           120 Jan  1 00:00 by-path crw-r-   1 root     root       13,  64 Jan  1 00:00 event0 crw-r-   1 root     root       13,  65 Jan  1 00:00 event1 crw-r-   1 root     root       13,  66 Jan  1 00:00 event2 crw-r-   1 root     root       13,  67 Jan  1 00:00 event3 crw-r-   1 root     root       13,  68 Jan  1 00:07 event4 crw-r-   1 root     root       13,  63 Jan  1 00:00 mice crw-r-   1 root     root       13,  32 Jan  1 00:00 mouse0 crw-r-   1 root     root       13,  33 Jan  1 00:07 mouse1 lrwxrwxrwx   1 root     root             6 Jan  1 00:00 touchscreen0 -> event1

Then the qt program 'qt_test2' is transferred to the devkit. user@ubuntu:~/Dropbox/Semester6-Dropbox/I3MPS/Exercises/Exercise9KDE/qt_test2$ scp qt_test2 root@10.9.8.2: qt_test2                                                  100%   25KB  25.3KB/s   00:00

On the devkit the qt application has to know which inputs to expect so to get it to accept input from the virtual mouse the following is done.

root@beagleboard:~# echo $QWS_MOUSE_PROTO Tslib:/dev/input/touchscreen0 root@beagleboard:~# export QWS_MOUSE_PROTO="Tslib:/dev/input/touchscreen0 IntelliMouse:/dev/input/mouse1"

Now the qt program is run on the kit.

root@beagleboard:~# ./qt_test2 -qws Could not read calibration: "/etc/pointercal"

This brings up some graphics on the devkit screen with a mouse pointer in the middle.

From another terminal the mouse is moved by the following command, just like it was on host.

root@beagleboard:~# echo 10 10 0 > /sys/devices/platform/vms/coordinates

This moves the mouse a bit to the right and downwards.

The calibration isn't done and using the available pointing stick on the screen just makes the mousepointer disappear. No idea how to do the calibration for now, running 'ts_calibrate' doesn't seem to do anything. Might look into that later.

Source code
None.