Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > The Linux Kernel > virtual mouse driver

Forgot Password?
 The Linux Kernel   Compiling, theory, programming or other discussion about the linux kernel

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 2 Weeks Ago   #1 (permalink)
Just Joined!
 
Join Date: Apr 2009
Posts: 2
virtual mouse driver

Hi,


I've made a virtual mouse driver as part of my input driver study (essential linux drivers book). Besides the driver, there is also a user application (coord.c) that generates random coordinates and forwards these coordinates to the driver via sysfs.

I installed the driver and did run the coord user application. This resulted in the following logs :

user app. :
-3 6 0
-17 -15 0
-13 -15 0
6 12 0
-9 -1 0
2 -7 0
10 -19 0
-3 6 0
0 6 0
12 16 0
-11 8 0
-7 -9 0
2 10 0
2 -3 0
...

driver :
input: Unspecified device as /devices/virtual/input/input8
Virtual Mouse Driver Initialized.
-3 6
-17 -15
-13 -15
6 12
-9 -1
2 -7
10 -19
-3 6
0 6
12 16
-11 8
-7 -9
2 10
2 -3
...

In other words, the coordinates that are being produced by the user app. are coming through properly in the write method of my driver.

I would however expect that the mouse pointer would be jumping around also, but this is not the case... (I'm running gpm as follows : gpm -m /dev/input/event7 -t evdev )

I know that the virtual mouse driver ( input8 ) is linked to event7 by checking the following :

cat /proc/bus/input/devices
I: Bus=0019 Vendor=0000 Product=0002 Version=0000
N: Name="Power Button (FF)"
P: Phys=LNXPWRBN/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
U: Uniq=
H: Handlers=kbd event0
B: EV=3
B: KEY=100000 0 0 0

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button (CM)"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/device:00/PNP0C0C:00/input/input1
U: Uniq=
H: Handlers=kbd event1
B: EV=3
B: KEY=100000 0 0 0

I: Bus=0017 Vendor=0001 Product=0001 Version=0100
N: Name="Macintosh mouse button emulation"
P: Phys=
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=mouse0 event2
B: EV=7
B: KEY=70000 0 0 0 0 0 0 0 0
B: REL=3

I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input3
U: Uniq=
H: Handlers=kbd event3
B: EV=120013
B: KEY=4 2000000 3803078 f800d001 feffffdf ffefffff ffffffff fffffffe
B: MSC=10
B: LED=7

I: Bus=0003 Vendor=046d Product=c525 Version=0111
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:1d.0-1/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/input/input4
U: Uniq=
H: Handlers=mouse1 event4
B: EV=17
B: KEY=ffff0000 0 0 0 0 0 0 0 0
B: REL=143
B: MSC=10

I: Bus=0003 Vendor=046d Product=c525 Version=0111
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:1d.0-1/input1
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.1/input/input5
U: Uniq=
H: Handlers=kbd event5
B: EV=1f
B: KEY=837fff 2c3027 bf004444 0 0 1 f84 8a27c000 667bfa d9415fed 8e0000 0 0 0
B: REL=40
B: ABS=1 0
B: MSC=10

I: Bus=0010 Vendor=001f Product=0001 Version=0100
N: Name="PC Speaker"
P: Phys=isa0061/input0
S: Sysfs=/devices/platform/pcspkr/input/input6
U: Uniq=
H: Handlers=kbd event6
B: EV=40001
B: SND=6

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name=""
P: Phys=
S: Sysfs=/devices/virtual/input/input8
U: Uniq=
H: Handlers=event7
B: EV=5
B: REL=3

I also did check that the according input events are generated properly by inserting the evbug module. After doing this I got following log :
14 -19
evbug.c: Event. Dev: input8, Type: 2, Code: 0, Value: 14
evbug.c: Event. Dev: input8, Type: 2, Code: 1, Value: -19
evbug.c: Event. Dev: input8, Type: 0, Code: 0, Value: 0
14 6
evbug.c: Event. Dev: input8, Type: 2, Code: 0, Value: 14
evbug.c: Event. Dev: input8, Type: 2, Code: 1, Value: 6
evbug.c: Event. Dev: input8, Type: 0, Code: 0, Value: 0
8 -13
evbug.c: Event. Dev: input8, Type: 2, Code: 0, Value: 8
evbug.c: Event. Dev: input8, Type: 2, Code: 1, Value: -13
evbug.c: Event. Dev: input8, Type: 0, Code: 0, Value: 0
2 -3
evbug.c: Event. Dev: input8, Type: 2, Code: 0, Value: 2
evbug.c: Event. Dev: input8, Type: 2, Code: 1, Value: -3
evbug.c: Event. Dev: input8, Type: 0, Code: 0, Value: 0
6 2
evbug.c: Event. Dev: input8, Type: 2, Code: 0, Value: 6
evbug.c: Event. Dev: input8, Type: 2, Code: 1, Value: 2
evbug.c: Event. Dev: input8, Type: 0, Code: 0, Value: 0
12 14
evbug.c: Event. Dev: input8, Type: 2, Code: 0, Value: 12
evbug.c: Event. Dev: input8, Type: 2, Code: 1, Value: 14
evbug.c: Event. Dev: input8, Type: 0, Code: 0, Value: 0
-7 10
evbug.c: Event. Dev: input8, Type: 2, Code: 0, Value: -7
evbug.c: Event. Dev: input8, Type: 2, Code: 1, Value: 10
evbug.c: Event. Dev: input8, Type: 0, Code: 0, Value: 0
14 -9
evbug.c: Event. Dev: input8, Type: 2, Code: 0, Value: 14
evbug.c: Event. Dev: input8, Type: 2, Code: 1, Value: -9
evbug.c: Event. Dev: input8, Type: 0, Code: 0, Value: 0

So the according event is generated properly also.

I'm not familiar with gpm, but looking at the man pages, it seems that nothing more needs to be done to run gpm (besides indicating that it should react on on event7).

Does anybody have an idea why I don't see the result of the randomly generated mouse movement events???
roadster896 is offline  


Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 08:21 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2