libkeymap: Do not dump diacr values if lk_dump_keymap called
[platform/upstream/kbd.git] / doc / kbd.FAQ-7.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4  <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5  <TITLE>The Linux keyboard and console HOWTO: Console switching</TITLE>
6  <LINK HREF="kbd.FAQ-8.html" REL=next>
7  <LINK HREF="kbd.FAQ-6.html" REL=previous>
8  <LINK HREF="kbd.FAQ.html#toc7" REL=contents>
9 </HEAD>
10 <BODY>
11 <A HREF="kbd.FAQ-8.html">Next</A>
12 <A HREF="kbd.FAQ-6.html">Previous</A>
13 <A HREF="kbd.FAQ.html#toc7">Contents</A>
14 <HR>
15 <H2><A NAME="s7">7. Console switching</A></H2>
16
17 <P>
18 <!--
19 console!switching
20 -->
21 <P>By default, console switching is done using Alt-Fn or Ctrl-Alt-Fn.
22 Under <CODE>X</CODE> (or recent versions of <CODE>dosemu</CODE>), only Ctrl-Alt-Fn works.
23 Many keymaps will allow cyclic walks through all allocated consoles
24 using Alt-RightArrow and Alt-LeftArrow.
25 <P>XFree86 1.3 does not know that Alt is down when you switch to the X
26 window. Thus, you cannot switch immediately to some other VT again
27 but have to release Alt first.
28 In the other direction this should work: the kernel always keeps
29 track of the up/down status of all keys. (As far as possible: on some
30 keyboards some keys do not emit a scancode when pressed (e.g.: the PFn
31 keys of a FOCUS 9000) or released (e.g.: the Pause key of many keyboards).)
32 <P>XFree86 1.3 saves the fonts loaded in the character ROMs when started,
33 and restores it on a console switch. Thus, the result of <CODE>setfont</CODE> on
34 a VT is wiped out when you go to X and back.
35 Using <CODE>setfont</CODE> under X will lead to funny results.
36 <P>One can change VT under program control using the <CODE>chvt</CODE> command.
37 <P>
38 <H2><A NAME="ss7.1">7.1 Changing the number of Virtual Consoles</A>
39 </H2>
40
41 <P>
42 <!--
43 console!changing number of
44 -->
45 <P>This question still comes up from time to time, but the answer is:
46 you already have enough of them.
47 Since kernel version 1.1.54, there are between 1 and 63 virtual
48 consoles. A new one is created as soon as it is opened. It is
49 removed by the utility <CODE>deallocvt</CODE> (but it can be removed only when
50 no processes are associated to it anymore, and no text on it has been
51 selected by programs like <CODE>selection</CODE> or <CODE>gpm</CODE>).
52 <P>For older kernels, change the line
53 <BLOCKQUOTE><CODE>
54 <PRE>
55         #define NR_CONSOLES     8
56 </PRE>
57 </CODE></BLOCKQUOTE>
58
59 in <CODE>include/linux/tty.h</CODE> (don't increase this number beyond 63),
60 and recompile the kernel.
61 <P>If they do not exist yet, create the tty devices with <CODE>MAKEDEV</CODE>
62 or <CODE>mknod tty</CODE>N <CODE>c 4</CODE> N where N denotes the tty number. For example,
63 <BLOCKQUOTE><CODE>
64 <PRE>
65         for i in 9 10 11 12; do mknod /dev/tty$i c 4 $i; done
66 </PRE>
67 </CODE></BLOCKQUOTE>
68
69 or, better (since it also takes care of owner and permissions),
70 <BLOCKQUOTE><CODE>
71 <PRE>
72         for i in 9 10 11 12; do /dev/MAKEDEV tty$i; done
73 </PRE>
74 </CODE></BLOCKQUOTE>
75 <P>If you want the new VCs to run <CODE>getty</CODE>, add lines in <CODE>/etc/inittab</CODE>.
76 (But it is much better to have only two <CODE>getty</CODE>'s running,
77 and to create more consoles dynamically as the need arises.
78 That way you'll have more memory when you don't use all these consoles,
79 and also more consoles, in case you really need them.
80 Edit <CODE>/etc/inittab</CODE> and comment out all <CODE>getty</CODE>'s except
81 for the first two.)
82 <P>When the consoles are allocated dynamically, it is usually easiest
83 to have only one or two running <CODE>getty</CODE>. More are opened by
84 <CODE>open -l -s bash</CODE>. Unused consoles (without associated processes)
85 are deallocated using <CODE>deallocvt</CODE> (formerly <CODE>disalloc</CODE>).
86 But, you say, I am involved in activities when I suddenly need more
87 consoles, and do not have a bash prompt available to give the <CODE>open</CODE>
88 command.
89 Fortunately it is possible to create a new console upon a single
90 keystroke, regardless of what is happening at the current console.
91 <P>If you have <CODE>spawn_login</CODE> from <CODE>kbd-1.04.tar.gz</CODE> and you put
92 <BLOCKQUOTE><CODE>
93 <PRE>
94         loadkeys &lt;&lt; EOF
95         alt keycode 103 = Spawn_Console
96         EOF
97         spawn_login &amp;
98 </PRE>
99 </CODE></BLOCKQUOTE>
100
101 in <CODE>/etc/rc.local</CODE>, then typing Alt-UpArrow will create a fresh VC
102 running <CODE>login</CODE> (and switch to it). With <CODE>spawn_console &amp;</CODE> instead of
103 <CODE>spawn_login &amp;</CODE> you'll have bash running there.
104 See also <CODE>open-1.4.tgz</CODE> and <CODE>dynamic-vc-1.1.tar.gz</CODE>.
105 <P>What action should be taken upon this Spawn_Console keypress
106 can also be set in <CODE>/etc/inittab</CODE> under <CODE>kbrequest</CODE>,
107 if you have a recent <CODE>init</CODE>. See inittab(5).
108 <P>(This action can be something entirely different - I just called
109 the key Spawn_Console because that is what I used it for.
110 When used for other purposes it is less confusing to use
111 its synonym KeyboardSignal.
112 For example, some people like to put the lines
113 <BLOCKQUOTE><CODE>
114 <PRE>
115         kb::kbrequest:/sbin/shutdown -h now
116 </PRE>
117 </CODE></BLOCKQUOTE>
118
119 in <CODE>/etc/inittab</CODE>, and
120 <BLOCKQUOTE><CODE>
121 <PRE>
122         control alt keycode 79 = KeyboardSignal
123         control alt keycode 107 = KeyboardSignal
124 </PRE>
125 </CODE></BLOCKQUOTE>
126
127 in their keymap. Now Ctrl-Alt-End will do a system shutdown.)
128 <P>You can only login as "root" on terminals listed in <CODE>/etc/securetty</CODE>.
129 There exist programs that read terminal settings from files
130 <CODE>/etc/ttys</CODE> and <CODE>/etc/ttytype</CODE>. If you have such
131 files, and create additional consoles, then it might be a good idea
132 to also add entries for them in these files.
133 <P>
134 <HR>
135 <A HREF="kbd.FAQ-8.html">Next</A>
136 <A HREF="kbd.FAQ-6.html">Previous</A>
137 <A HREF="kbd.FAQ.html#toc7">Contents</A>
138 </BODY>
139 </HTML>