diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/vax/dec/dzkbd.c | 105 | ||||
-rw-r--r-- | sys/arch/vax/dec/lk201_ws.c | 17 | ||||
-rw-r--r-- | sys/arch/vax/dec/lk201var.h | 6 |
3 files changed, 54 insertions, 74 deletions
diff --git a/sys/arch/vax/dec/dzkbd.c b/sys/arch/vax/dec/dzkbd.c index 46f698308b3..5c3e3a81265 100644 --- a/sys/arch/vax/dec/dzkbd.c +++ b/sys/arch/vax/dec/dzkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dzkbd.c,v 1.6 2006/07/29 17:06:25 miod Exp $ */ +/* $OpenBSD: dzkbd.c,v 1.7 2006/07/30 18:35:10 miod Exp $ */ /* $NetBSD: dzkbd.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */ /* @@ -78,16 +78,12 @@ struct dzkbd_softc { struct device dzkbd_dev; /* required first: base device */ struct dzkbd_internal *sc_itl; - int sc_enabled; - struct device *sc_wskbddev; }; -static int dzkbd_input(void *, int); - -static int dzkbd_match(struct device *, struct cfdata *, void *); -static void dzkbd_attach(struct device *, struct device *, void *); +int dzkbd_match(struct device *, struct cfdata *, void *); +void dzkbd_attach(struct device *, struct device *, void *); struct cfattach dzkbd_ca = { sizeof(struct dzkbd_softc), (cfmatch_t)dzkbd_match, dzkbd_attach, @@ -97,9 +93,9 @@ struct cfdriver lkkbd_cd = { NULL, "lkkbd", DV_DULL }; -static int dzkbd_enable(void *, int); -static void dzkbd_set_leds(void *, int); -static int dzkbd_ioctl(void *, u_long, caddr_t, int, struct proc *); +int dzkbd_enable(void *, int); +void dzkbd_set_leds(void *, int); +int dzkbd_ioctl(void *, u_long, caddr_t, int, struct proc *); const struct wskbd_accessops dzkbd_accessops = { dzkbd_enable, @@ -107,16 +103,14 @@ const struct wskbd_accessops dzkbd_accessops = { dzkbd_ioctl, }; -static void dzkbd_cngetc(void *, u_int *, int *); -static void dzkbd_cnpollc(void *, int); +void dzkbd_cngetc(void *, u_int *, int *); +void dzkbd_cnpollc(void *, int); const struct wskbd_consops dzkbd_consops = { dzkbd_cngetc, dzkbd_cnpollc, }; -static int dzkbd_sendchar(void *, u_char); - const struct wskbd_mapdata dzkbd_keymapdata = { lkkbd_keydesctab, #ifdef DZKBD_LAYOUT @@ -126,10 +120,13 @@ const struct wskbd_mapdata dzkbd_keymapdata = { #endif }; +int dzkbd_input(void *, int); +int dzkbd_sendchar(void *, int); + /* * kbd_match: how is this dz line configured? */ -static int +int dzkbd_match(struct device *parent, struct cfdata *cf, void *aux) { struct dzkm_attach_args *daa = aux; @@ -148,7 +145,7 @@ dzkbd_match(struct device *parent, struct cfdata *cf, void *aux) return 0; } -static void +void dzkbd_attach(struct device *parent, struct device *self, void *aux) { struct dz_softc *dz = (void *)parent; @@ -197,8 +194,7 @@ dzkbd_attach(struct device *parent, struct device *self, void *aux) } int -dzkbd_cnattach(ls) - struct dz_linestate *ls; +dzkbd_cnattach(struct dz_linestate *ls) { dzkbd_console_internal.dzi_ks.attmt.sendchar = dzkbd_sendchar; @@ -212,10 +208,8 @@ dzkbd_cnattach(ls) return 0; } -static int -dzkbd_enable(v, on) - void *v; - int on; +int +dzkbd_enable(void *v, int on) { struct dzkbd_softc *sc = v; @@ -223,61 +217,35 @@ dzkbd_enable(v, on) return 0; } -static int -dzkbd_sendchar(v, c) - void *v; - u_char c; -{ - struct dz_linestate *ls = v; - int s; - - s = spltty(); - dzputc(ls, c); - splx(s); - return (0); -} - -static void -dzkbd_cngetc(v, type, data) - void *v; - u_int *type; - int *data; +void +dzkbd_cngetc(void *v, u_int *type, int *data) { struct dzkbd_internal *dzi = v; int c; do { c = dzgetc(dzi->dzi_ls); - } while (!lk201_decode(&dzi->dzi_ks, c, type, data)); + } while (!lk201_decode(&dzi->dzi_ks, 1, c, type, data)); } -static void -dzkbd_cnpollc(v, on) - void *v; - int on; +void +dzkbd_cnpollc(void *v, int on) { #if 0 struct dzkbd_internal *dzi = v; #endif } -static void -dzkbd_set_leds(v, leds) - void *v; - int leds; +void +dzkbd_set_leds(void *v, int leds) { struct dzkbd_softc *sc = (struct dzkbd_softc *)v; lk201_set_leds(&sc->sc_itl->dzi_ks, leds); } -static int -dzkbd_ioctl(v, cmd, data, flag, p) - void *v; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +int +dzkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) { struct dzkbd_softc *sc = (struct dzkbd_softc *)v; @@ -300,20 +268,27 @@ dzkbd_ioctl(v, cmd, data, flag, p) return -1; } -static int -dzkbd_input(v, data) - void *v; - int data; +int +dzkbd_input(void *v, int data) { struct dzkbd_softc *sc = (struct dzkbd_softc *)v; u_int type; int val; - if (sc->sc_enabled == 0) - return(0); - - if (lk201_decode(&sc->sc_itl->dzi_ks, data, &type, &val)) + /* + * We want to run through lk201_decode always, so that a late plugged + * keyboard will get configured correctly. + */ + if (lk201_decode(&sc->sc_itl->dzi_ks, sc->sc_enabled, data, + &type, &val)) wskbd_input(sc->sc_wskbddev, type, val); + return(1); } +int +dzkbd_sendchar(void *v, int c) +{ + dzputc((struct dz_linestate *)v, c); + return (0); +} diff --git a/sys/arch/vax/dec/lk201_ws.c b/sys/arch/vax/dec/lk201_ws.c index 29846dc1f5d..d00ec591aee 100644 --- a/sys/arch/vax/dec/lk201_ws.c +++ b/sys/arch/vax/dec/lk201_ws.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lk201_ws.c,v 1.4 2006/07/30 18:32:47 miod Exp $ */ +/* $OpenBSD: lk201_ws.c,v 1.5 2006/07/30 18:35:10 miod Exp $ */ /* $NetBSD: lk201_ws.c,v 1.2 1998/10/22 17:55:20 drochner Exp $ */ /* @@ -77,11 +77,8 @@ lk201_init(lks) } int -lk201_decode(lks, datain, type, dataout) - struct lk201_state *lks; - int datain; - u_int *type; - int *dataout; +lk201_decode(struct lk201_state *lks, int active, int datain, u_int *type, + int *dataout) { int i, freeslot; @@ -92,7 +89,9 @@ lk201_decode(lks, datain, type, dataout) *type = WSCONS_EVENT_ALL_KEYS_UP; return (1); case LK_POWER_UP: +#ifdef DEBUG printf("lk201_decode: powerup detected\n"); +#endif lk201_init(lks); return (0); case LK_KDOWN_ERROR: @@ -106,8 +105,14 @@ lk201_decode(lks, datain, type, dataout) return (0); } + if (active == 0) + return (0); /* no need to decode */ + if (datain < MIN_LK201_KEY || datain > MAX_LK201_KEY) { +#ifdef DEBUG + /* this can happen while hotplugging the keyboard */ printf("lk201_decode: %x\n", datain); +#endif return (0); } diff --git a/sys/arch/vax/dec/lk201var.h b/sys/arch/vax/dec/lk201var.h index 9c2e9e5093d..378eb2d4aa9 100644 --- a/sys/arch/vax/dec/lk201var.h +++ b/sys/arch/vax/dec/lk201var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lk201var.h,v 1.3 2006/07/29 17:06:25 miod Exp $ */ +/* $OpenBSD: lk201var.h,v 1.4 2006/07/30 18:35:10 miod Exp $ */ /* $NetBSD: lk201var.h,v 1.2 1998/10/22 17:55:20 drochner Exp $ */ /* @@ -34,7 +34,7 @@ */ struct lk201_attachment { - int (*sendchar)(void *, u_char); + int (*sendchar)(void *, int); void *cookie; }; @@ -48,7 +48,7 @@ struct lk201_state { }; int lk201_init(struct lk201_state *); -int lk201_decode(struct lk201_state *, int, u_int *, int *); +int lk201_decode(struct lk201_state *, int, int, u_int *, int *); void lk201_bell(struct lk201_state *, struct wskbd_bell_data *); void lk201_set_leds(struct lk201_state *, int); void lk201_set_keyclick(struct lk201_state *, int); |