Remember what keyboard layout is set in the mux, that way new keyboards

can be given the same layout.  Fixes kern/19153.
This commit is contained in:
augustss 2005-04-30 03:47:12 +00:00
parent 8ed63e80db
commit 949688eeaf
3 changed files with 20 additions and 7 deletions

View File

@ -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. * 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_SF, 0, 0x1000, "sf", , "Swiss French") \
action(KB_SG, 0, 0x0f00, "sg", , "Swiss German") \ action(KB_SG, 0, 0x0f00, "sg", , "Swiss German") \
action(KB_UA, 0, 0x1200, "ua", , "Ukrainian") action(KB_UA, 0, 0x1200, "ua", , "Ukrainian")
#define KB_NONE 0x0000
/* Define all the KB_xx numeric values using above table */ /* Define all the KB_xx numeric values using above table */
#define KBF_ENUM(tag, tagf, value, cc, ccf, country) tag=value, #define KBF_ENUM(tag, tagf, value, cc, ccf, country) tag=value,

View File

@ -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. * All rights reserved.
* *
* Author: Lennart Augustsson <augustss@carlstedt.se> * Author: Lennart Augustsson <lennart@augustsson.net>
* Carlstedt Research & Technology * Carlstedt Research & Technology
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -44,7 +44,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 "wsdisplay.h"
#include "wsmux.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 "opt_wsdisplay_compat.h"
#include <dev/wscons/wsconsio.h> #include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsksymdef.h>
#include <dev/wscons/wseventvar.h> #include <dev/wscons/wseventvar.h>
#include <dev/wscons/wscons_callbacks.h> #include <dev/wscons/wscons_callbacks.h>
#include <dev/wscons/wsmuxvar.h> #include <dev/wscons/wsmuxvar.h>
@ -554,8 +555,13 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
if (!error) if (!error)
ok = 1; ok = 1;
} }
if (ok) if (ok) {
error = 0; error = 0;
if (cmd == WSKBDIO_SETENCODING) {
sc->sc_kbd_layout = *((kbd_t *)data);
}
}
return (error); return (error);
} }
@ -650,6 +656,7 @@ wsmux_create(const char *name, int unit)
"%s%d", name, unit); "%s%d", name, unit);
sc->sc_base.me_dv.dv_unit = unit; sc->sc_base.me_dv.dv_unit = unit;
sc->sc_base.me_ops = &wsmux_srcops; sc->sc_base.me_ops = &wsmux_srcops;
sc->sc_kbd_layout = KB_NONE;
return (sc); return (sc);
} }
@ -692,6 +699,10 @@ wsmux_attach_sc(struct wsmux_softc *sc, struct wsevsrc *me)
(void)wsevsrc_ioctl(me, WSKBDIO_SETMODE, (void)wsevsrc_ioctl(me, WSKBDIO_SETMODE,
&sc->sc_rawkbd, 0, 0); &sc->sc_rawkbd, 0, 0);
#endif #endif
if (sc->sc_kbd_layout != KB_NONE)
(void)wsevsrc_ioctl(me,
WSKBDIO_SETENCODING,
&sc->sc_kbd_layout, FWRITE, 0);
} }
} }
} }

View File

@ -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. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -82,6 +82,7 @@ struct wsmux_softc {
struct wsevsrc sc_base; struct wsevsrc sc_base;
struct proc *sc_p; /* open proc */ struct proc *sc_p; /* open proc */
CIRCLEQ_HEAD(, wsevsrc) sc_cld; /* list of children */ CIRCLEQ_HEAD(, wsevsrc) sc_cld; /* list of children */
u_int32_t sc_kbd_layout; /* current layout of keyboard */
#ifdef WSDISPLAY_COMPAT_RAWKBD #ifdef WSDISPLAY_COMPAT_RAWKBD
int sc_rawkbd; /* A hack to remember the kbd mode */ int sc_rawkbd; /* A hack to remember the kbd mode */
#endif #endif