Sunday, January 18, 2009

PC mouse information

This documents tries to tell how PC mouse hardware works and how to read it at the lowest level. If you are programming under some ready made operating systems, then it would be better to use the routines supplied by the mouse driver (a good description of DOS mouse driver programming is available at ftp://x2ftp.oulu.fi/pub/msdos/programming/docs/gmouse.doc in ascii format). There is also a good tutorial Programming the Microsoft Mouse in the PC Game Programmer's Encyclopedia.

How mouse system works

Typical PC mouse controlling system has the following parts:

sensors -> mouse controller -> communication link -> data interface -> driver -> software

Sensors are the movement detectors (typically optomechanical) which sense the mouse movement and button swiches which sense the button states. Mouse controller reads the state of those sensors and takes acount of current mouse position. When this information changes the mouse controller sends a packet of data to the computer data interface controller.

The mouse driver in the computer received that data packet and decodes the information from it and does actions based on the information. Typically mouse driver has the information of the current mouse state (position and button states) and tells them to the application or operating when it asks them. Typically the mouse drive calls mouse cursor moving routines when mouse is moved and sends messages to the software when buttons are pressed.

In typical modern PC mouse driver the actual cursor movement is not linearly related to the mouse movement. This might sound a bit strange but it has been found that there are better ways to change the mouse movement to cursor muvement than just simply causing one mouse step to move the cursor one pixel. During the pioneering research done at Apple Computer in the devellopment of the graphical user interface (GUI), it became apparent that no particular ratio between mouse movement and cursor movement was best suited for all tasks.

Early work detected that there are two basic movements in the use of pointing devices: move cursor to desired area and then exactly to desired target. Those two movements have contradictory requirements, so Apple solved the problem by monitoring the mouse movements and change it's CPI (counts per inch) characteristics. When the mouse was moved slowly it remained 100 CPI and when the mouse was moved fast it appears to be 400 CPI mouse. This method of adjusting CPI based on its usage has now been adopted by the default driver in Windows 95 and is now the most commonly accepted way of translating mouse movements to cursor screen movement

No comments:

Post a Comment