From 949688eeaf942f99d234f937af0153349f1fe342 Mon Sep 17 00:00:00 2001 From: augustss Date: Sat, 30 Apr 2005 03:47:12 +0000 Subject: [PATCH] Remember what keyboard layout is set in the mux, that way new keyboards can be given the same layout. Fixes kern/19153. --- sys/dev/wscons/wsksymdef.h | 3 ++- sys/dev/wscons/wsmux.c | 21 ++++++++++++++++----- sys/dev/wscons/wsmuxvar.h | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/sys/dev/wscons/wsksymdef.h b/sys/dev/wscons/wsksymdef.h index cdd1029816a7..845bb0131bfb 100644 --- a/sys/dev/wscons/wsksymdef.h +++ b/sys/dev/wscons/wsksymdef.h @@ -1,4 +1,4 @@ -/* $NetBSD: wsksymdef.h,v 1.52 2005/04/04 09:08:54 martti Exp $ */ +/* $NetBSD: wsksymdef.h,v 1.53 2005/04/30 03:47:12 augustss Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -521,6 +521,7 @@ action(KB_SV, 0, 0x0900, "sv", , "Swedish") \ action(KB_SF, 0, 0x1000, "sf", , "Swiss French") \ action(KB_SG, 0, 0x0f00, "sg", , "Swiss German") \ action(KB_UA, 0, 0x1200, "ua", , "Ukrainian") +#define KB_NONE 0x0000 /* Define all the KB_xx numeric values using above table */ #define KBF_ENUM(tag, tagf, value, cc, ccf, country) tag=value, diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c index 98d034750a36..a966f2e53862 100644 --- a/sys/dev/wscons/wsmux.c +++ b/sys/dev/wscons/wsmux.c @@ -1,10 +1,10 @@ -/* $NetBSD: wsmux.c,v 1.36 2005/02/27 00:27:52 perry Exp $ */ +/* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */ /* - * Copyright (c) 1998 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc. * All rights reserved. * - * Author: Lennart Augustsson + * Author: Lennart Augustsson * Carlstedt Research & Technology * * Redistribution and use in source and binary forms, with or without @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.36 2005/02/27 00:27:52 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $"); #include "wsdisplay.h" #include "wsmux.h" @@ -68,6 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.36 2005/02/27 00:27:52 perry Exp $"); #include "opt_wsdisplay_compat.h" #include +#include #include #include #include @@ -554,8 +555,13 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag, if (!error) ok = 1; } - if (ok) + if (ok) { error = 0; + if (cmd == WSKBDIO_SETENCODING) { + sc->sc_kbd_layout = *((kbd_t *)data); + } + + } return (error); } @@ -650,6 +656,7 @@ wsmux_create(const char *name, int unit) "%s%d", name, unit); sc->sc_base.me_dv.dv_unit = unit; sc->sc_base.me_ops = &wsmux_srcops; + sc->sc_kbd_layout = KB_NONE; return (sc); } @@ -692,6 +699,10 @@ wsmux_attach_sc(struct wsmux_softc *sc, struct wsevsrc *me) (void)wsevsrc_ioctl(me, WSKBDIO_SETMODE, &sc->sc_rawkbd, 0, 0); #endif + if (sc->sc_kbd_layout != KB_NONE) + (void)wsevsrc_ioctl(me, + WSKBDIO_SETENCODING, + &sc->sc_kbd_layout, FWRITE, 0); } } } diff --git a/sys/dev/wscons/wsmuxvar.h b/sys/dev/wscons/wsmuxvar.h index 9b99f9941280..d5bd97528e71 100644 --- a/sys/dev/wscons/wsmuxvar.h +++ b/sys/dev/wscons/wsmuxvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wsmuxvar.h,v 1.9 2003/06/29 22:31:06 fvdl Exp $ */ +/* $NetBSD: wsmuxvar.h,v 1.10 2005/04/30 03:47:12 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -82,6 +82,7 @@ struct wsmux_softc { struct wsevsrc sc_base; struct proc *sc_p; /* open proc */ CIRCLEQ_HEAD(, wsevsrc) sc_cld; /* list of children */ + u_int32_t sc_kbd_layout; /* current layout of keyboard */ #ifdef WSDISPLAY_COMPAT_RAWKBD int sc_rawkbd; /* A hack to remember the kbd mode */ #endif