mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
[PATCH] VT binding: Update documentation
Update Documentation/fb/fbcon.txt and Documentatin/console/console.txt to reflect the following changes: 1. sysfs attributes are relocated to /sys/class/vtconsole 2. feature is selectable in Kconfig 3. add sample scripts to fbcon.txt Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
5bd42536b3
commit
6690075d0b
2 changed files with 101 additions and 35 deletions
|
@ -27,45 +27,62 @@ In newer kernels, the following are also available:
|
||||||
register_con_driver()
|
register_con_driver()
|
||||||
unregister_con_driver()
|
unregister_con_driver()
|
||||||
|
|
||||||
If sysfs is enabled, the contents of /sys/class/tty/console/backend can be
|
If sysfs is enabled, the contents of /sys/class/vtconsole can be
|
||||||
examined. This shows the console drivers currently registered by the system. On
|
examined. This shows the console backends currently registered by the
|
||||||
an x86 system with the framebuffer console enabled, the contents of this
|
system which are named vtcon<n> where <n> is an integer fro 0 to 15. Thus:
|
||||||
attribute may be like this:
|
|
||||||
|
|
||||||
cat /sys/class/tty/console/backend
|
ls /sys/class/vtconsole
|
||||||
0 S: VGA+
|
. .. vtcon0 vtcon1
|
||||||
1 B: frame buffer device
|
|
||||||
|
|
||||||
The first line shows the VGA console driver, while the second line shows
|
Each directory in /sys/class/vtconsole has 3 files:
|
||||||
the framebuffer console driver.
|
|
||||||
|
|
||||||
The leftmost numeric character is the driver ID. The middle character with
|
ls /sys/class/vtconsole/vtcon0
|
||||||
the colon describes the status of the driver.
|
. .. bind name uevent
|
||||||
|
|
||||||
S: - system driver (binding unspecified)
|
What do these files signify?
|
||||||
B: - bound modular driver
|
|
||||||
U: - unbound modular driver
|
|
||||||
|
|
||||||
The last column is the description of the driver.
|
1. bind - this is a read/write file. It shows the status of the driver if
|
||||||
|
read, or acts to bind or unbind the driver to the virtual consoles
|
||||||
|
when written to. The possible values are:
|
||||||
|
|
||||||
Under /sys/class/tty/console are two other attributes, 'bind' and
|
0 - means the driver is not bound and if echo'ed, commands the driver
|
||||||
'unbind'. What does these 2 attributes do? As their name implies, echo'ing the
|
to unbind
|
||||||
driver ID to 'bind' will bind an unbound modular driver, and to 'unbind' will
|
|
||||||
unbind a bound modular driver. Echo'ing the ID of a system driver to either
|
|
||||||
attribute will do nothing.
|
|
||||||
|
|
||||||
Thus:
|
1 - means the driver is bound and if echo'ed, commands the driver to
|
||||||
|
bind
|
||||||
|
|
||||||
echo 1 > /sys/class/tty/console/unbind
|
2. name - read-only file. Shows the name of the driver in this format:
|
||||||
cat /sys/class/tty/console/backend
|
|
||||||
0 S: VGA+
|
cat /sys/class/vtconsole/vtcon0/name
|
||||||
1 U: frame buffer device
|
(S) VGA+
|
||||||
|
|
||||||
|
'(S)' stands for a (S)ystem driver, ie, it cannot be directly
|
||||||
|
commanded to bind or unbind
|
||||||
|
|
||||||
|
'VGA+' is the name of the driver
|
||||||
|
|
||||||
|
cat /sys/class/vtconsole/vtcon1/name
|
||||||
|
(M) frame buffer device
|
||||||
|
|
||||||
|
In this case, '(M)' stands for a (M)odular driver, one that can be
|
||||||
|
directly commanded to bind or unbind.
|
||||||
|
|
||||||
|
3. uevent - ignore this file
|
||||||
|
|
||||||
When unbinding, the modular driver is detached first, and then the system
|
When unbinding, the modular driver is detached first, and then the system
|
||||||
driver takes over the consoles vacated by the driver. Binding, on the other
|
driver takes over the consoles vacated by the driver. Binding, on the other
|
||||||
hand, will bind the driver to the consoles that are currently occupied by a
|
hand, will bind the driver to the consoles that are currently occupied by a
|
||||||
system driver.
|
system driver.
|
||||||
|
|
||||||
|
NOTE1: Binding and binding must be selected in Kconfig. It's under:
|
||||||
|
|
||||||
|
Device Drivers -> Character devices -> Support for binding and unbinding
|
||||||
|
console drivers
|
||||||
|
|
||||||
|
NOTE2: If any of the virtual consoles are in KD_GRAPHICS mode, then binding or
|
||||||
|
unbinding will not succeed. An example of an application that sets the console
|
||||||
|
to KD_GRAPHICS is X.
|
||||||
|
|
||||||
How useful is this feature? This is very useful for console driver
|
How useful is this feature? This is very useful for console driver
|
||||||
developers. By unbinding the driver from the console layer, one can unload the
|
developers. By unbinding the driver from the console layer, one can unload the
|
||||||
driver, make changes, recompile, reload and rebind the driver without any need
|
driver, make changes, recompile, reload and rebind the driver without any need
|
||||||
|
|
|
@ -180,10 +180,13 @@ fbcon.
|
||||||
So, how do we unbind fbcon from the console? Part of the answer is in
|
So, how do we unbind fbcon from the console? Part of the answer is in
|
||||||
Documentation/console/console.txt. To summarize:
|
Documentation/console/console.txt. To summarize:
|
||||||
|
|
||||||
Echo the ID number of the 'frame buffer driver' to:
|
Echo a value to the bind file that represents the framebuffer console
|
||||||
|
driver. So assuming vtcon1 represents fbcon, then:
|
||||||
|
|
||||||
sys/class/tty/console/bind - attach framebuffer console to console layer
|
echo 1 > sys/class/vtconsole/vtcon1/bind - attach framebuffer console to
|
||||||
sys/class/tty/console/unbind - detach framebuffer console from console layer
|
console layer
|
||||||
|
echo 0 > sys/class/vtconsole/vtcon1/bind - detach framebuffer console from
|
||||||
|
console layer
|
||||||
|
|
||||||
If fbcon is detached from the console layer, your boot console driver (which is
|
If fbcon is detached from the console layer, your boot console driver (which is
|
||||||
usually VGA text mode) will take over. A few drivers (rivafb and i810fb) will
|
usually VGA text mode) will take over. A few drivers (rivafb and i810fb) will
|
||||||
|
@ -211,19 +214,15 @@ restored properly. The following is one of the several methods that you can do:
|
||||||
|
|
||||||
5. Now to detach fbcon:
|
5. Now to detach fbcon:
|
||||||
|
|
||||||
'cat /sys/class/tty/console/backend' and take note of the ID
|
|
||||||
|
|
||||||
The above is probably needed only once. Then:
|
|
||||||
|
|
||||||
vbetool vbestate restore < <vga state file> && \
|
vbetool vbestate restore < <vga state file> && \
|
||||||
echo <ID> > /sys/class/tty/console/unbind
|
echo 0 > /sys/class/vtconsole/vtcon1/bind
|
||||||
|
|
||||||
6. That's it, you're back to VGA mode. And if you compiled fbcon as a module,
|
6. That's it, you're back to VGA mode. And if you compiled fbcon as a module,
|
||||||
you can unload it by 'rmmod fbcon'
|
you can unload it by 'rmmod fbcon'
|
||||||
|
|
||||||
7. To reattach fbcon:
|
7. To reattach fbcon:
|
||||||
|
|
||||||
echo <ID> > /sys/class/tty/console/bind
|
echo 1 > /sys/class/vtconsole/vtcon1/bind
|
||||||
|
|
||||||
8. Once fbcon is unbound, all drivers registered to the system will also
|
8. Once fbcon is unbound, all drivers registered to the system will also
|
||||||
become unbound. This means that fbcon and individual framebuffer drivers
|
become unbound. This means that fbcon and individual framebuffer drivers
|
||||||
|
@ -254,6 +253,8 @@ Variation 1:
|
||||||
c. Attach fbcon
|
c. Attach fbcon
|
||||||
|
|
||||||
vbetool vbestate restore < <vesa state file> && \
|
vbetool vbestate restore < <vesa state file> && \
|
||||||
|
echo 1 > /sys/class/vtconsole/vtcon1/bind
|
||||||
|
|
||||||
Variation 2:
|
Variation 2:
|
||||||
|
|
||||||
a. Before detaching fbcon, do:
|
a. Before detaching fbcon, do:
|
||||||
|
@ -269,7 +270,55 @@ Variation 2:
|
||||||
c. Attach fbcon:
|
c. Attach fbcon:
|
||||||
|
|
||||||
vbetool vbemode set <mode number> && \
|
vbetool vbemode set <mode number> && \
|
||||||
echo <ID> > /sys/class/tty/console/bind
|
echo 1 > /sys/class/vtconsole/vtcon1/bind
|
||||||
|
|
||||||
|
Samples:
|
||||||
|
========
|
||||||
|
|
||||||
|
Here are 2 sample bash scripts that you can use to bind or unbind the
|
||||||
|
framebuffer console driver if you are in an X86 box:
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
#!/bin/bash
|
||||||
|
# Unbind fbcon
|
||||||
|
|
||||||
|
# Change this to where your actual vgastate file is located
|
||||||
|
# Or Use VGASTATE=$1 to indicate the state file at runtime
|
||||||
|
VGASTATE=/tmp/vgastate
|
||||||
|
|
||||||
|
# path to vbetool
|
||||||
|
VBETOOL=/usr/local/bin
|
||||||
|
|
||||||
|
|
||||||
|
for (( i = 0; i < 16; i++))
|
||||||
|
do
|
||||||
|
if test -x /sys/class/vtconsole/vtcon$i; then
|
||||||
|
if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \
|
||||||
|
= 1 ]; then
|
||||||
|
if test -x $VBETOOL/vbetool; then
|
||||||
|
echo Unbinding vtcon$i
|
||||||
|
$VBETOOL/vbetool vbestate restore < $VGASTATE
|
||||||
|
echo 0 > /sys/class/vtconsole/vtcon$i/bind
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
#!/bin/bash
|
||||||
|
# Bind fbcon
|
||||||
|
|
||||||
|
for (( i = 0; i < 16; i++))
|
||||||
|
do
|
||||||
|
if test -x /sys/class/vtconsole/vtcon$i; then
|
||||||
|
if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \
|
||||||
|
= 1 ]; then
|
||||||
|
echo Unbinding vtcon$i
|
||||||
|
echo 1 > /sys/class/vtconsole/vtcon$i/bind
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
Antonino Daplas <adaplas@pol.net>
|
Antonino Daplas <adaplas@pol.net>
|
||||||
|
|
Loading…
Reference in a new issue