diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2006-06-26 03:27:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 12:58:33 -0400 |
commit | 6690075d0b97837aca533b92715e6357ad6de279 (patch) | |
tree | abd914a173dfc68569fedda51d3b494200b3cbc1 | |
parent | 5bd42536b395944a1134baa3624b2e0cff6ac7bf (diff) |
[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>
-rw-r--r-- | Documentation/console/console.txt | 67 | ||||
-rw-r--r-- | Documentation/fb/fbcon.txt | 69 |
2 files changed, 101 insertions, 35 deletions
diff --git a/Documentation/console/console.txt b/Documentation/console/console.txt index 4f3f28507761..d3e17447321c 100644 --- a/Documentation/console/console.txt +++ b/Documentation/console/console.txt | |||
@@ -27,45 +27,62 @@ In newer kernels, the following are also available: | |||
27 | register_con_driver() | 27 | register_con_driver() |
28 | unregister_con_driver() | 28 | unregister_con_driver() |
29 | 29 | ||
30 | If sysfs is enabled, the contents of /sys/class/tty/console/backend can be | 30 | If sysfs is enabled, the contents of /sys/class/vtconsole can be |
31 | examined. This shows the console drivers currently registered by the system. On | 31 | examined. This shows the console backends currently registered by the |
32 | an x86 system with the framebuffer console enabled, the contents of this | 32 | system which are named vtcon<n> where <n> is an integer fro 0 to 15. Thus: |
33 | attribute may be like this: | ||
34 | 33 | ||
35 | cat /sys/class/tty/console/backend | 34 | ls /sys/class/vtconsole |
36 | 0 S: VGA+ | 35 | . .. vtcon0 vtcon1 |
37 | 1 B: frame buffer device | ||
38 | 36 | ||
39 | The first line shows the VGA console driver, while the second line shows | 37 | Each directory in /sys/class/vtconsole has 3 files: |
40 | the framebuffer console driver. | ||
41 | 38 | ||
42 | The leftmost numeric character is the driver ID. The middle character with | 39 | ls /sys/class/vtconsole/vtcon0 |
43 | the colon describes the status of the driver. | 40 | . .. bind name uevent |
44 | 41 | ||
45 | S: - system driver (binding unspecified) | 42 | What do these files signify? |
46 | B: - bound modular driver | ||
47 | U: - unbound modular driver | ||
48 | 43 | ||
49 | The last column is the description of the driver. | 44 | 1. bind - this is a read/write file. It shows the status of the driver if |
45 | read, or acts to bind or unbind the driver to the virtual consoles | ||
46 | when written to. The possible values are: | ||
50 | 47 | ||
51 | Under /sys/class/tty/console are two other attributes, 'bind' and | 48 | 0 - means the driver is not bound and if echo'ed, commands the driver |
52 | 'unbind'. What does these 2 attributes do? As their name implies, echo'ing the | 49 | to unbind |
53 | driver ID to 'bind' will bind an unbound modular driver, and to 'unbind' will | ||
54 | unbind a bound modular driver. Echo'ing the ID of a system driver to either | ||
55 | attribute will do nothing. | ||
56 | 50 | ||
57 | Thus: | 51 | 1 - means the driver is bound and if echo'ed, commands the driver to |
52 | bind | ||
58 | 53 | ||
59 | echo 1 > /sys/class/tty/console/unbind | 54 | 2. name - read-only file. Shows the name of the driver in this format: |
60 | cat /sys/class/tty/console/backend | 55 | |
61 | 0 S: VGA+ | 56 | cat /sys/class/vtconsole/vtcon0/name |
62 | 1 U: frame buffer device | 57 | (S) VGA+ |
58 | |||
59 | '(S)' stands for a (S)ystem driver, ie, it cannot be directly | ||
60 | commanded to bind or unbind | ||
61 | |||
62 | 'VGA+' is the name of the driver | ||
63 | |||
64 | cat /sys/class/vtconsole/vtcon1/name | ||
65 | (M) frame buffer device | ||
66 | |||
67 | In this case, '(M)' stands for a (M)odular driver, one that can be | ||
68 | directly commanded to bind or unbind. | ||
69 | |||
70 | 3. uevent - ignore this file | ||
63 | 71 | ||
64 | When unbinding, the modular driver is detached first, and then the system | 72 | When unbinding, the modular driver is detached first, and then the system |
65 | driver takes over the consoles vacated by the driver. Binding, on the other | 73 | driver takes over the consoles vacated by the driver. Binding, on the other |
66 | hand, will bind the driver to the consoles that are currently occupied by a | 74 | hand, will bind the driver to the consoles that are currently occupied by a |
67 | system driver. | 75 | system driver. |
68 | 76 | ||
77 | NOTE1: Binding and binding must be selected in Kconfig. It's under: | ||
78 | |||
79 | Device Drivers -> Character devices -> Support for binding and unbinding | ||
80 | console drivers | ||
81 | |||
82 | NOTE2: If any of the virtual consoles are in KD_GRAPHICS mode, then binding or | ||
83 | unbinding will not succeed. An example of an application that sets the console | ||
84 | to KD_GRAPHICS is X. | ||
85 | |||
69 | How useful is this feature? This is very useful for console driver | 86 | How useful is this feature? This is very useful for console driver |
70 | developers. By unbinding the driver from the console layer, one can unload the | 87 | developers. By unbinding the driver from the console layer, one can unload the |
71 | driver, make changes, recompile, reload and rebind the driver without any need | 88 | driver, make changes, recompile, reload and rebind the driver without any need |
diff --git a/Documentation/fb/fbcon.txt b/Documentation/fb/fbcon.txt index b91aea57a98e..f373df12ed4c 100644 --- a/Documentation/fb/fbcon.txt +++ b/Documentation/fb/fbcon.txt | |||
@@ -180,10 +180,13 @@ fbcon. | |||
180 | So, how do we unbind fbcon from the console? Part of the answer is in | 180 | So, how do we unbind fbcon from the console? Part of the answer is in |
181 | Documentation/console/console.txt. To summarize: | 181 | Documentation/console/console.txt. To summarize: |
182 | 182 | ||
183 | Echo the ID number of the 'frame buffer driver' to: | 183 | Echo a value to the bind file that represents the framebuffer console |
184 | driver. So assuming vtcon1 represents fbcon, then: | ||
184 | 185 | ||
185 | sys/class/tty/console/bind - attach framebuffer console to console layer | 186 | echo 1 > sys/class/vtconsole/vtcon1/bind - attach framebuffer console to |
186 | sys/class/tty/console/unbind - detach framebuffer console from console layer | 187 | console layer |
188 | echo 0 > sys/class/vtconsole/vtcon1/bind - detach framebuffer console from | ||
189 | console layer | ||
187 | 190 | ||
188 | If fbcon is detached from the console layer, your boot console driver (which is | 191 | If fbcon is detached from the console layer, your boot console driver (which is |
189 | usually VGA text mode) will take over. A few drivers (rivafb and i810fb) will | 192 | 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: | |||
211 | 214 | ||
212 | 5. Now to detach fbcon: | 215 | 5. Now to detach fbcon: |
213 | 216 | ||
214 | 'cat /sys/class/tty/console/backend' and take note of the ID | ||
215 | |||
216 | The above is probably needed only once. Then: | ||
217 | |||
218 | vbetool vbestate restore < <vga state file> && \ | 217 | vbetool vbestate restore < <vga state file> && \ |
219 | echo <ID> > /sys/class/tty/console/unbind | 218 | echo 0 > /sys/class/vtconsole/vtcon1/bind |
220 | 219 | ||
221 | 6. That's it, you're back to VGA mode. And if you compiled fbcon as a module, | 220 | 6. That's it, you're back to VGA mode. And if you compiled fbcon as a module, |
222 | you can unload it by 'rmmod fbcon' | 221 | you can unload it by 'rmmod fbcon' |
223 | 222 | ||
224 | 7. To reattach fbcon: | 223 | 7. To reattach fbcon: |
225 | 224 | ||
226 | echo <ID> > /sys/class/tty/console/bind | 225 | echo 1 > /sys/class/vtconsole/vtcon1/bind |
227 | 226 | ||
228 | 8. Once fbcon is unbound, all drivers registered to the system will also | 227 | 8. Once fbcon is unbound, all drivers registered to the system will also |
229 | become unbound. This means that fbcon and individual framebuffer drivers | 228 | become unbound. This means that fbcon and individual framebuffer drivers |
@@ -254,6 +253,8 @@ Variation 1: | |||
254 | c. Attach fbcon | 253 | c. Attach fbcon |
255 | 254 | ||
256 | vbetool vbestate restore < <vesa state file> && \ | 255 | vbetool vbestate restore < <vesa state file> && \ |
256 | echo 1 > /sys/class/vtconsole/vtcon1/bind | ||
257 | |||
257 | Variation 2: | 258 | Variation 2: |
258 | 259 | ||
259 | a. Before detaching fbcon, do: | 260 | a. Before detaching fbcon, do: |
@@ -269,7 +270,55 @@ Variation 2: | |||
269 | c. Attach fbcon: | 270 | c. Attach fbcon: |
270 | 271 | ||
271 | vbetool vbemode set <mode number> && \ | 272 | vbetool vbemode set <mode number> && \ |
272 | echo <ID> > /sys/class/tty/console/bind | 273 | echo 1 > /sys/class/vtconsole/vtcon1/bind |
274 | |||
275 | Samples: | ||
276 | ======== | ||
277 | |||
278 | Here are 2 sample bash scripts that you can use to bind or unbind the | ||
279 | framebuffer console driver if you are in an X86 box: | ||
280 | |||
281 | --------------------------------------------------------------------------- | ||
282 | #!/bin/bash | ||
283 | # Unbind fbcon | ||
284 | |||
285 | # Change this to where your actual vgastate file is located | ||
286 | # Or Use VGASTATE=$1 to indicate the state file at runtime | ||
287 | VGASTATE=/tmp/vgastate | ||
288 | |||
289 | # path to vbetool | ||
290 | VBETOOL=/usr/local/bin | ||
291 | |||
292 | |||
293 | for (( i = 0; i < 16; i++)) | ||
294 | do | ||
295 | if test -x /sys/class/vtconsole/vtcon$i; then | ||
296 | if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \ | ||
297 | = 1 ]; then | ||
298 | if test -x $VBETOOL/vbetool; then | ||
299 | echo Unbinding vtcon$i | ||
300 | $VBETOOL/vbetool vbestate restore < $VGASTATE | ||
301 | echo 0 > /sys/class/vtconsole/vtcon$i/bind | ||
302 | fi | ||
303 | fi | ||
304 | fi | ||
305 | done | ||
306 | |||
307 | --------------------------------------------------------------------------- | ||
308 | #!/bin/bash | ||
309 | # Bind fbcon | ||
310 | |||
311 | for (( i = 0; i < 16; i++)) | ||
312 | do | ||
313 | if test -x /sys/class/vtconsole/vtcon$i; then | ||
314 | if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \ | ||
315 | = 1 ]; then | ||
316 | echo Unbinding vtcon$i | ||
317 | echo 1 > /sys/class/vtconsole/vtcon$i/bind | ||
318 | fi | ||
319 | fi | ||
320 | done | ||
321 | --------------------------------------------------------------------------- | ||
273 | 322 | ||
274 | -- | 323 | -- |
275 | Antonino Daplas <adaplas@pol.net> | 324 | Antonino Daplas <adaplas@pol.net> |