I am using a generic usb keyboard, Linux 2.6.27 with gnome desktop, gnome-terminal and bash shell. I am interested to know what happens in the software. How are special characters from my keyboard interpreted with some encoding to characters and where do the character pictures come from?
I am using a generic usb keyboard, Linux 2.6.27 with gnome desktop, gnome-terminal and
Share
The Linux input layer with the USB drivers gets scancodes (basically ‘KEY 1 DOWN’ ‘KEY 1 UP’) from the keyboard.
X uses its keymap to convert scancodes into keycodes and X input events.
The GTK input method converts the sequence of input events into composed unicode characters.
Gnome-terminal encodes these in UTF-8 for the shell.
The Shell doesn’t care. it just knows that it’s dealing with a multibyte encoding.
The shell echoes multibyte-encoded text back through the TTY.
Gnome-terminal decodes the incoming text and determines unicode code points.
Gnome-terminal draws characters using GTK+ facilities.
GTK+ uses Pango to render the text, and calls the X library to draw the pixels to the screen.
The X server draws characters into the screen buffer and the video card displays them.
Here is my attempt at a diagram:
alt text http://osoft.us/system_layers.png