xref: /linux/Documentation/fb/fbcon.rst (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
1ab42b818SMauro Carvalho Chehab=======================
2ab42b818SMauro Carvalho ChehabThe Framebuffer Console
3ab42b818SMauro Carvalho Chehab=======================
4ab42b818SMauro Carvalho Chehab
5ab42b818SMauro Carvalho ChehabThe framebuffer console (fbcon), as its name implies, is a text
6ab42b818SMauro Carvalho Chehabconsole running on top of the framebuffer device. It has the functionality of
7ab42b818SMauro Carvalho Chehabany standard text console driver, such as the VGA console, with the added
8ab42b818SMauro Carvalho Chehabfeatures that can be attributed to the graphical nature of the framebuffer.
9ab42b818SMauro Carvalho Chehab
10ab42b818SMauro Carvalho ChehabIn the x86 architecture, the framebuffer console is optional, and
11ab42b818SMauro Carvalho Chehabsome even treat it as a toy. For other architectures, it is the only available
12ab42b818SMauro Carvalho Chehabdisplay device, text or graphical.
13ab42b818SMauro Carvalho Chehab
14ab42b818SMauro Carvalho ChehabWhat are the features of fbcon?  The framebuffer console supports
15ab42b818SMauro Carvalho Chehabhigh resolutions, varying font types, display rotation, primitive multihead,
16ab42b818SMauro Carvalho Chehabetc. Theoretically, multi-colored fonts, blending, aliasing, and any feature
17ab42b818SMauro Carvalho Chehabmade available by the underlying graphics card are also possible.
18ab42b818SMauro Carvalho Chehab
19ab42b818SMauro Carvalho ChehabA. Configuration
20ab42b818SMauro Carvalho Chehab================
21ab42b818SMauro Carvalho Chehab
22ab42b818SMauro Carvalho ChehabThe framebuffer console can be enabled by using your favorite kernel
233f9dfc2aSBilal Wasimconfiguration tool.  It is under Device Drivers->Graphics Support->
243f9dfc2aSBilal WasimConsole display driver support->Framebuffer Console Support.
25ab42b818SMauro Carvalho ChehabSelect 'y' to compile support statically or 'm' for module support.  The
26ab42b818SMauro Carvalho Chehabmodule will be fbcon.
27ab42b818SMauro Carvalho Chehab
28ab42b818SMauro Carvalho ChehabIn order for fbcon to activate, at least one framebuffer driver is
29ab42b818SMauro Carvalho Chehabrequired, so choose from any of the numerous drivers available. For x86
30ab42b818SMauro Carvalho Chehabsystems, they almost universally have VGA cards, so vga16fb and vesafb will
31ab42b818SMauro Carvalho Chehabalways be available. However, using a chipset-specific driver will give you
32ab42b818SMauro Carvalho Chehabmore speed and features, such as the ability to change the video mode
33ab42b818SMauro Carvalho Chehabdynamically.
34ab42b818SMauro Carvalho Chehab
35ab42b818SMauro Carvalho ChehabTo display the penguin logo, choose any logo available in Graphics
36ab42b818SMauro Carvalho Chehabsupport->Bootup logo.
37ab42b818SMauro Carvalho Chehab
38ab42b818SMauro Carvalho ChehabAlso, you will need to select at least one compiled-in font, but if
39ab42b818SMauro Carvalho Chehabyou don't do anything, the kernel configuration tool will select one for you,
40ab42b818SMauro Carvalho Chehabusually an 8x16 font.
41ab42b818SMauro Carvalho Chehab
42ab42b818SMauro Carvalho ChehabGOTCHA: A common bug report is enabling the framebuffer without enabling the
43ab42b818SMauro Carvalho Chehabframebuffer console.  Depending on the driver, you may get a blanked or
44ab42b818SMauro Carvalho Chehabgarbled display, but the system still boots to completion.  If you are
45ab42b818SMauro Carvalho Chehabfortunate to have a driver that does not alter the graphics chip, then you
46ab42b818SMauro Carvalho Chehabwill still get a VGA console.
47ab42b818SMauro Carvalho Chehab
48ab42b818SMauro Carvalho ChehabB. Loading
49ab42b818SMauro Carvalho Chehab==========
50ab42b818SMauro Carvalho Chehab
51ab42b818SMauro Carvalho ChehabPossible scenarios:
52ab42b818SMauro Carvalho Chehab
53ab42b818SMauro Carvalho Chehab1. Driver and fbcon are compiled statically
54ab42b818SMauro Carvalho Chehab
55ab42b818SMauro Carvalho Chehab	 Usually, fbcon will automatically take over your console. The notable
56ab42b818SMauro Carvalho Chehab	 exception is vesafb.  It needs to be explicitly activated with the
57ab42b818SMauro Carvalho Chehab	 vga= boot option parameter.
58ab42b818SMauro Carvalho Chehab
59ab42b818SMauro Carvalho Chehab2. Driver is compiled statically, fbcon is compiled as a module
60ab42b818SMauro Carvalho Chehab
61ab42b818SMauro Carvalho Chehab	 Depending on the driver, you either get a standard console, or a
62ab42b818SMauro Carvalho Chehab	 garbled display, as mentioned above.  To get a framebuffer console,
63ab42b818SMauro Carvalho Chehab	 do a 'modprobe fbcon'.
64ab42b818SMauro Carvalho Chehab
65ab42b818SMauro Carvalho Chehab3. Driver is compiled as a module, fbcon is compiled statically
66ab42b818SMauro Carvalho Chehab
67ab42b818SMauro Carvalho Chehab	 You get your standard console.  Once the driver is loaded with
68ab42b818SMauro Carvalho Chehab	 'modprobe xxxfb', fbcon automatically takes over the console with
69ab42b818SMauro Carvalho Chehab	 the possible exception of using the fbcon=map:n option. See below.
70ab42b818SMauro Carvalho Chehab
71ab42b818SMauro Carvalho Chehab4. Driver and fbcon are compiled as a module.
72ab42b818SMauro Carvalho Chehab
73ab42b818SMauro Carvalho Chehab	 You can load them in any order. Once both are loaded, fbcon will take
74ab42b818SMauro Carvalho Chehab	 over the console.
75ab42b818SMauro Carvalho Chehab
76ab42b818SMauro Carvalho ChehabC. Boot options
77ab42b818SMauro Carvalho Chehab
78ab42b818SMauro Carvalho Chehab	 The framebuffer console has several, largely unknown, boot options
79ab42b818SMauro Carvalho Chehab	 that can change its behavior.
80ab42b818SMauro Carvalho Chehab
81ab42b818SMauro Carvalho Chehab1. fbcon=font:<name>
82ab42b818SMauro Carvalho Chehab
83ab42b818SMauro Carvalho Chehab	Select the initial font to use. The value 'name' can be any of the
84eda4a7bfSPeilin Ye	compiled-in fonts: 10x18, 6x10, 6x8, 7x14, Acorn8x8, MINI4x6,
850ad6be30STakashi Iwai	PEARL8x8, ProFont6x11, SUN12x22, SUN8x16, TER16x32, VGA8x16, VGA8x8.
86ab42b818SMauro Carvalho Chehab
87ab42b818SMauro Carvalho Chehab	Note, not all drivers can handle font with widths not divisible by 8,
88ab42b818SMauro Carvalho Chehab	such as vga16fb.
89ab42b818SMauro Carvalho Chehab
90ab42b818SMauro Carvalho Chehab
91cc3c2a62SBhaskar Chowdhury2. fbcon=map:<0123>
92ab42b818SMauro Carvalho Chehab
93ab42b818SMauro Carvalho Chehab	This is an interesting option. It tells which driver gets mapped to
94ab42b818SMauro Carvalho Chehab	which console. The value '0123' is a sequence that gets repeated until
95ab42b818SMauro Carvalho Chehab	the total length is 64 which is the number of consoles available. In
96ab42b818SMauro Carvalho Chehab	the above example, it is expanded to 012301230123... and the mapping
97ab42b818SMauro Carvalho Chehab	will be::
98ab42b818SMauro Carvalho Chehab
99ab42b818SMauro Carvalho Chehab		tty | 1 2 3 4 5 6 7 8 9 ...
100ab42b818SMauro Carvalho Chehab		fb  | 0 1 2 3 0 1 2 3 0 ...
101ab42b818SMauro Carvalho Chehab
102ab42b818SMauro Carvalho Chehab		('cat /proc/fb' should tell you what the fb numbers are)
103ab42b818SMauro Carvalho Chehab
104ab42b818SMauro Carvalho Chehab	One side effect that may be useful is using a map value that exceeds
105ab42b818SMauro Carvalho Chehab	the number of loaded fb drivers. For example, if only one driver is
106ab42b818SMauro Carvalho Chehab	available, fb0, adding fbcon=map:1 tells fbcon not to take over the
107ab42b818SMauro Carvalho Chehab	console.
108ab42b818SMauro Carvalho Chehab
109ab42b818SMauro Carvalho Chehab	Later on, when you want to map the console the to the framebuffer
110ab42b818SMauro Carvalho Chehab	device, you can use the con2fbmap utility.
111ab42b818SMauro Carvalho Chehab
112cc3c2a62SBhaskar Chowdhury3. fbcon=vc:<n1>-<n2>
113ab42b818SMauro Carvalho Chehab
114ab42b818SMauro Carvalho Chehab	This option tells fbcon to take over only a range of consoles as
115ab42b818SMauro Carvalho Chehab	specified by the values 'n1' and 'n2'. The rest of the consoles
116ab42b818SMauro Carvalho Chehab	outside the given range will still be controlled by the standard
117ab42b818SMauro Carvalho Chehab	console driver.
118ab42b818SMauro Carvalho Chehab
119ab42b818SMauro Carvalho Chehab	NOTE: For x86 machines, the standard console is the VGA console which
120ab42b818SMauro Carvalho Chehab	is typically located on the same video card.  Thus, the consoles that
121ab42b818SMauro Carvalho Chehab	are controlled by the VGA console will be garbled.
122ab42b818SMauro Carvalho Chehab
123cc3c2a62SBhaskar Chowdhury4. fbcon=rotate:<n>
124ab42b818SMauro Carvalho Chehab
125ab42b818SMauro Carvalho Chehab	This option changes the orientation angle of the console display. The
126ab42b818SMauro Carvalho Chehab	value 'n' accepts the following:
127ab42b818SMauro Carvalho Chehab
128ab42b818SMauro Carvalho Chehab	    - 0 - normal orientation (0 degree)
129ab42b818SMauro Carvalho Chehab	    - 1 - clockwise orientation (90 degrees)
130ab42b818SMauro Carvalho Chehab	    - 2 - upside down orientation (180 degrees)
131ab42b818SMauro Carvalho Chehab	    - 3 - counterclockwise orientation (270 degrees)
132ab42b818SMauro Carvalho Chehab
133ab42b818SMauro Carvalho Chehab	The angle can be changed anytime afterwards by 'echoing' the same
134ab42b818SMauro Carvalho Chehab	numbers to any one of the 2 attributes found in
135ab42b818SMauro Carvalho Chehab	/sys/class/graphics/fbcon:
136ab42b818SMauro Carvalho Chehab
137ab42b818SMauro Carvalho Chehab		- rotate     - rotate the display of the active console
138ab42b818SMauro Carvalho Chehab		- rotate_all - rotate the display of all consoles
139ab42b818SMauro Carvalho Chehab
140ab42b818SMauro Carvalho Chehab	Console rotation will only become available if Framebuffer Console
141ab42b818SMauro Carvalho Chehab	Rotation support is compiled in your kernel.
142ab42b818SMauro Carvalho Chehab
143ab42b818SMauro Carvalho Chehab	NOTE: This is purely console rotation.  Any other applications that
144ab42b818SMauro Carvalho Chehab	use the framebuffer will remain at their 'normal' orientation.
145ab42b818SMauro Carvalho Chehab	Actually, the underlying fb driver is totally ignorant of console
146ab42b818SMauro Carvalho Chehab	rotation.
147ab42b818SMauro Carvalho Chehab
148cc3c2a62SBhaskar Chowdhury5. fbcon=margin:<color>
149ab42b818SMauro Carvalho Chehab
150ab42b818SMauro Carvalho Chehab	This option specifies the color of the margins. The margins are the
151ab42b818SMauro Carvalho Chehab	leftover area at the right and the bottom of the screen that are not
152ab42b818SMauro Carvalho Chehab	used by text. By default, this area will be black. The 'color' value
153ab42b818SMauro Carvalho Chehab	is an integer number that depends on the framebuffer driver being used.
154ab42b818SMauro Carvalho Chehab
155cc3c2a62SBhaskar Chowdhury6. fbcon=nodefer
156ab42b818SMauro Carvalho Chehab
157ab42b818SMauro Carvalho Chehab	If the kernel is compiled with deferred fbcon takeover support, normally
158ab42b818SMauro Carvalho Chehab	the framebuffer contents, left in place by the firmware/bootloader, will
159ab42b818SMauro Carvalho Chehab	be preserved until there actually is some text is output to the console.
160ab42b818SMauro Carvalho Chehab	This option causes fbcon to bind immediately to the fbdev device.
161ab42b818SMauro Carvalho Chehab
162cc3c2a62SBhaskar Chowdhury7. fbcon=logo-pos:<location>
163ab42b818SMauro Carvalho Chehab
164ab42b818SMauro Carvalho Chehab	The only possible 'location' is 'center' (without quotes), and when
165ab42b818SMauro Carvalho Chehab	given, the bootup logo is moved from the default top-left corner
166ab42b818SMauro Carvalho Chehab	location to the center of the framebuffer. If more than one logo is
167ab42b818SMauro Carvalho Chehab	displayed due to multiple CPUs, the collected line of logos is moved
168ab42b818SMauro Carvalho Chehab	as a whole.
169ab42b818SMauro Carvalho Chehab
170cc3c2a62SBhaskar Chowdhury8. fbcon=logo-count:<n>
171691f50abSPeter Rosin
172691f50abSPeter Rosin	The value 'n' overrides the number of bootup logos. 0 disables the
173691f50abSPeter Rosin	logo, and -1 gives the default which is the number of online CPUs.
174691f50abSPeter Rosin
175ab42b818SMauro Carvalho ChehabC. Attaching, Detaching and Unloading
176ab42b818SMauro Carvalho Chehab
177ab42b818SMauro Carvalho ChehabBefore going on to how to attach, detach and unload the framebuffer console, an
178ab42b818SMauro Carvalho Chehabillustration of the dependencies may help.
179ab42b818SMauro Carvalho Chehab
180ab42b818SMauro Carvalho ChehabThe console layer, as with most subsystems, needs a driver that interfaces with
181ab42b818SMauro Carvalho Chehabthe hardware. Thus, in a VGA console::
182ab42b818SMauro Carvalho Chehab
183ab42b818SMauro Carvalho Chehab	console ---> VGA driver ---> hardware.
184ab42b818SMauro Carvalho Chehab
185ab42b818SMauro Carvalho ChehabAssuming the VGA driver can be unloaded, one must first unbind the VGA driver
186ab42b818SMauro Carvalho Chehabfrom the console layer before unloading the driver.  The VGA driver cannot be
187ab42b818SMauro Carvalho Chehabunloaded if it is still bound to the console layer. (See
188baa293e9SMauro Carvalho ChehabDocumentation/driver-api/console.rst for more information).
189ab42b818SMauro Carvalho Chehab
190ab42b818SMauro Carvalho ChehabThis is more complicated in the case of the framebuffer console (fbcon),
191ab42b818SMauro Carvalho Chehabbecause fbcon is an intermediate layer between the console and the drivers::
192ab42b818SMauro Carvalho Chehab
193ab42b818SMauro Carvalho Chehab	console ---> fbcon ---> fbdev drivers ---> hardware
194ab42b818SMauro Carvalho Chehab
195ab42b818SMauro Carvalho ChehabThe fbdev drivers cannot be unloaded if bound to fbcon, and fbcon cannot
196ab42b818SMauro Carvalho Chehabbe unloaded if it's bound to the console layer.
197ab42b818SMauro Carvalho Chehab
198ab42b818SMauro Carvalho ChehabSo to unload the fbdev drivers, one must first unbind fbcon from the console,
199ab42b818SMauro Carvalho Chehabthen unbind the fbdev drivers from fbcon.  Fortunately, unbinding fbcon from
200ab42b818SMauro Carvalho Chehabthe console layer will automatically unbind framebuffer drivers from
201ab42b818SMauro Carvalho Chehabfbcon. Thus, there is no need to explicitly unbind the fbdev drivers from
202ab42b818SMauro Carvalho Chehabfbcon.
203ab42b818SMauro Carvalho Chehab
204ab42b818SMauro Carvalho ChehabSo, how do we unbind fbcon from the console? Part of the answer is in
205baa293e9SMauro Carvalho ChehabDocumentation/driver-api/console.rst. To summarize:
206ab42b818SMauro Carvalho Chehab
207ab42b818SMauro Carvalho ChehabEcho a value to the bind file that represents the framebuffer console
208ab42b818SMauro Carvalho Chehabdriver. So assuming vtcon1 represents fbcon, then::
209ab42b818SMauro Carvalho Chehab
210*abb9c078SMark O'Donovan  echo 1 > /sys/class/vtconsole/vtcon1/bind - attach framebuffer console to
211ab42b818SMauro Carvalho Chehab					     console layer
212*abb9c078SMark O'Donovan  echo 0 > /sys/class/vtconsole/vtcon1/bind - detach framebuffer console from
213ab42b818SMauro Carvalho Chehab					     console layer
214ab42b818SMauro Carvalho Chehab
215ab42b818SMauro Carvalho ChehabIf fbcon is detached from the console layer, your boot console driver (which is
216ab42b818SMauro Carvalho Chehabusually VGA text mode) will take over.  A few drivers (rivafb and i810fb) will
217ab42b818SMauro Carvalho Chehabrestore VGA text mode for you.  With the rest, before detaching fbcon, you
218ab42b818SMauro Carvalho Chehabmust take a few additional steps to make sure that your VGA text mode is
219ab42b818SMauro Carvalho Chehabrestored properly. The following is one of the several methods that you can do:
220ab42b818SMauro Carvalho Chehab
221ab42b818SMauro Carvalho Chehab1. Download or install vbetool.  This utility is included with most
222ab42b818SMauro Carvalho Chehab   distributions nowadays, and is usually part of the suspend/resume tool.
223ab42b818SMauro Carvalho Chehab
224ab42b818SMauro Carvalho Chehab2. In your kernel configuration, ensure that CONFIG_FRAMEBUFFER_CONSOLE is set
225ab42b818SMauro Carvalho Chehab   to 'y' or 'm'. Enable one or more of your favorite framebuffer drivers.
226ab42b818SMauro Carvalho Chehab
227ab42b818SMauro Carvalho Chehab3. Boot into text mode and as root run::
228ab42b818SMauro Carvalho Chehab
229ab42b818SMauro Carvalho Chehab	vbetool vbestate save > <vga state file>
230ab42b818SMauro Carvalho Chehab
231ab42b818SMauro Carvalho Chehab   The above command saves the register contents of your graphics
232ab42b818SMauro Carvalho Chehab   hardware to <vga state file>.  You need to do this step only once as
233ab42b818SMauro Carvalho Chehab   the state file can be reused.
234ab42b818SMauro Carvalho Chehab
235ab42b818SMauro Carvalho Chehab4. If fbcon is compiled as a module, load fbcon by doing::
236ab42b818SMauro Carvalho Chehab
237ab42b818SMauro Carvalho Chehab       modprobe fbcon
238ab42b818SMauro Carvalho Chehab
239ab42b818SMauro Carvalho Chehab5. Now to detach fbcon::
240ab42b818SMauro Carvalho Chehab
241ab42b818SMauro Carvalho Chehab       vbetool vbestate restore < <vga state file> && \
242ab42b818SMauro Carvalho Chehab       echo 0 > /sys/class/vtconsole/vtcon1/bind
243ab42b818SMauro Carvalho Chehab
244ab42b818SMauro Carvalho Chehab6. That's it, you're back to VGA mode. And if you compiled fbcon as a module,
245ab42b818SMauro Carvalho Chehab   you can unload it by 'rmmod fbcon'.
246ab42b818SMauro Carvalho Chehab
247ab42b818SMauro Carvalho Chehab7. To reattach fbcon::
248ab42b818SMauro Carvalho Chehab
249ab42b818SMauro Carvalho Chehab       echo 1 > /sys/class/vtconsole/vtcon1/bind
250ab42b818SMauro Carvalho Chehab
251ab42b818SMauro Carvalho Chehab8. Once fbcon is unbound, all drivers registered to the system will also
252ab42b818SMauro Carvalho Chehabbecome unbound.  This means that fbcon and individual framebuffer drivers
253ab42b818SMauro Carvalho Chehabcan be unloaded or reloaded at will. Reloading the drivers or fbcon will
254ab42b818SMauro Carvalho Chehabautomatically bind the console, fbcon and the drivers together. Unloading
255ab42b818SMauro Carvalho Chehaball the drivers without unloading fbcon will make it impossible for the
256ab42b818SMauro Carvalho Chehabconsole to bind fbcon.
257ab42b818SMauro Carvalho Chehab
258ab42b818SMauro Carvalho ChehabNotes for vesafb users:
259ab42b818SMauro Carvalho Chehab=======================
260ab42b818SMauro Carvalho Chehab
261ab42b818SMauro Carvalho ChehabUnfortunately, if your bootline includes a vga=xxx parameter that sets the
262ab42b818SMauro Carvalho Chehabhardware in graphics mode, such as when loading vesafb, vgacon will not load.
263ab42b818SMauro Carvalho ChehabInstead, vgacon will replace the default boot console with dummycon, and you
264ab42b818SMauro Carvalho Chehabwon't get any display after detaching fbcon. Your machine is still alive, so
265ab42b818SMauro Carvalho Chehabyou can reattach vesafb. However, to reattach vesafb, you need to do one of
266ab42b818SMauro Carvalho Chehabthe following:
267ab42b818SMauro Carvalho Chehab
268ab42b818SMauro Carvalho ChehabVariation 1:
269ab42b818SMauro Carvalho Chehab
270ab42b818SMauro Carvalho Chehab    a. Before detaching fbcon, do::
271ab42b818SMauro Carvalho Chehab
272ab42b818SMauro Carvalho Chehab	vbetool vbemode save > <vesa state file> # do once for each vesafb mode,
273ab42b818SMauro Carvalho Chehab						 # the file can be reused
274ab42b818SMauro Carvalho Chehab
275ab42b818SMauro Carvalho Chehab    b. Detach fbcon as in step 5.
276ab42b818SMauro Carvalho Chehab
277ab42b818SMauro Carvalho Chehab    c. Attach fbcon::
278ab42b818SMauro Carvalho Chehab
279ab42b818SMauro Carvalho Chehab	vbetool vbestate restore < <vesa state file> && \
280ab42b818SMauro Carvalho Chehab	echo 1 > /sys/class/vtconsole/vtcon1/bind
281ab42b818SMauro Carvalho Chehab
282ab42b818SMauro Carvalho ChehabVariation 2:
283ab42b818SMauro Carvalho Chehab
284ab42b818SMauro Carvalho Chehab    a. Before detaching fbcon, do::
285ab42b818SMauro Carvalho Chehab
286ab42b818SMauro Carvalho Chehab	echo <ID> > /sys/class/tty/console/bind
287ab42b818SMauro Carvalho Chehab
288ab42b818SMauro Carvalho Chehab	vbetool vbemode get
289ab42b818SMauro Carvalho Chehab
290ab42b818SMauro Carvalho Chehab    b. Take note of the mode number
291ab42b818SMauro Carvalho Chehab
292ab42b818SMauro Carvalho Chehab    b. Detach fbcon as in step 5.
293ab42b818SMauro Carvalho Chehab
294ab42b818SMauro Carvalho Chehab    c. Attach fbcon::
295ab42b818SMauro Carvalho Chehab
296ab42b818SMauro Carvalho Chehab	vbetool vbemode set <mode number> && \
297ab42b818SMauro Carvalho Chehab	echo 1 > /sys/class/vtconsole/vtcon1/bind
298ab42b818SMauro Carvalho Chehab
299ab42b818SMauro Carvalho ChehabSamples:
300ab42b818SMauro Carvalho Chehab========
301ab42b818SMauro Carvalho Chehab
302ab42b818SMauro Carvalho ChehabHere are 2 sample bash scripts that you can use to bind or unbind the
303ab42b818SMauro Carvalho Chehabframebuffer console driver if you are on an X86 box::
304ab42b818SMauro Carvalho Chehab
305ab42b818SMauro Carvalho Chehab  #!/bin/bash
306ab42b818SMauro Carvalho Chehab  # Unbind fbcon
307ab42b818SMauro Carvalho Chehab
308ab42b818SMauro Carvalho Chehab  # Change this to where your actual vgastate file is located
309ab42b818SMauro Carvalho Chehab  # Or Use VGASTATE=$1 to indicate the state file at runtime
310ab42b818SMauro Carvalho Chehab  VGASTATE=/tmp/vgastate
311ab42b818SMauro Carvalho Chehab
312ab42b818SMauro Carvalho Chehab  # path to vbetool
313ab42b818SMauro Carvalho Chehab  VBETOOL=/usr/local/bin
314ab42b818SMauro Carvalho Chehab
315ab42b818SMauro Carvalho Chehab
316ab42b818SMauro Carvalho Chehab  for (( i = 0; i < 16; i++))
317ab42b818SMauro Carvalho Chehab  do
318ab42b818SMauro Carvalho Chehab    if test -x /sys/class/vtconsole/vtcon$i; then
319ab42b818SMauro Carvalho Chehab	if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \
320ab42b818SMauro Carvalho Chehab	     = 1 ]; then
321ab42b818SMauro Carvalho Chehab	    if test -x $VBETOOL/vbetool; then
322ab42b818SMauro Carvalho Chehab	       echo Unbinding vtcon$i
323ab42b818SMauro Carvalho Chehab	       $VBETOOL/vbetool vbestate restore < $VGASTATE
324ab42b818SMauro Carvalho Chehab	       echo 0 > /sys/class/vtconsole/vtcon$i/bind
325ab42b818SMauro Carvalho Chehab	    fi
326ab42b818SMauro Carvalho Chehab	fi
327ab42b818SMauro Carvalho Chehab    fi
328ab42b818SMauro Carvalho Chehab  done
329ab42b818SMauro Carvalho Chehab
330ab42b818SMauro Carvalho Chehab---------------------------------------------------------------------------
331ab42b818SMauro Carvalho Chehab
332ab42b818SMauro Carvalho Chehab::
333ab42b818SMauro Carvalho Chehab
334ab42b818SMauro Carvalho Chehab  #!/bin/bash
335ab42b818SMauro Carvalho Chehab  # Bind fbcon
336ab42b818SMauro Carvalho Chehab
337ab42b818SMauro Carvalho Chehab  for (( i = 0; i < 16; i++))
338ab42b818SMauro Carvalho Chehab  do
339ab42b818SMauro Carvalho Chehab    if test -x /sys/class/vtconsole/vtcon$i; then
340ab42b818SMauro Carvalho Chehab	if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \
341ab42b818SMauro Carvalho Chehab	     = 1 ]; then
342ab42b818SMauro Carvalho Chehab	  echo Unbinding vtcon$i
343ab42b818SMauro Carvalho Chehab	  echo 1 > /sys/class/vtconsole/vtcon$i/bind
344ab42b818SMauro Carvalho Chehab	fi
345ab42b818SMauro Carvalho Chehab    fi
346ab42b818SMauro Carvalho Chehab  done
347ab42b818SMauro Carvalho Chehab
348ab42b818SMauro Carvalho ChehabAntonino Daplas <adaplas@pol.net>
349