1 .\" Copyright (c) 1995 Jim Van Zandt <jrv@vanzandt.mv.com> and aeb
2 .\" Sun Feb 26 11:46:23 MET 1995
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
25 .\" Modified, Sun Feb 26 15:04:20 1995, faith@cs.unc.edu
26 .\" Modified, Thu Apr 20 22:08:17 1995, jrv@vanzandt.mv.com
27 .\" Modified, Mon Sep 18 22:32:47 1995, hpa@storm.net (H. Peter Anvin)
28 .\" FIXME The following are not documented:
29 .\" KDFONTOP (since 2.1.111)
30 .\" KDGKBDIACRUC (since 2.6.24)
32 .\" KDSKBDIACRUC (since 2.6.24)
33 .\" KDKBDREP (since 2.1.113)
34 .\" KDMAPDISP (not implemented as at 2.6.27)
35 .\" KDUNMAPDISP (not implemented as at 2.6.27)
36 .\" VT_LOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG)
37 .\" VT_UNLOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG)
38 .\" VT_GETHIFONTMASK (since 2.6.18)
40 .TH CONSOLE_IOCTL 4 2016-07-17 "Linux" "Linux Programmer's Manual"
42 console_ioctl \- ioctls for console terminal and virtual consoles
44 The following Linux-specific
46 requests are supported.
47 Each requires a third argument, assumed here to be
58 are set to the state of the LEDs, as follows:
61 LED_CAP 0x04 caps lock led
62 LED_NUM 0x02 num lock led
63 LED_SCR 0x01 scroll lock led
68 The LEDs are set to correspond to the lower three bits of
70 However, if a higher order bit is set,
71 the LEDs revert to normal: displaying the state of the
72 keyboard functions of caps lock, num lock, and scroll lock.
74 Before Linux 1.1.54, the LEDs just reflected the state of the corresponding
75 keyboard flags, and KDGETLED/KDSETLED would also change the keyboard
77 Since Linux 1.1.54 the LEDs can be made to display arbitrary
78 information, but by default they display the keyboard flags.
79 The following two ioctls are used to access the keyboard flags.
82 Get keyboard flags CapsLock, NumLock, ScrollLock (not lights).
84 points to a char which is set to the flag state.
85 The low order three bits (mask 0x7) get the current flag state,
86 and the low order bits of the next nibble (mask 0x70) get
87 the default flag state.
91 Set keyboard flags CapsLock, NumLock, ScrollLock (not lights).
93 has the desired flag state.
94 The low order three bits (mask 0x7) have the flag state,
95 and the low order bits of the next nibble (mask 0x70) have
96 the default flag state.
101 This returns the value KB_101, defined as 0x02.
104 Add I/O port as valid.
106 .IR ioperm(arg,1,1) .
109 Delete I/O port as valid.
111 .IR ioperm(arg,1,0) .
114 Enable I/O to video board.
116 .IR "ioperm(0x3b4, 0x3df-0x3b4+1, 1)" .
119 Disable I/O to video board.
121 .IR "ioperm(0x3b4, 0x3df-0x3b4+1, 0)" .
124 Set text/graphics mode.
134 Get text/graphics mode.
139 of the values shown above for
143 Generate tone of specified length.
146 specify the period in clock cycles,
147 and the upper 16 bits give the duration in msec.
148 If the duration is zero, the sound is turned off.
149 Control returns immediately.
152 = (125<<16) + 0x637 would specify
153 the beep normally associated with a ctrl-G.
154 (Thus since Linux 0.99pl1; broken in Linux 2.1.49-50.)
157 Start or stop sound generation.
160 specify the period in clock cycles
163 = 1193180/frequency).
166 In either case, control returns immediately.
169 Get the current default color map from kernel.
176 Change the default text-mode color map.
179 48-byte array which contains, in order, the Red, Green, and Blue
180 values for the 16 available screen colors: 0 is off, and 255 is full
182 The default colors are, in order: black, dark red, dark
183 green, brown, dark blue, dark purple, dark cyan, light grey, dark
184 grey, bright red, bright green, yellow, bright blue, bright purple,
185 bright cyan and white.
189 Gets 256-character screen font in expanded form.
191 points to an 8192 byte array.
192 Fails with error code
195 currently loaded font is a 512-character font, or if the console is
199 Gets screen font and associated information.
202 .I "struct consolefontdesc"
207 field should be set to the maximum number of
208 characters that would fit in the buffer pointed to by
215 the respective data for the currently loaded font, and the
217 array contains the font data if the initial value of
219 indicated enough space was available; otherwise the
220 buffer is untouched and
227 Sets 256-character screen font.
228 Load font into the EGA/VGA character
231 points to a 8192 byte map, with 32 bytes per
235 of them are used for an 8x\fIN\fP font
239 This call also invalidates the Unicode mapping.
242 Sets screen font and associated rendering information.
248 struct consolefontdesc {
249 unsigned short charcount; /* characters in font
251 unsigned short charheight; /* scan lines per
253 char *chardata; /* font data in
259 If necessary, the screen will be appropriately resized, and
261 sent to the appropriate processes.
262 This call also invalidates the Unicode mapping.
266 Resets the screen font, size and Unicode mapping to the bootup
269 is unused, but should be set to NULL to
270 ensure compatibility with future versions of Linux.
271 (Since Linux 1.3.28.)
274 Get screen mapping from kernel.
276 points to an area of size
277 E_TABSZ, which is loaded with the font positions used to display each
279 This call is likely to return useless information if the
280 currently loaded font is more than 256 characters.
283 Get full Unicode screen mapping from kernel.
287 .IR "E_TABSZ*sizeof(unsigned short)" ,
288 which is loaded with the
289 Unicodes each character represent.
290 A special set of Unicodes,
291 starting at U+F000, are used to represent "direct to font" mappings.
295 Loads the "user definable" (fourth) table in the kernel which maps
296 bytes into console screen symbols.
302 Loads the "user definable" (fourth) table in the kernel which maps
303 bytes into Unicodes, which are then translated into screen symbols
304 according to the currently loaded Unicode-to-font map.
305 Special Unicodes starting at U+F000 can be used to map directly to the font
310 Get Unicode-to-font mapping from kernel.
317 unsigned short entry_ct;
318 struct unipair *entries;
325 points to an array of
330 unsigned short unicode;
331 unsigned short fontpos;
336 (Since Linux 1.1.92.)
339 Put unicode-to-font mapping in kernel.
342 .IR "struct unimapdesc" .
346 Clear table, possibly advise hash algorithm.
353 unsigned short advised_hashsize; /* 0 if no opinion */
354 unsigned short advised_hashstep; /* 0 if no opinion */
355 unsigned short advised_hashlevel; /* 0 if no opinion */
360 (Since Linux 1.1.92.)
363 Gets current keyboard mode.
371 K_RAW 0x00 /* Raw (scancode) mode */
372 K_XLATE 0x01 /* Translate keycodes using keymap */
373 K_MEDIUMRAW 0x02 /* Medium raw (scancode) mode */
374 K_UNICODE 0x03 /* Unicode mode */
375 K_OFF 0x04 /* Disabled mode; since Linux 2.6.39 */
376 .\" K_OFF: commit 9fc3de9c83565fcaa23df74c2fc414bb6e7efb0a
380 Sets current keyboard mode.
384 equal to one of the values shown for
388 Gets meta key handling mode.
396 K_METABIT 0x03 set high order bit
397 K_ESCPREFIX 0x04 escape prefix
401 Sets meta key handling mode.
405 equal to one of the values shown above for
409 Gets one entry in key translation table (keycode to action code).
416 unsigned char kb_table;
417 unsigned char kb_index;
418 unsigned short kb_value;
423 with the first two members filled in:
425 selects the key table (0 <=
434 is set to the corresponding action code,
435 or K_HOLE if there is no such key,
441 Sets one entry in translation table.
444 .IR "struct kbentry" .
447 Gets one function key string.
454 unsigned char kb_func;
455 unsigned char kb_string[512];
461 is set to the (null-terminated) string corresponding to
464 function key action code.
467 Sets one function key string entry.
470 .IR "struct kbsentry" .
473 Read kernel accent table.
481 struct kbdiacr kbdiacr[256];
488 is the number of entries in the array, each of which
496 unsigned char result;
502 Read kernel keycode table entry (scan code to keycode).
509 unsigned int scancode;
510 unsigned int keycode;
516 is set to correspond to the given
524 .IR keycode == scancode .)
525 (Since Linux 1.1.63.)
528 Write kernel keycode table entry.
531 .IR "struct kbkeycode" .
532 (Since Linux 1.1.63.)
535 The calling process indicates its willingness to accept the signal
537 when it is generated by pressing an appropriate key combination.
544 .IR linux/drivers/char/keyboard.c .)
547 Returns the first available (non-opened) console.
552 number of the vt (1 <=
557 Get mode of active vt.
564 char mode; /* vt mode */
565 char waitv; /* if set, hang on writes if not active */
566 short relsig; /* signal to raise on release req */
567 short acqsig; /* signal to raise on acquisition */
568 short frsig; /* unused (set to 0) */
573 which is set to the mode of the active vt.
575 is set to one of these values:
578 VT_AUTO auto vt switching
579 VT_PROCESS process controls switching
580 VT_ACKACQ acknowledge switch
584 Set mode of active vt.
587 .IR "struct vt_mode" .
590 Get global vt state info.
597 unsigned short v_active; /* active vt */
598 unsigned short v_signal; /* signal to send */
599 unsigned short v_state; /* vt bit mask */
604 For each vt in use, the corresponding bit in the
607 (Kernels 1.0 through 1.1.92.)
625 Deallocate the memory associated with vt
627 (Since Linux 1.1.54.)
630 Set the kernel's idea of screensize.
637 unsigned short v_rows; /* # rows */
638 unsigned short v_cols; /* # columns */
639 unsigned short v_scrollsize; /* no longer used */
644 Note that this does not change the videomode.
647 (Since Linux 1.1.54.)
650 Set the kernel's idea of various screen parameters.
657 unsigned short v_rows; /* number of rows */
658 unsigned short v_cols; /* number of columns */
659 unsigned short v_vlin; /* number of pixel rows
661 unsigned short v_clin; /* number of pixel rows
663 unsigned short v_vcol; /* number of pixel columns
665 unsigned short v_ccol; /* number of pixel columns
671 Any parameter may be set to zero, indicating "no change", but if
672 multiple parameters are set, they must be self-consistent.
673 Note that this does not change the videomode.
678 The action of the following ioctls depends on the first byte in the struct
681 referred to here as the
683 These are legal only for the superuser or the owner of the current terminal.
685 .B "TIOCLINUX, subcode=0"
687 Disappeared in Linux 1.1.92. (With kernel 1.1.92 or later, read from
693 .B "TIOCLINUX, subcode=1"
694 Get task information.
695 Disappeared in Linux 1.1.92.
697 .B "TIOCLINUX, subcode=2"
706 short xs, ys, xe, ye;
715 are the starting column and row.
721 (Upper left corner is row=column=1.)
723 is 0 for character-by-character selection,
724 1 for word-by-word selection,
725 or 2 for line-by-line selection.
726 The indicated screen characters are highlighted and saved
727 in the static array sel_buffer in
728 .IR devices/char/console.c .
730 .B "TIOCLINUX, subcode=3"
732 The characters in the selection buffer are
736 .B "TIOCLINUX, subcode=4"
739 .B "TIOCLINUX, subcode=5"
740 Sets contents of a 256-bit look up table defining characters in a "word",
741 for word-by-word selection.
742 (Since Linux 1.1.32.)
744 .B "TIOCLINUX, subcode=6"
746 points to a char which is set to the value of the kernel
749 (Since Linux 1.1.32.)
751 .B "TIOCLINUX, subcode=7"
753 points to a char which is set to the value of the kernel
756 (Since Linux 1.1.33.)
758 .B "TIOCLINUX, subcode=8"
759 Dump screen width and height, cursor position, and all the
760 character-attribute pairs.
761 (Kernels 1.1.67 through 1.1.91 only.
762 With kernel 1.1.92 or later, read from
766 .B "TIOCLINUX, subcode=9"
767 Restore screen width and height, cursor position, and all the
768 character-attribute pairs.
769 (Kernels 1.1.67 through 1.1.91 only.
770 With kernel 1.1.92 or later, write to
774 .B "TIOCLINUX, subcode=10"
775 Handles the Power Saving
776 feature of the new generation of monitors.
777 VESA screen blanking mode is set to
780 screen blanking does:
783 Screen blanking is disabled.
785 The current video adapter
786 register settings are saved, then the controller is programmed to turn off
787 the vertical synchronization pulses.
788 This puts the monitor into "standby" mode.
789 If your monitor has an Off_Mode timer, then
790 it will eventually power down by itself.
792 The current settings are saved, then both the vertical and horizontal
793 synchronization pulses are turned off.
794 This puts the monitor into "off" mode.
795 If your monitor has no Off_Mode timer,
796 or if you want your monitor to power down immediately when the
797 blank_timer times out, then you choose this option.
799 Powering down frequently will damage the monitor.)
800 (Since Linux 1.1.76.)
803 On success, 0 is returned.
804 On error, \-1 is returned, and
809 may take on these values:
812 The file descriptor is invalid.
815 The file descriptor or
820 The file descriptor is not associated with a character special device,
821 or the specified request does not apply to it.
824 Insufficient permission.
827 Do not regard this man page as documentation of the Linux console ioctls.
828 This is provided for the curious only, as an alternative to reading the
830 Ioctl's are undocumented Linux internals, liable to be changed
832 (And indeed, this page more or less describes the
833 situation as of kernel version 1.1.94;
834 there are many minor and not-so-minor
835 differences with earlier versions.)
837 Very often, ioctls are introduced for communication between the
838 kernel and one particular well-known program (fdisk, hdparm, setserial,
839 tunelp, loadkeys, selection, setfont, etc.), and their behavior will be
840 changed when required by this particular program.
842 Programs using these ioctls will not be portable to other versions
843 of UNIX, will not work on older versions of Linux, and will not work
844 on future versions of Linux.
858 .BR console_codes (4),
871 .IR /usr/include/linux/kd.h ,
872 .I /usr/include/linux/vt.h