xref: /netbsd-src/share/man/man4/wskbd.4 (revision cef8759bd76c1b621f8eab8faa6f208faabc2e15)
1.\" $NetBSD: wskbd.4,v 1.22 2020/07/13 14:11:16 uwe 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 July 13, 2020
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 with
146.Dq dead accents
147.It Li gr Ta Dv KB_GR Ta Greek
148.It Li hu Ta Dv KB_HU Ta Hungarian
149.It Li is Ta Dv KB_IS Ta Icelandic with
150.Dq dead accents
151.It Li it Ta Dv KB_IT Ta Italian
152.It Li jp Ta Dv KB_JP Ta Japanese
153.It Li la Ta Dv KB_LA Ta Latin American Spanish
154.It Li no Ta Dv KB_NO Ta Norwegian with
155.Dq dead accents
156.It Li pl Ta Dv KB_PL Ta Polish
157.It Li pt Ta Dv KB_PT Ta Portuguese
158.It Li ru Ta Dv KB_RU Ta Russian
159.It Li es Ta Dv KB_ES Ta Spanish
160.It Li sv Ta Dv KB_SV Ta Swedish with
161.Dq dead accents
162.It Li sf Ta Dv KB_SF Ta Swiss French
163.It Li sg Ta Dv KB_SG Ta Swiss German
164.It Li tr Ta Dv KB_TR Ta Turkish (QWERTY) with
165.Dq dead accents
166.It Li ua Ta Dv KB_UA Ta Ukrainian
167.It Li us.declk Ta Dv "KB_US|KB_DECLK" Ta English/US mapping for
168.Tn DEC LK400 Ns - Ns style
169keyboards with PC keyboard interface (e.g.,
170.Tn LK461 )
171.It Li us.dvorak Ta Dv "KB_US|KB_DVORAK" Ta English/US keyboard with
172.Dq Dvorak
173layout
174.It Li us.colemak Ta Dv "KB_US|KB_COLEMAK" Ta English/US keyboard with
175.Dq Colemak
176layout
177.El
178.Pp
179The
180.Dq Li \&.nodead
181suffix
182.Dv ( KB_NODEAD
183flag)
184can be applied to layouts with
185.Dq dead accents
186to switch them off.
187.Pp
188The
189.Dv KB_US ,
190.Dv KB_UK ,
191.Dv KB_FR ,
192.Dv KB_JP
193and
194.Dv KB_US|KB_DVORAK
195mappings can be modified
196to swap the left
197.Aq Ctrl
198and the
199.Aq CapsLock
200keys by the
201.Dv KB_SWAPCTRLCAPS
202variant bit or the
203.Dq Li .swapctrlcaps
204suffix.
205.Pp
206The
207.Dq Li .metaesc
208suffix
209.Dv ( KB_METAESC
210flag)
211option can be applied to any layout.
212If set, keys pressed together
213with the
214.Tn ALT
215modifier are prefixed by an
216.Tn ESC
217character.
218(Standard behaviour is to add 128 to the
219.Tn ASCII
220value.)
221.Ss Ioctls
222The following
223.Xr ioctl 2
224calls are provided by the
225.Nm
226driver or by devices which use it.
227Their definitions are found in
228.In dev/wscons/wsconsio.h .
229.Bl -tag -width Dv
230.It Dv WSKBDIO_GTYPE
231Get the keyboard type.
232.It Dv WSKBDIO_COMPLEXBELL , WSKBDIO_SETBELL , WSKBDIO_GETBELL , WSKBDIO_SETDEFAULTBELL , WSKBDIO_GETDEFAULTBELL Pq Vt "struct wsmouse_repeat"
233Get and set keyboard bell settings.
234.It Dv WSKBDIO_SETKEYREPEAT , WSKBDIO_GETKEYREPEAT , WSKBDIO_SETDEFAULTKEYREPEAT , WSKBDIO_GETDEFAULTKEYREPEAT Pq Vt "struct wskbd_keyrepeat_data"
235Get and set keyboard autorepeat settings.
236.It Dv WSKBDIO_SETLEDS , WSKBDIO_GETLEDS Pq Vt "int"
237Get and set keyboard LED settings.
238.It Dv WSKBDIO_GETMAP , WSKBDIO_SETMAP Pq Vt "struct wskbd_map_data"
239Get and set keyboard keymapping settings.
240.It Dv WSKBDIO_GETENCODING , WSKBDIO_SETENCODING Pq Vt "kbd_t"
241Get and set keyboard encoding settings.
242.It Dv WSKBDIO_GETKEYCLICK , WSKBDIO_SETKEYCLICK Pq Vt "int"
243Get and set keyboard keyclick settings.
244.It Dv WSKBDIO_SETVERSION Pq Vt "int"
245Set the
246.Vt wscons_event
247protocol version.
248The default is 0 for binary compatibility.
249The latest version is
250always available as
251.Dv WSKBDIO_EVENT_VERSION ,
252and is currently 1.
253All new code should use a call similar to the below to ensure the
254correct version is returned.
255.Bd -literal -offset indent
256int ver = WSKBDIO_EVENT_VERSION;
257if (ioctl(fd, WSKBDIO_SETVERSION, &ver) == -1)
258	err(EXIT_FAILURE, "cannot set version");
259.Ed
260.El
261.Sh FILES
262.Bl -item
263.It
264.Pa /dev/wskbd Ns Ar \&*
265.El
266.Sh SEE ALSO
267.Xr btkbd 4 ,
268.Xr pckbd 4 ,
269.Xr ukbd 4 ,
270.Xr wscons 4 ,
271.Xr wsmux 4 ,
272.Xr wsconsctl 8 ,
273.Xr wskbd 9
274.Sh BUGS
275The list of builtin mappings doesn't follow any logic.
276It grew as people submitted what they needed.
277