xref: /netbsd-src/share/man/man4/wskbd.4 (revision 5edb7daeef866869c84d0e25a200edb5301e67d9)
1.\" $NetBSD: wskbd.4,v 1.26 2021/09/18 18:14:07 tsutsui Exp $
2.\"
3.\" Copyright (c) 1999
4.\" 	Matthias Drochner.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd September 18, 2021
28.Dt WSKBD 4
29.Os
30.Sh NAME
31.Nm wskbd
32.Nd generic keyboard support in wscons
33.Sh SYNOPSIS
34.Cd "wskbd* at pckbd? console ? mux 1"
35(standard PC keyboard)
36.Cd "wskbd* at ukbd? console ? mux 1"
37(USB keyboard)
38.Cd "wskbd* at lkkbd? console ? mux 1"
39(DEC LK200/400 serial keyboard)
40.Cd "wskbd0 at akbd? console ? mux 1"
41(Apple ADB keyboard)
42.Cd "wskbd0 at nextkbd? console ? mux 1"
43(NeXT keyboard)
44.Cd "wskbd* at vrkiu? console ? mux 1"
45(NEC VR4000 series HPC keyboard)
46.Cd "wskbd* at skbd? console ? mux 1"
47(keyboard of misc hpcmips handheld devices)
48.Cd "wskbd* at btkbd? console ? mux 1"
49(Bluetooth keyboard)
50.Pp
51.In dev/wscons/wsconsio.h
52.In dev/wscons/wsksymdef.h
53.Sh DESCRIPTION
54The
55.Nm
56driver handles common tasks for keyboards within the
57.Xr wscons 4
58framework.
59It is attached to the hardware specific keyboard drivers and
60provides their connection to
61.Dq wsdisplay
62devices and a character device interface.
63.Pp
64The common keyboard support consists of:
65.Bl -bullet
66.It
67Mapping from keycodes (defined by the specific keyboard driver) to
68keysyms (hardware independent, defined in
69.In dev/wscons/wsksymdef.h ) .
70.It
71Handling of
72.Dq compose
73sequences.
74Characters commonly not present as separate key on keyboards
75can be generated after either a special
76.Dq compose
77key is pressed or a
78.Dq dead accent
79character is used.
80.It
81Certain translations, like turning an
82.Tn ALT
83modifier into an
84.Tn ESC
85prefix.
86.It
87Automatic key repetition
88.Pq Dq typematic .
89.It
90Parameter handling for
91.Dq keyboard bells .
92.It
93Generation of
94.Dq keyboard events
95for use by X servers.
96.El
97.Pp
98The
99.Nm
100driver provides a number of ioctl functions to control key maps
101and other parameters.
102These functions are accessible though the associated
103.Xr wsdisplay 4
104device as well.
105A complete list is in
106.In dev/wscons/wsconsio.h .
107The
108.Xr wsconsctl 8
109utility allows to access key maps and other variables.
110.Pp
111The
112.Cd console
113locator in the configuration line refers to the device's use as input
114part of the operating system console.
115A device specification containing a positive value here will only
116match if the device is in use as system console.
117(The console device selection in early system startup is not influenced.)
118This way, the console device can be connected to a known
119wskbd device instance.
120.Ss Keyboard encodings
121The following encodings are supported.
122Device drivers for legacy keyboard interfaces may only support a subset
123of these.
124However, generally, all encodings are supported by
125.Xr pckbd 4
126and
127.Xr ukbd 4 .
128.Bl -column ".Li us.colemak" ".Dv KB_US|KB_COLEMAK"
129.It Sy "wsconsctl" Ta Sy "define" Ta Sy "language"
130.It Li user Ta Dv KB_USER Ta User-defined
131.It Li us Ta Dv KB_US Ta English/US keyboard mapping (default)
132.It Li uk Ta Dv KB_UK Ta English/UK keyboard mapping
133.It Li be Ta Dv KB_BE Ta Belgian
134.It Li br Ta Dv KB_BR Ta Brazilian with
135.Dq dead accents
136.It Li cf Ta Dv KB_CF Ta Canadian French
137.It Li cz Ta Dv KB_CZ Ta Czech (QWERTY)
138.It Li dk Ta Dv KB_DK Ta Danish with
139.Dq dead accents
140.It Li nl Ta Dv KB_NL Ta Dutch
141.It Li ee Ta Dv KB_EE Ta Estonian with
142.Dq dead accents
143.It Li fi Ta Dv KB_FI Ta Finnish
144.It Li fr Ta Dv KB_FR Ta French
145.It Li de Ta Dv KB_DE Ta German QWERTZ with
146.Dq dead accents
147.It Li neo Ta Dv KB_NEO Ta German Neo 2 layout
148.It Li gr Ta Dv KB_GR Ta Greek
149.It Li hu Ta Dv KB_HU Ta Hungarian
150.It Li is Ta Dv KB_IS Ta Icelandic with
151.Dq dead accents
152.It Li it Ta Dv KB_IT Ta Italian
153.It Li jp Ta Dv KB_JP Ta Japanese
154.It Li la Ta Dv KB_LA Ta Latin American Spanish
155.It Li no Ta Dv KB_NO Ta Norwegian with
156.Dq dead accents
157.It Li pl Ta Dv KB_PL Ta Polish
158.It Li pt Ta Dv KB_PT Ta Portuguese
159.It Li ru Ta Dv KB_RU Ta Russian
160.It Li es Ta Dv KB_ES Ta Spanish
161.It Li sv Ta Dv KB_SV Ta Swedish with
162.Dq dead accents
163.It Li sf Ta Dv KB_SF Ta Swiss French
164.It Li sg Ta Dv KB_SG Ta Swiss German
165.It Li tr Ta Dv KB_TR Ta Turkish (QWERTY) with
166.Dq dead accents
167.It Li ua Ta Dv KB_UA Ta Ukrainian
168.It Li us.declk Ta Dv "KB_US|KB_DECLK" Ta English/US mapping for
169.Tn DEC LK400 Ns - Ns style
170keyboards with PC keyboard interface (e.g.,
171.Tn LK461 )
172.It Li us.dvorak Ta Dv "KB_US|KB_DVORAK" Ta English/US keyboard with
173.Dq Dvorak
174layout
175.It Li us.colemak Ta Dv "KB_US|KB_COLEMAK" Ta English/US keyboard with
176.Dq Colemak
177layout
178.El
179.Pp
180The
181.Dq Li \&.nodead
182suffix
183.Dv ( KB_NODEAD
184flag)
185can be applied to layouts with
186.Dq dead accents
187to switch them off.
188.Pp
189The
190.Dv KB_US ,
191.Dv KB_UK ,
192.Dv KB_FR ,
193.Dv KB_JP
194and
195.Dv KB_US|KB_DVORAK
196mappings can be modified
197to swap the left
198.Aq Ctrl
199and the
200.Aq CapsLock
201keys by the
202.Dv KB_SWAPCTRLCAPS
203variant bit or the
204.Dq Li .swapctrlcaps
205suffix.
206.Pp
207The
208.Dq Li .metaesc
209suffix
210.Dv ( KB_METAESC
211flag)
212option can be applied to any layout.
213If set, keys pressed together
214with the
215.Tn ALT
216modifier are prefixed by an
217.Tn ESC
218character.
219(Standard behaviour is to add 128 to the
220.Tn ASCII
221value.)
222.Ss Ioctls
223The following
224.Xr ioctl 2
225calls are provided by the
226.Nm
227driver or by devices which use it.
228Their definitions are found in
229.In dev/wscons/wsconsio.h .
230.Bl -tag -width Dv
231.It Dv WSKBDIO_GTYPE
232Get the keyboard type.
233.It Dv WSKBDIO_GETMODE
234Get the keyboard mode, 0 means translated through keyboard map, 1 means raw.
235.It Dv WSKBDIO_SETMODE
236Set the keyboard mode.
237.It Dv WSKBDIO_COMPLEXBELL , WSKBDIO_SETBELL , WSKBDIO_GETBELL , WSKBDIO_SETDEFAULTBELL , WSKBDIO_GETDEFAULTBELL Pq Vt "struct wskbd_bell_data"
238Get and set keyboard bell settings.
239.It Dv WSKBDIO_SETKEYREPEAT , WSKBDIO_GETKEYREPEAT , WSKBDIO_SETDEFAULTKEYREPEAT , WSKBDIO_GETDEFAULTKEYREPEAT Pq Vt "struct wskbd_keyrepeat_data"
240Get and set keyboard autorepeat settings.
241.It Dv WSKBDIO_SETLEDS , WSKBDIO_GETLEDS Pq Vt "int"
242Get and set keyboard LED settings.
243.It Dv WSKBDIO_GETMAP , WSKBDIO_SETMAP Pq Vt "struct wskbd_map_data"
244Get and set keyboard keymapping settings.
245.It Dv WSKBDIO_GETENCODING , WSKBDIO_SETENCODING Pq Vt "kbd_t"
246Get and set keyboard encoding settings.
247.It Dv WSKBDIO_GETKEYCLICK , WSKBDIO_SETKEYCLICK Pq Vt "int"
248Get and set keyboard keyclick settings.
249.It Dv WSKBDIO_SETVERSION Pq Vt "int"
250Set the
251.Vt wscons_event
252protocol version.
253The default is 0 for binary compatibility.
254The latest version is
255always available as
256.Dv WSKBDIO_EVENT_VERSION ,
257and is currently 1.
258All new code should use a call similar to the below to ensure the
259correct version is returned.
260.Bd -literal -offset indent
261int ver = WSKBDIO_EVENT_VERSION;
262if (ioctl(fd, WSKBDIO_SETVERSION, &ver) == -1)
263	err(EXIT_FAILURE, "cannot set version");
264.Ed
265.El
266.Sh FILES
267.Bl -item
268.It
269.Pa /dev/wskbd Ns Ar \&*
270.El
271.Sh SEE ALSO
272.Xr btkbd 4 ,
273.Xr pckbd 4 ,
274.Xr ukbd 4 ,
275.Xr wscons 4 ,
276.Xr wsmux 4 ,
277.Xr wsconsctl 8 ,
278.Xr wskbd 9
279.Sh BUGS
280The list of builtin mappings doesn't follow any logic.
281It grew as people submitted what they needed.
282