Specifications
CHAPTER 2. DRIVERS AND INTERFACES 8
events. The input events carry the scancodes, the event handler keyboard.c translates the
scancodes to their corresponding keycodes. This mapping is necessary to operate one kind of
keyboard with multiple languages. Only the keys’ imprint differs—the scancode of each key
remains the same.
Useful tools to debug scan- and keycodes are showkey(1), loadkeys(1), dumpkeys(1)
and setkeycodes(8). The source package of these utilities is available from http://lct.
sourceforge.net/. The keymaps found in /usr/share/keymaps are translation tables—from
scancode to keycode—and can be loaded by loadkeys(1) in user space.
Linux support for various keyboards is enabled by setting their configuration option to
either y (compile static into kernel) or m (compile as module):
– KEYBOARD ATKBD (AT and PS/2 keyboards)
– KEYBOARD SUNKBD (Sun Type 4 and Type 5 keyboards)
– KEYBOARD LKKBD (DECstation/VAXstation LK201/LK401 keyboards)
– KEYBOARD XTKBD (IBM PC/XT keyboard)
– KEYBOARD NEWTON (Apple Newton keyboard)
– KEYBOARD MAPLE (Dreamcast keyboard)
– KEYBOARD AMIGA (Amiga keyboard)
2.3 USB Input Device Drivers
The USB specification for Human Interface Devices (HID) describes which USB devices should
be considered as HID [Usb01]:
– Keyboards and pointing devices, e.g. standard mouse devices, trackballs and joysticks
– Front-panel controls, e.g. knobs, switches, buttons and sliders
– Controls that might be found on devices such as telephones, remote controls, games or
simulation devices, e.g. data gloves, throttles, steering wheels and rudder pedals
– Devices that may not require human interaction but provide data in a similar format to
HID class devices, e.g. bar-code readers, thermometers and voltmeters
Due to the USB HID specification, there is only a need for a single device driver for all
human interface devices instead of one device driver for each human interface device. This is
one of the facts that led to the success of USB—especially regarding Linux since manpower
for driver development is often missing.
Figure 2.2 shows how USB input devices and the Linux input core cooperate. USB devices
are connected to the USB host controller (shown as “USB HC”) which is driven by the corre-
sponding host controller driver (“USB HCI”). Support for USB keyboards, mice and joysticks
is implemented by the drivers HID core (hid-core.c) and HID input (hid-input.c) which
are both located in the directory drivers/usb/input. The HID input driver uses the Linux
input core and therefore depends on it. As before, new input devices are registered by calling
input register device() and input events are reported by calling the input core’s function
input event() or one of its wrapper functions. Some USB device drivers are not covered by