Using Linux virtual mouse driver -


i trying implement virtual mouse driver according essential linux device drivers book. there user space application, generates coordinates kernel module.

see: virtual mouse driver , userspace application code , step step on how use driver.

1.) compile code of user space application , driver.

2.) next checked dmesg output , have,

input: unspecified device /class/input/input32
virtual mouse driver initialized

3.) sysfs node created during initialization (found in /sys/devices/platform/vms/coordinates)

4.) know virtual mouse driver (input32 ) linked event5 checking following:

$ cat /proc/bus/input/devices
i: bus=0000 vendor=0000 product=0000 version=0000
n: name=""
p: phys=
s: sysfs=/devices/virtual/input/input32
u: uniq=
h: handlers=event5
b: ev=5
b: rel=3

5.) next attach gpm server event interface: gpm -m /dev/input/event5 -t evdev

6.) run user space application generate random coordinates virtual mouse , observe generated coordinates using od -x /dev/input/event5.

and nothing happens. why? here author mentioned gdm should stopped, using /etc/init.d/gdm stop, "no such service" when stopping gdm.

here complete script building , runing virtual mouse:

make -c /usr/src/kernel/2.6.35.6-45.fc14.i686/ subdirs=$pwd modules gcc -o app_userspace app_userspace.c insmod app.ko gpm -m /dev/input-event5 -t evdev ./app_userspace 

makefile:

obj-m+=app.o 

kernel version: 2.6.35.6


as said before can recieve result through od, received through program echo 9 19 > /sys/devices/platform/virmouse/vmevent

gives:

time 1368284298.207654 type 2 code 0 value 9

time 1368284298.207657 type 2 code 1 value 19

time 1368284298.207662 type 0 code 0 value 0

so question is: wrong x11? stress, tried code under 2 different distributions ubuntu 11.04 , fedora 14.


maybe help: in xorg.0.log see following:

[ 21.022] (ii) no input driver/identifier specified (ignoring)

[ 272.987] (ii) config/udev: adding input device (/dev/input/event5)

[ 272.987] (ii) no input driver/identifier specified (ignoring)

[ 666.521] (ii) config/udev: adding input device (/dev/input/event5)

[ 666.521] (ii) no input driver/identifier specified (ignoring)

try replacing below lines of code in input device driver

set_bit(ev_rel, vms_input_dev->evbit); set_bit(rel_x, vms_input_dev->relbit); set_bit(rel_y, vms_input_dev->relbit); 

with

vms_input_dev->name = "virtual mouse"; vms_input_dev->phys = "vmd/input0"; // "vmd" driver's name vms_input_dev->id.bustype = bus_virtual; vms_input_dev->id.vendor  = 0x0000; vms_input_dev->id.product = 0x0000; vms_input_dev->id.version = 0x0000;  vms_input_dev->evbit[0] = bit_mask(ev_key) | bit_mask(ev_rel); vms_input_dev->keybit[bit_word(btn_mouse)] = bit_mask(btn_left) | bit_mask(btn_right) | bit_mask(btn_middle); vms_input_dev->relbit[0] = bit_mask(rel_x) | bit_mask(rel_y); vms_input_dev->keybit[bit_word(btn_mouse)] |= bit_mask(btn_side) | bit_mask(btn_extra); vms_input_dev->relbit[0] |= bit_mask(rel_wheel); 

it worked me on ubuntu 12.04


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -