From: anton Date: Mon, 20 Sep 2021 17:32:39 +0000 (+0000) Subject: Changing the encoding of a ucc keyboard doesn't make sense as only one X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=84169f275a2d6f942e4e0d65e236af0d896e46b4;p=openbsd Changing the encoding of a ucc keyboard doesn't make sense as only one encoding is supported. Instead, silently ignore such requests. Gets rid of the following warning emitted by kbd(8) while booting with a ucc keyboard attached and /etc/kbdtype being present: kbd: unsupported encoding uk on /dev/wskbd2 I ended up repurposing KB_MACHDEP as is became unused back in 2008. Note that running a kernel with this commit applied requires kbd and wsconsctl to be recompiled in order to show correct encodings. Problem reported by landry@ and ok deraadt@ --- diff --git a/sys/dev/usb/ucc.c b/sys/dev/usb/ucc.c index e74aca1fce5..ecbbb2970f9 100644 --- a/sys/dev/usb/ucc.c +++ b/sys/dev/usb/ucc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucc.c,v 1.26 2021/09/12 06:58:08 anton Exp $ */ +/* $OpenBSD: ucc.c,v 1.27 2021/09/20 17:32:39 anton Exp $ */ /* * Copyright (c) 2021 Anton Lindqvist @@ -788,7 +788,7 @@ ucc_attach_wskbd(struct ucc_softc *sc) sc->sc_keydesc[0].map_size = sc->sc_maplen; sc->sc_keydesc[0].map = sc->sc_map; sc->sc_keymap.keydesc = sc->sc_keydesc; - sc->sc_keymap.layout = KB_US; + sc->sc_keymap.layout = KB_US | KB_NOENCODING; sc->sc_wskbddev = config_found(&sc->sc_hdev.sc_dev, &a, wskbddevprint); } diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index ab3bbd3b6f2..6d3d332858c 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wskbd.c,v 1.107 2020/11/02 19:45:18 tobhe Exp $ */ +/* $OpenBSD: wskbd.c,v 1.108 2021/09/20 17:32:39 anton Exp $ */ /* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */ /* @@ -1146,6 +1146,8 @@ getkeyrepeat: /* map variants make no sense */ if (KB_VARIANT(enc) & ~KB_HANDLEDBYWSKBD) return (EINVAL); + } else if (sc->id->t_keymap.layout & KB_NOENCODING) { + return (0); } else { error = wskbd_load_keymap(&sc->id->t_keymap, enc, &sc->sc_map, &sc->sc_maplen); diff --git a/sys/dev/wscons/wsksymdef.h b/sys/dev/wscons/wsksymdef.h index e35cb8fb3b3..d8ce33aa0a7 100644 --- a/sys/dev/wscons/wsksymdef.h +++ b/sys/dev/wscons/wsksymdef.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsksymdef.h,v 1.38 2019/05/11 14:19:16 abieber Exp $ */ +/* $OpenBSD: wsksymdef.h,v 1.39 2021/09/20 17:32:39 anton Exp $ */ /* $NetBSD: wsksymdef.h,v 1.34.4.1 2000/07/07 09:49:54 hannken Exp $ */ /*- @@ -744,7 +744,7 @@ #define KB_DVORAK 0x00000010 /* Dvorak layout */ #define KB_METAESC 0x00000020 /* generate ESC prefix on ALT-key */ #define KB_IOPENER 0x00000040 /* f1-f12 -> ESC,f1-f11 */ -#define KB_MACHDEP 0x00000080 /* machine dependent */ +#define KB_NOENCODING 0x00000080 /* no encodings available */ #define KB_APPLE 0x00010000 /* Apple specific layout */ #define KB_COLEMAK 0x02000000 /* Colemak layout */ #define KB_DEFAULT 0x80000000 /* (attach-only) default layout */ @@ -788,7 +788,7 @@ { KB_DVORAK, "dvorak" }, \ { KB_METAESC, "metaesc" }, \ { KB_IOPENER, "iopener" }, \ - { KB_MACHDEP, "machdep" }, \ + { KB_NOENCODING, "noencoding" }, \ { KB_APPLE, "apple" }, \ { KB_COLEMAK, "colemak" } diff --git a/sys/dev/wscons/wsksymvar.h b/sys/dev/wscons/wsksymvar.h index e40889dd81c..7ab9eee81fc 100644 --- a/sys/dev/wscons/wsksymvar.h +++ b/sys/dev/wscons/wsksymvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsksymvar.h,v 1.8 2014/01/26 17:48:08 miod Exp $ */ +/* $OpenBSD: wsksymvar.h,v 1.9 2021/09/20 17:32:39 anton Exp $ */ /* $NetBSD: wsksymvar.h,v 1.8.4.1 2000/07/07 09:50:21 hannken Exp $ */ /*- @@ -60,7 +60,7 @@ struct wskbd_mapdata { }; /* layout variant bits ignored by mapping code */ -#define KB_HANDLEDBYWSKBD (KB_METAESC | KB_DEFAULT) +#define KB_HANDLEDBYWSKBD (KB_METAESC | KB_DEFAULT | KB_NOENCODING) /* * Utility functions.