ePanorama.net
[ index ][ back ][ site search ] [ acronyms ] [ discussion ] [ mail to a friend ] [ post message ]

ePanorama.net discussion forum archive 2001-2003

Re: Linux Mouse Device Driver


[ Follow Ups ] [ Post Followup ] [ www.epanorama.net discussion index ] [ FAQ ]

Posted by Priti (203.124.142.125) on October 17, 2002 at 04:14:20:

In Reply to: Linux Mouse Device Driver posted by shyamal on May 31, 2002 at 05:38:49:

Hi there,
If you find any solution please share it with me :-) Thanks
PSR

: Hello

: this is regarding our mouse device driver project .


:
: What are we doing, where are we:
: We are writing a device driver for a serial mouse in Linux (Kernel 2.4)
: We are writing a kernel module which will be dynamically inserted in the kernel (using insmod). We defined the file operations structure and coded the functions that our serial mouse would support.
: Initially we are trying to allocate a region to the mouse using check_region(), request-region(). Then we are registering the device as a miscellaneous device. At the time of opening the device, an interrupt routine is being registered.

: But, we are facing the following problems:

: 1. We weren't able to get the port address using the check region(), request region(). It said that the port was already busy.

: 2. The miscellaneous device also couldn't be registered.

: 3. The interrupt request also failed.

: While we were searching for solutions we came to know a few things :
: 1. There already is an existing general purpose mouse driver - the "gpm" in the kernel
: which handles the mouse. The gpm uses the link /dev/mouse which points to either "ttyS0" when it is a serial mouse or to "psaux " in case of a PS2 mouse.

: 2. In /proc/ioports we found that ttyS0 is using the address 0x3f8.
: Further, /proc/interrupts suggested that interrupt no. 4 is for handling the serial port.

: 3. When we tried to open(using cat) ttyS0 with a serial mouse attached, it showed the stream of data being read from the mouse. This data kept changing on every mouse event. The mknod command for creating the node ttyS0 it suggests that it refers to 0x3f8
: Does this imply that the port sends data to the ttyS0 stream. Instead of interacting directly with the io ports, we need to take data from ttyS0 instead of going through the check region(), request region() functions.

:
: We tried out the following options:

: 1. We killed the "gpm" and then tried to insert our module but still we got the io port busy signal.

: 2. We removed the mouse from the port, rebooted and when prompted, we removed the mouse configuration from the kernel. The link /dev/mouse was removed so the gpm wasn't loaded. Then we connected the mouse, inserted our module but again were stuck up with the same problem as above.

: 3. We are also not aware about how to read/write data to and fro from the port. Also, how to dynamically find which port the mouse is attached to and the type of mouse attached (Whether 3-button, 2-button scroll mouse etc.)




Follow Ups:



Post a Followup