From owner-freebsd-bugs Tue Jan 21 17:20:04 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id RAA29818 for bugs-outgoing; Tue, 21 Jan 1997 17:20:04 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id RAA29798; Tue, 21 Jan 1997 17:20:02 -0800 (PST) Date: Tue, 21 Jan 1997 17:20:02 -0800 (PST) Message-Id: <199701220120.RAA29798@freefall.freebsd.org> To: freebsd-bugs Cc: From: Kazutaka YOKOTA Subject: Re: kern/2553: moused caused panic Reply-To: Kazutaka YOKOTA Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following reply was made to PR kern/2553; it has been noted by GNATS. From: Kazutaka YOKOTA To: adrian@virginia.edu Cc: FreeBSD-gnats-submit@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: kern/2553: moused caused panic Date: Wed, 22 Jan 1997 10:21:06 +0900 >>Description: > > When booting without a mouse plugged in, moused causes the kernel > to panic. Here is the panic message: The problem has been fixed and committed to the source tree. Apply the first patch to /usr/src/sys/i386/isa/psm.c and the second patch to /usr/src/usr.sbin/moused/moused.c (if you don't run moused, you don't need this one, though). >>Fix: > > Workaround: Plug my mouse in or make sure moused is not > loaded at boot time. > > A real fix probably involves the psm driver, which is beyond me. You are right, and it's done. Thank you for your report. Kazu <<<< patch to the psm driver >>>> --- psm.c-dist Mon Dec 2 06:37:16 1996 +++ psm.c Sat Jan 4 11:54:32 1997 @@ -508,6 +508,8 @@ if (unit >= NPSM) return (0); + psm_softc[unit] = NULL; + sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT); bzero(sc, sizeof *sc); @@ -745,6 +747,9 @@ int unit = dvp->id_unit; struct psm_softc *sc = psm_softc[unit]; + if (sc == NULL) /* shouldn't happen */ + return (0); + /* initial operation mode */ sc->mode.accelfactor = PSM_ACCEL; sc->mode.protocol = MOUSE_PROTO_PS2; @@ -786,6 +791,8 @@ /* Get device data */ sc = psm_softc[unit]; + if (sc == NULL) + return (ENXIO); if ((sc->state & PSM_VALID) == 0) /* the device is no longer valid/functioning */ return (ENXIO); <<<< patch to moused >>>> --- moused.c-dist Wed Sep 11 05:03:37 1996 +++ moused.c Fri Dec 27 17:05:45 1996 @@ -53,6 +53,9 @@ #include #include #include +#include +#include +#include #define debug(fmt,args...) \ if (debug&&nodaemon) fprintf(stderr,"%s: " fmt "\n", progname, ##args) @@ -150,6 +153,7 @@ struct termios t; struct mouse_info mouse; int saved_buttons = 0; + fd_set fds; progname = argv[0]; @@ -243,6 +247,9 @@ for(;;) { + FD_ZERO(&fds); + FD_SET(rodent.mfd,&fds); + select(FD_SETSIZE,&fds,NULL,&fds,NULL); i = read(rodent.mfd,&b,1); /* get a byte */ if (i != 1) /* read returned or error; goodbye */ {