Make it possible to build a kernel with a wscons display device but not

a wscons keyboard device.
This commit is contained in:
thorpej 1998-05-23 01:06:36 +00:00
parent 3dfd62c76f
commit 492ee1399e
2 changed files with 32 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wscons_glue.c,v 1.1 1998/03/22 14:24:02 drochner Exp $ */ /* $NetBSD: wscons_glue.c,v 1.2 1998/05/23 01:06:36 thorpej Exp $ */
/* /*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -33,7 +33,7 @@
static const char _copyright[] __attribute__ ((unused)) = static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved."; "Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) = static const char _rcsid[] __attribute__ ((unused)) =
"$NetBSD: wscons_glue.c,v 1.1 1998/03/22 14:24:02 drochner Exp $"; "$NetBSD: wscons_glue.c,v 1.2 1998/05/23 01:06:36 thorpej Exp $";
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -41,7 +41,11 @@ static const char _rcsid[] __attribute__ ((unused)) =
#include <dev/wscons/wscons_callbacks.h> #include <dev/wscons/wscons_callbacks.h>
#include "wskbd.h"
#if NWSKBD > 0
extern struct cfdriver wsdisplay_cd, wskbd_cd; extern struct cfdriver wsdisplay_cd, wskbd_cd;
#endif
int wscons_setup_glue_callback_set; int wscons_setup_glue_callback_set;
@ -62,6 +66,7 @@ static void
wscons_setup_glue(v) wscons_setup_glue(v)
void *v; void *v;
{ {
#if NWSKBD > 0
int i, kbddev, displaydev; int i, kbddev, displaydev;
struct device *kbddevice, *displaydevice; struct device *kbddevice, *displaydevice;
@ -144,4 +149,5 @@ wscons_setup_glue(v)
} }
/* Now wasn't that simple? */ /* Now wasn't that simple? */
#endif /* NWSKBD > 0*/
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: wskbd.c,v 1.4 1998/04/09 17:16:57 hannken Exp $ */ /* $NetBSD: wskbd.c,v 1.5 1998/05/23 01:06:36 thorpej Exp $ */
/* /*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -36,7 +36,7 @@
static const char _copyright[] __attribute__ ((unused)) = static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved."; "Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) = static const char _rcsid[] __attribute__ ((unused)) =
"$NetBSD: wskbd.c,v 1.4 1998/04/09 17:16:57 hannken Exp $"; "$NetBSD: wskbd.c,v 1.5 1998/05/23 01:06:36 thorpej Exp $";
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -108,6 +108,8 @@ static const char _rcsid[] __attribute__ ((unused)) =
#include <dev/wscons/wseventvar.h> #include <dev/wscons/wseventvar.h>
#include <dev/wscons/wscons_callbacks.h> #include <dev/wscons/wscons_callbacks.h>
#include "wskbd.h"
struct wskbd_internal { struct wskbd_internal {
int t_keydesc_len; int t_keydesc_len;
const struct wscons_keydesc *t_keydesc; const struct wscons_keydesc *t_keydesc;
@ -194,7 +196,9 @@ struct cfattach wskbd_ca = {
sizeof (struct wskbd_softc), wskbd_match, wskbd_attach, sizeof (struct wskbd_softc), wskbd_match, wskbd_attach,
}; };
#if NWSKBD > 0
extern struct cfdriver wskbd_cd; extern struct cfdriver wskbd_cd;
#endif
#ifndef WSKBD_DEFAULT_BELL_PITCH #ifndef WSKBD_DEFAULT_BELL_PITCH
#define WSKBD_DEFAULT_BELL_PITCH 1500 /* 1500Hz */ #define WSKBD_DEFAULT_BELL_PITCH 1500 /* 1500Hz */
@ -473,6 +477,7 @@ wskbdopen(dev, flags, mode, p)
int flags, mode; int flags, mode;
struct proc *p; struct proc *p;
{ {
#if NWSKBD > 0
struct wskbd_softc *sc; struct wskbd_softc *sc;
int unit; int unit;
@ -492,6 +497,9 @@ wskbdopen(dev, flags, mode, p)
/* XXX ENABLE THE DEVICE IF NOT CONSOLE? */ /* XXX ENABLE THE DEVICE IF NOT CONSOLE? */
return (0); return (0);
#else
return (ENXIO);
#endif /* NWSKBD > 0 */
} }
int int
@ -500,6 +508,7 @@ wskbdclose(dev, flags, mode, p)
int flags, mode; int flags, mode;
struct proc *p; struct proc *p;
{ {
#if NWSKBD > 0
struct wskbd_softc *sc; struct wskbd_softc *sc;
int unit; int unit;
@ -513,6 +522,7 @@ wskbdclose(dev, flags, mode, p)
sc->sc_ready = 0; /* stop accepting events */ sc->sc_ready = 0; /* stop accepting events */
wsevent_fini(&sc->sc_events); wsevent_fini(&sc->sc_events);
sc->sc_events.io = NULL; sc->sc_events.io = NULL;
#endif /* NWSKBD > 0 */
return (0); return (0);
} }
@ -522,6 +532,7 @@ wskbdread(dev, uio, flags)
struct uio *uio; struct uio *uio;
int flags; int flags;
{ {
#if NWSKBD > 0
struct wskbd_softc *sc; struct wskbd_softc *sc;
int unit; int unit;
@ -531,6 +542,9 @@ wskbdread(dev, uio, flags)
return (ENXIO); return (ENXIO);
return (wsevent_read(&sc->sc_events, uio, flags)); return (wsevent_read(&sc->sc_events, uio, flags));
#else
return (ENXIO);
#endif /* NWSKBD > 0 */
} }
int int
@ -541,6 +555,7 @@ wskbdioctl(dev, cmd, data, flag, p)
int flag; int flag;
struct proc *p; struct proc *p;
{ {
#if NWSKBD > 0
struct wskbd_softc *sc; struct wskbd_softc *sc;
int unit, error; int unit, error;
@ -572,6 +587,9 @@ wskbdioctl(dev, cmd, data, flag, p)
*/ */
error = wskbd_displayioctl((struct device *)sc, cmd, data, flag, p); error = wskbd_displayioctl((struct device *)sc, cmd, data, flag, p);
return (error != -1 ? error : ENOTTY); return (error != -1 ? error : ENOTTY);
#else
return (ENXIO);
#endif /* NWSKBD > 0 */
} }
/* /*
@ -758,9 +776,13 @@ wskbdpoll(dev, events, p)
int events; int events;
struct proc *p; struct proc *p;
{ {
#if NWSKBD > 0
struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)]; struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)];
return (wsevent_poll(&sc->sc_events, events, p)); return (wsevent_poll(&sc->sc_events, events, p));
#else
return (0);
#endif /* NWSKBD > 0 */
} }
int int