Tux
Communication
Mailing lists
Documentation
User Manual
Target board info.
Target chip info.
Support
Linux support
Bugzilla
Downloads
STLinux
Updates
Search
Google


The web
stlinux.com
Distribution Guide
Device drivers
Virtual terminal drivers
ST Logo
Previous   Contents   Next


Virtual terminal drivers

When virtual terminals (VTs) are enabled in the kernel (see Framebuffer driver), 63 tty devices (also known as virtual consoles) are multiplexed onto the framebuffer. Each of these tty devices can be in either text console mode or graphics mode, and each can have its own framebuffer configuration (display timings, color format for example).

In an x86 PC based Linux system running X windows, the user can switch between VTs using the keyboard shortcut Ctrl-Alt-F<num>, where <num> is the VT number. The X session itself usually runs on VT 7 and there are usually a number of mingetty terminal logins, starting at VT 1.

On a target running the STLinux2.0 distribution, with the framebuffer installed and virtual terminals enabled, the user will see a black screen. A simple test that the system is in fact working is:

target# cat /proc/interrupts >/dev/tty0

This should write a list of interrupts to the screen.

Changing the virtual terminal

STMicroelectronics' devices do not necessarily have a keyboard attached, so a way is provided for the user to change the current VT from a remote console. This uses the command:

target# chvt <num> 

where <num> is the target VT number (the first VT is VT1, not zero). Each VT has an associated tty entry in /dev, where VT<num> is accessed via /dev/tty<num>. The device /dev/tty0 always refers to the currently active VT.

Running applications on a virtual terminal

Graphical applications such as the X server or those based on DirectFB will manipulate the virtual terminal state themselves, using Linux specific console ioctls (see the man page console_ioctl(4)). Other applications can be explicitly run on a VT using the command openvt. For the full description of this command, refer to the man page openvt(1). For example, to run ls on VT 3 and to switch to that VT to see the result enter:

target# openvt -c 3 -s -- ls

Changing display mode

When fbset is used to change the display mode then by default the mode is changed only for the currently active VT. If you change the VT, the display mode will change to the configuration for the new VT.

This can cause confusion if you run DirectFB or X applications as these switch automatically to an unused VT, which may not be configured for the display mode wanted. At startup, all VTs are set to the default display mode. The command fbset -a or fbset --all will cause the mode of all VTs to be changed to the same settings.

Virtual console control

The virtual console attached to a VT can be controlled to change attributes such as the text color using the program setterm. See the man page setterm(1) for details. For example, to change the text background to blue and then clear the screen (to blue) enter:

target# export TERM=linux
target# setterm -background blue >/dev/tty0
target# clear >/dev/tty0

Note: It is important that the terminal type is set to linux so that setterm and other programs generate the correct escape sequences.

One very important attribute set by this method is the console blanking time. After a certain number of minutes, the screen will be blanked. In a PC Linux system, the console would be unblanked on the next keystroke, however in an embedded system this behavior is undesirable. To disable blanking, place the following command in the system startup scripts to run after the framebuffer drivers have been loaded:

setterm -term linux -blank 0 >/dev/tty0
Previous   Contents   Next
Valid HTML 4.01! Last updated: 2005/09/29 14:43:17
© Copyright STMicroelectronics Limited, 2005
Printer