diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/vax/dec/dzkbd.c | 14 | ||||
-rw-r--r-- | sys/arch/vax/dec/lk201_ws.c | 48 | ||||
-rw-r--r-- | sys/arch/vax/dec/lk201var.h | 9 |
3 files changed, 46 insertions, 25 deletions
diff --git a/sys/arch/vax/dec/dzkbd.c b/sys/arch/vax/dec/dzkbd.c index bc94bd90379..8fa4a3f9126 100644 --- a/sys/arch/vax/dec/dzkbd.c +++ b/sys/arch/vax/dec/dzkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dzkbd.c,v 1.10 2006/08/03 20:19:29 miod Exp $ */ +/* $OpenBSD: dzkbd.c,v 1.11 2006/08/05 22:05:55 miod Exp $ */ /* $NetBSD: dzkbd.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */ /* @@ -224,7 +224,7 @@ dzkbd_cngetc(void *v, u_int *type, int *data) do { c = dzgetc(dzi->dzi_ls); - } while (!lk201_decode(&dzi->dzi_ks, 1, c, type, data)); + } while (lk201_decode(&dzi->dzi_ks, 1, 0, c, type, data) == LKD_NODATA); } void @@ -272,14 +272,18 @@ dzkbd_input(void *v, int data) struct dzkbd_softc *sc = (struct dzkbd_softc *)v; u_int type; int val; + int decode; /* * 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); + do { + decode = lk201_decode(&sc->sc_itl->dzi_ks, sc->sc_enabled, 1, + data, &type, &val); + if (decode != LKD_NODATA) + wskbd_input(sc->sc_wskbddev, type, val); + } while (decode == LKD_MORE); return(1); } diff --git a/sys/arch/vax/dec/lk201_ws.c b/sys/arch/vax/dec/lk201_ws.c index 2f32e452651..236c1d561dd 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.8 2006/07/31 21:57:05 miod Exp $ */ +/* $OpenBSD: lk201_ws.c,v 1.9 2006/08/05 22:05:55 miod Exp $ */ /* $NetBSD: lk201_ws.c,v 1.2 1998/10/22 17:55:20 drochner Exp $ */ /* @@ -142,29 +142,24 @@ lk201_identify(void *v) } int -lk201_decode(struct lk201_state *lks, int active, int datain, u_int *type, - int *dataout) +lk201_decode(struct lk201_state *lks, int active, int wantmulti, int datain, + u_int *type, int *dataout) { int i, freeslot; if (lks->waitack != 0) { lks->ackdata = datain; lks->waitack = 0; - return (0); + return (LKD_NODATA); } switch (datain) { - case LK_KEY_UP: - for (i = 0; i < LK_KLL; i++) - lks->down_keys_list[i] = -1; - *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); + return (LKD_NODATA); case LK_KDOWN_ERROR: case LK_POWER_ERROR: case LK_OUTPUT_ERROR: @@ -173,18 +168,35 @@ lk201_decode(struct lk201_state *lks, int active, int datain, u_int *type, /* FALLTHROUGH */ case LK_KEY_REPEAT: /* autorepeat handled by wskbd */ case LK_MODE_CHANGE: /* ignore silently */ - return (0); + return (LKD_NODATA); } if (active == 0) - return (0); /* no need to decode */ - - if (datain < MIN_LK201_KEY || datain > MAX_LK201_KEY) { + return (LKD_NODATA); /* no need to decode */ + + if (datain == LK_KEY_UP) { + if (wantmulti) { + for (i = 0; i < LK_KLL; i++) + if (lks->down_keys_list[i] != -1) { + *type = WSCONS_EVENT_KEY_UP; + *dataout = lks->down_keys_list[i] - + MIN_LK201_KEY; + lks->down_keys_list[i] = -1; + return (LKD_MORE); + } + return (LKD_NODATA); + } else { + for (i = 0; i < LK_KLL; i++) + lks->down_keys_list[i] = -1; + *type = WSCONS_EVENT_ALL_KEYS_UP; + return (LKD_COMPLETE); + } + } else 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); + return (LKD_NODATA); } /* @@ -207,7 +219,7 @@ lk201_decode(struct lk201_state *lks, int active, int datain, u_int *type, if (lks->down_keys_list[i] == datain) { *type = WSCONS_EVENT_KEY_UP; lks->down_keys_list[i] = -1; - return (1); + return (LKD_COMPLETE); } if (lks->down_keys_list[i] == -1 && freeslot == -1) freeslot = i; @@ -215,12 +227,12 @@ lk201_decode(struct lk201_state *lks, int active, int datain, u_int *type, if (freeslot == -1) { printf("lk201_decode: down(%d) no free slot\n", datain); - return (0); + return (LKD_NODATA); } *type = WSCONS_EVENT_KEY_DOWN; lks->down_keys_list[freeslot] = datain; - return (1); + return (LKD_COMPLETE); } void diff --git a/sys/arch/vax/dec/lk201var.h b/sys/arch/vax/dec/lk201var.h index 800ac0ec651..9702c97b33f 100644 --- a/sys/arch/vax/dec/lk201var.h +++ b/sys/arch/vax/dec/lk201var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lk201var.h,v 1.6 2006/07/31 21:57:05 miod Exp $ */ +/* $OpenBSD: lk201var.h,v 1.7 2006/08/05 22:05:55 miod Exp $ */ /* $NetBSD: lk201var.h,v 1.2 1998/10/22 17:55:20 drochner Exp $ */ /* @@ -60,9 +60,14 @@ struct lk201_state { }; void lk201_bell(struct lk201_state *, struct wskbd_bell_data *); -int lk201_decode(struct lk201_state *, int, int, u_int *, int *); +int lk201_decode(struct lk201_state *, int, int, int, u_int *, int *); int lk201_get_leds(struct lk201_state *); int lk201_get_type(struct lk201_state *); void lk201_init(struct lk201_state *); void lk201_set_keyclick(struct lk201_state *, int); void lk201_set_leds(struct lk201_state *, int); + +/* Values returned by lk201_decode */ +#define LKD_NODATA 0x00 +#define LKD_COMPLETE 0x01 +#define LKD_MORE 0x02 |