tkb1@ukc.ac.uk (T.K.Berge) (12/08/89)
As I have posted previously, I am working on a mouse-driver, and this is how I am going to implement a mouse driver. As I promisesed then, I will post a more detailed description of my mouse system. There is two major aims of my mouse system: MS-DOS mouse-library com- patibility and a hardware independent mouse system (i.e. as far as the server processed and application program is concerned) . +---------------------------+ | | | APPLICATION PROGRAM | | | +---------------------------+ | A A | | : | | : V | : +---------+ +---------+ | | | | | T T Y | | MOUSE | | | | | +---------+ +---------+ Basic description: When the mouse driver detects a change in the status of the mouse driver (ie. the mouse has moved or a button is pressed / released), a signal is sent to the application program. The application program now reads the mouse driver and updates the internal data of the mouse. If neccesary, the mouse cursor is moved. The mouse cursor movement. After my point of view, the mouse cursor is a natural part of the TTY driver. I could have implemented the mouse cursor controll as a part of the IOCNT system call, but that might lead to compatability clashes with future version of MINIX. Instead I have choosed to use the ANSI escape code. The ANSI escape code supports a "private mode" set of es- cape characters, and that is what I am using. While the compatability clashes with future development still is a problem, I regard the problem to be far less important. The mouse driver. There is three problem associated with the mouse driver: 1 - Collecting information from other device drivers. 2 - Detecting a change in the status of the mouse driver. 3 - Sending a signal to the application program. Collecting information from other device drivers. This might be seen as an odd problem, but if a mouse system has to be truly hardware independent, the mouse driver might need to collect in- formation fro other device drivers. e.g. on a multi user computer where the mouse is a part of the console. Knowing the status of the mouse. Since the application program need to be informed if there is a change in the mouse status, the mouse driver has send a signal to the ap- plication program when this change occur. Some hardware interrupts when the mouse status has changed, and in this case, there is no problem in detecting a change. However, not all hardware has the ability to do so. The only way around this problem is to check the hardware regularly, i.e. the clock driver has to send a message every x clock tick. Sending a signal to the application program. To send a signal to the application program, the mouse driver needs to know the process number of the application program. A solution is to let the file system extend the OPEN and CLOSE system call to the mouse driver. Another problem is that more than one process might open the mouse driver at the same time. Tor Kristjan Berge Electronic Engineering Laboratory The University Canterbury CT2 7NF ENGLAND
reese@xanadu.nm.paradyne.com (Don Reese) (12/11/89)
In article <2675@gos.ukc.ac.uk> tkb1@ukc.ac.uk (Tor Kristjan Berge) writes: > >Basic description: >When the mouse driver detects a change in the status of the mouse >driver (ie. the mouse has moved or a button is pressed / released), a >signal is sent to the application program. The application program now >reads the mouse driver and updates the internal data of the mouse. If >neccesary, the mouse cursor is moved. > I am not a minix programmer, though I have been a Unix programmer (since rel 3 on a PDP11/34), I have also spent a good bit of time writing code for MS/Dos and X Windows systems. I have been reading this news group on an off since it became available and should personal time become available, would like to put minix on my personal machine (AT Compatable) at home. But I am a little concerned over the use of signals to indicate mouse events. Exactly what will be considered a mouse event. Any movement of the mouse? This could generate an event for each pixel the mouse is moved (if the mickey/pixel ratio is set to one both hirizontally and vertically). Why not set up the mouse driver to store all information about the current mouse state in a simple structure. Then provide a read/write interface that allows the user to set the control part of the structure via a write and access the current mouse information with a read. Use the mouse driver to keep track of the current state of the mouse, then let the application program worry about how often the mouse status is read. How will access to the mouse driver by multiple programs be controlled?. Since Minix is a multitasking environment, you will either have to limit the driver to supporting a single open (returning a busy state to the second open) or must provide some knowlege of window geometries within the mouse driver (probably better to use single open and let the window geometry code belong to a windowing system). Where will the drawing of the mouse icon be handled? In MS/Dos, the mouse driver is responsible for the drawing and moving of the mouse icon. In this way the mouse icon provides for smooth mouse movement, even when the application can not keep up with the flow of mouse information. -- Don Reese reese@pdn.paradyne.com | Eney Meeny, Jelly Beanie, AT&T Paradyne {mtdca, uunet}!pdn!reese | the spirits are about to P.O. Box 2826 Mail Stop LG-133 | speak. - Bullwinkle Moose Largo, FL 34649-2826 Phone: (813) 530-8361