From: troyer@saifr00.cfsat.honeywell.com (Dean Troyer)
Newsgroups: comp.os.linux
Subject: Re: Linux 0.97 PL 6 detecting bogus bus mice
Date: 30 Sep 92 01:53:35 GMT
Organization: Honeywell Air Transport Systems Division

I finally figured out why my PS/2-style mouse wasn't recognized by the
kernel.  I have a Compaq 386/20e and a Microsoft Serial-PS/2 compatible
mouse.

In boot/setup.S, the psaux detection code returned after attempting the
'enable device' call with an error 5: 'no device handler installed'.
My BIOS references says that a device handler returns with all arguments
remaining on the stack, so I set up a RETF as a stub handler, and all is
well.

A side effect of this was a modification to pass an initialization error
in the BIOS setup on to psaux_init in psaux.c via aux_device_present so
that a proper initialization error message can be displayed.

This was implemented in 0.97pl6, but has also been tested with 0.98.

>>>>>patch starts here: psaux.pat<<<<<
*** linux/boot/setup.S@	Thu Sep 17 10:58:50 1992
--- linux/boot/setup.S	Tue Sep 29 17:40:08 1992
***************
*** 11,16 ****
--- 11,18 ----
  ! system to read them from there before the area is overwritten
  ! for buffer-blocks.
  !
+ ! Modified PS/2 aux init code (troyer@saifr00.cfsat.Honeywell.COM) 28Sep92
+ !
  
  ! NOTE! These had better be the same as in bootsect.s!
  #include <linux/config.h>
***************
*** 130,137 ****
  
  	mov	ax,#INITSEG
  	mov	ds,ax
- 	mov	[0x1ff],#0	! default is no pointing device
  	int	0x11		! int 0x11: equipment determination
  	test	al,#0x04	! check if pointing device installed
  	jz	no_psmouse
  	mov	ax,#0xc201	! reset pointing device
--- 132,139 ----
  
  	mov	ax,#INITSEG
  	mov	ds,ax
  	int	0x11		! int 0x11: equipment determination
+ 	xor	ah,ah		! force no error if simply not installed
  	test	al,#0x04	! check if pointing device installed
  	jz	no_psmouse
  	mov	ax,#0xc201	! reset pointing device
***************
*** 153,164 ****
--- 155,178 ----
  	mov	bh,#0x05	! 100 reports per second
  	int	0x15
  	jc	no_psmouse
+ 	les	bx,dumy_retf	! point at dummy handler
+ 	mov	ax,#0xc207	! set device handler
+ 	int	0x15
+ 	jc	no_psmouse
  	mov	bh,#0x01
  	mov	ax,#0xc200	! enable pointing device
  	int	0x15
  	jc	no_psmouse
  	mov	[0x1ff],#0xaa	! device present
+ 	jmp	yes_psmouse
+ 
+ dumy_retf:
+ 	retf			! dummy for IRQ service routine
+ 
  no_psmouse:
+ 	mov	[0x1ff],ah	! return error status in flag
+ 
+ yes_psmouse:
  
  ! now we want to move to protected mode ...
  
*** linux/kernel/chr_drv/psaux.c@	Sun Aug 30 09:00:44 1992
--- linux/kernel/chr_drv/psaux.c	Tue Sep 29 17:20:31 1992
***************
*** 6,11 ****
--- 6,15 ----
   * Supports pointing devices attached to a PS/2 type
   * Keyboard and Auxiliary Device Controller.
   *
+  * Modified by Dean Troyer (troyer@saifr00.cfsat.Honeywell.COM) 28Sep92
+  *   to display an initialization error code if a PS/2 pointing device 
+  *   is detected, but can't be initialized properly (see also setup.S)
+  *
   */
  
  #include <linux/timer.h>
***************
*** 202,208 ****
  long psaux_init(long kmem_start)
  {
  	if (aux_device_present != 0xaa) {
! 		printk("No PS/2 type pointing device detected.\n");
  		return kmem_start;
  	}
  	printk("PS/2 type pointing device detected and installed.\n");
--- 206,217 ----
  long psaux_init(long kmem_start)
  {
  	if (aux_device_present != 0xaa) {
! 		if (aux_device_present != 0) {
! 			printk("PS/2 pointing device initialization error: %d\n",
! 			       aux_device_present);
! 		} else {	
! 			printk("No PS/2 type pointing device detected\n");
! 		}
  		return kmem_start;
  	}
  	printk("PS/2 type pointing device detected and installed.\n");
>>>>>end patch<<<<<

----------
Dean Troyer                               troyer@saifr00.cfsat.Honeywell.COM
Honeywell Commercial Flight Systems       72240.3152@compuserve.com
Phoenix AZ
(602) 436-3613
-- 
Dean Troyer                               troyer@saifr00.cfsat.Honeywell.COM
Honeywell Commercial Flight Systems       72240.3152@compuserve.com
Phoenix AZ
(602) 436-3613
Newsgroups: comp.os.linux