p The .Fa enable member defines the function to be called to enable keypress passing to wscons. The .Fa set_leds member defined the function to be called to set the LEDs on the keyboard. The .Fa ioctl member defines the function to be called to perform keyboard-specific ioctl calls.
p There is a .Fa void * cookie provided by the keyboard driver associated with these functions, which is passed to them when they are invoked. t Fa struct wskbd_consops A structure used to specify the keyboard console operations. All keyboards which can operate as a console must provide this structure and pass it to the .Xr wskbd 4 child device. If the keyboard cannot be a console, it is not necessary to specify this structure. It has the following members: d -literal void (*getc)(void *, u_int *, int *); void (*pollc)(void *, int); void (*bell)(void *, u_int, u_int, u_int); .Ed
p There is a .Fa void * cookie provided by the keyboard driver associated with these functions, which is passed to them when they are invoked. t Fa struct wscons_keydesc A structure used to describe a keyboard mapping table to convert keyboard-specific keycodes to wscons keysyms. It has the following members: d -literal kbd_t name; /* name of this map */ kbd_t base; /* map this one is based on */ int map_size; /* size of map */ const keysym_t *map; /* the map itself */ .Ed t Fa struct wskbd_mapdata A structure used to describe the keyboard layout and operation to interpret the keyboard layout. it contains the following members: d -literal const struct wscons_keydesc *keydesc; kbd_t layout; .Ed t Fa struct wskbddev_attach_args A structure used to attach the .Xr wskbd 4 child device. It has the following members: d -literal int console; const struct wskbd_mapdata *keymap; const struct wskbd_accessops *accessops; void *accesscookie; .Ed .El .Ss Keymaps Keymaps are a dense stream of .Fa keysym_t . A declaration has the following fields:
p .Ar pos .Op Ar cmd .Ar normal .Op Ar shift .Op Ar altgr .Op Ar shift-altgr
p The fields have the following meanings:
p l -tag -offset indent -width SHIFT-ALTGR -compact t Ar pos Always specified as .Ns KC( Ns Ar pos ) and starts the description of key .Ar pos . t Ar cmd If the command modifier (KS_Cmd_XXX) is active, the optional command .Ar cmd is invoked. t Ar normal The keysym if no modifiers are active. t Ar shift The keysym if the shift modifier is active. t Ar altgr The keysym if the alt-gr modifier is active. t Ar shift-altgr The keysym if the shift-alt-gr modifier is active. .El
p If the keysym after .Ar pos is not KS_Cmd_XXX, then .Ar cmd is empty. The .Ar shift , .Ar altgr and .Ar shift-altgr fields are determined from previous fields if they are not specified. Therefore, there are four valid keysym declarations:
p .Ar pos .Op Ar cmd .Ar normal
p .Ar pos .Op Ar cmd .Ar normal Ar shift
p .Ar pos .Op Ar cmd .Ar normal Ar shift Ar altgr
p .Ar pos .Op Ar cmd .Ar normal Ar shift Ar altgr Ar shift-altgr .Sh FUNCTIONS l -tag -width compact t Fn wskbd_input "kbddev" "type" "value" Pass the keypress of value .Fa value and type .Fa type to wscons keyboard driver. Valid values of .Fa type are: l -tag -width compact t WSCONS_EVENT_KEY_UP Key released. t WSCONS_EVENT_KEY_DOWN Key pressed. .El t Fn wskbd_rawinput "kbddev" "buf" "len" Pass the raw keypress in the buffer .Fa buf to the wscons keyboard driver. The buffer is .Fa len bytes long. This function should only be called if the kernel option .Em WSDISPLAY_COMPAT_RAWKBD is enabled. t Fn wskbd_cnattach "consops" "conscookie" "mapdata" Attach this keyboard as the console input by specifying the console operations .Fa consops and the keyboard mapping table information in .Fa mapdata . The functions specified in .Fa consops will be called with .Fa conscookie as the first argument. t Fn wskbd_cndetach "" Detach this keyboard as the console input. t Fn wskbddevprint "aux" "pnp" The default wskbd printing routine used by .Fn config_found . (see .Xr autoconf 9 ) . .El .Sh AUTOCONFIGURATION Keyboard drivers which want to use the wskbd module must be a parent to the .Xr wskbd 4 device and provide an attachment interface. To attach the .Xr wskbd 4 device, the keyboard driver must allocate and populate a .Fa wskbddev_attach_args structure with the supported operations and callbacks and call .Fn config_found to perform the attach (see .Xr autoconf 9 ) . The .Fa keymap member points to the .Em wskbd_mapdata structure which describes the keycode mapping operations. The .Fa accessops member points to the .Em wskbd_accessops structure which describes the keyboard access operations. The .Fa console member is a boolean to indicate to wscons whether this keyboard will be used for console input. .Sh OPERATION If the keyboard belongs to the system console, it must register the .Fa wskbd_consops structure specifying the console operations via .Fn wskbd_cnattach at console attach time.
p When a keypress arrives from the keyboard, the keyboard driver must perform any necessary character decoding to wscons events and pass the events to wscons via .Fn wskbd_input . If the kernel is compiled with the option .Em WSDISPLAY_COMPAT_RAWKBD , then the keyboard driver must also pass the raw keyboard data to wscons via .Fn wskbd_rawinput .
p The wscons framework calls back into the hardware driver by invoking the functions that are specified in the .Em accessops structure. The .Fn enable and .Fn set_leds functions are relatively simple and self-explanatory. The .Fn ioctl function is called by the wscons interface to perform keyboard-specific ioctl operations (see .Xr ioctl 2 ) . The argument .Fa cmd to the .Fn ioctl function specifies the specific command to perform using the data .Fa data . Valid commands are listed in
a sys/dev/wscons/wsconsio.h . .Sh CODE REFERENCES The wscons subsystem is implemented within the directory
a sys/dev/wscons . The .Nm module itself is implement within the files
a sys/dev/wscons/wskbdutil.c . .Xr ioctl 2 operations are listed in
a sys/dev/wscons/wsconsio.h . .Sh SEE ALSO .Xr ioctl 2 , .Xr autoconf 9 , .Xr driver 9 , .Xr intro 9 , .Xr wsdisplay 9 , .Xr wsmouse 9