If the keyboard belongs to the system console, it must register the
wskbd_consops structure specifying the console operations via
wskbd_cnattach() at console attach time.
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
wskbd_input(). If the kernel is compiled with the option
WSDISPLAY_COMPAT_RAWKBD, then the keyboard driver must also pass the raw keyboard data to wscons via
wskbd_rawinput().
The wscons framework calls back into the hardware driver by invoking the functions that are specified in the
accessops structure. The
enable() and
set_leds() functions are relatively simple and self-explanatory. The
ioctl() function is called by the wscons interface to perform keyboard-specific ioctl operations (see
ioctl(2)). The argument
cmd to the
ioctl() function specifies the specific command to perform using the data
data. Valid commands are listed in
sys/dev/wscons/wsconsio.h.