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 IOCTL_CONSOLE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
42 ioctl_console \- ioctls for console terminal and virtual consoles
44 The following Linux-specific
46 requests are supported for console terminals and virtual consoles.
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 the
69 unsigned long integer in
71 However, if a higher order bit is set,
72 the LEDs revert to normal: displaying the state of the
73 keyboard functions of caps lock, num lock, and scroll lock.
75 Before Linux 1.1.54, the LEDs just reflected the state of the corresponding
76 keyboard flags, and KDGETLED/KDSETLED would also change the keyboard
78 Since Linux 1.1.54 the LEDs can be made to display arbitrary
79 information, but by default they display the keyboard flags.
80 The following two ioctls are used to access the keyboard flags.
83 Get keyboard flags CapsLock, NumLock, ScrollLock (not lights).
85 points to a char which is set to the flag state.
86 The low order three bits (mask 0x7) get the current flag state,
87 and the low order bits of the next nibble (mask 0x70) get
88 the default flag state.
92 Set keyboard flags CapsLock, NumLock, ScrollLock (not lights).
94 is an unsigned long integer that has the desired flag state.
95 The low order three bits (mask 0x7) have the flag state,
96 and the low order bits of the next nibble (mask 0x70) have
97 the default flag state.
102 This returns the value KB_101, defined as 0x02.
105 Add I/O port as valid.
107 .IR ioperm(arg,1,1) .
110 Delete I/O port as valid.
112 .IR ioperm(arg,1,0) .
115 Enable I/O to video board.
117 .IR "ioperm(0x3b4, 0x3df\-0x3b4+1, 1)" .
120 Disable I/O to video board.
122 .IR "ioperm(0x3b4, 0x3df\-0x3b4+1, 0)" .
125 Set text/graphics mode.
127 is an unsigned integer containing one of:
135 Get text/graphics mode.
140 of the values shown above for
144 Generate tone of specified length.
145 The lower 16 bits of the unsigned long integer in
147 specify the period in clock cycles,
148 and the upper 16 bits give the duration in msec.
149 If the duration is zero, the sound is turned off.
150 Control returns immediately.
153 = (125<<16) + 0x637 would specify
154 the beep normally associated with a ctrl-G.
155 (Thus since Linux 0.99pl1; broken in Linux 2.1.49-50.)
158 Start or stop sound generation.
161 specify the period in clock cycles
164 = 1193180/frequency).
167 In either case, control returns immediately.
170 Get the current default color map from kernel.
177 Change the default text-mode color map.
180 48-byte array which contains, in order, the Red, Green, and Blue
181 values for the 16 available screen colors: 0 is off, and 255 is full
183 The default colors are, in order: black, dark red, dark
184 green, brown, dark blue, dark purple, dark cyan, light grey, dark
185 grey, bright red, bright green, yellow, bright blue, bright purple,
186 bright cyan, and white.
190 Gets 256-character screen font in expanded form.
192 points to an 8192-byte array.
193 Fails with error code
196 currently loaded font is a 512-character font, or if the console is
200 Gets screen font and associated information.
203 .I "struct consolefontdesc"
208 field should be set to the maximum number of
209 characters that would fit in the buffer pointed to by
216 the respective data for the currently loaded font, and the
218 array contains the font data if the initial value of
220 indicated enough space was available; otherwise the
221 buffer is untouched and
228 Sets 256-character screen font.
229 Load font into the EGA/VGA character
232 points to an 8192-byte map, with 32 bytes per
236 of them are used for an 8x\fIN\fP font
240 This call also invalidates the Unicode mapping.
243 Sets screen font and associated rendering information.
249 struct consolefontdesc {
250 unsigned short charcount; /* characters in font
252 unsigned short charheight; /* scan lines per
254 char *chardata; /* font data in
260 If necessary, the screen will be appropriately resized, and
262 sent to the appropriate processes.
263 This call also invalidates the Unicode mapping.
267 Resets the screen font, size, and Unicode mapping to the bootup
270 is unused, but should be set to NULL to
271 ensure compatibility with future versions of Linux.
272 (Since Linux 1.3.28.)
275 Get screen mapping from kernel.
277 points to an area of size
278 E_TABSZ, which is loaded with the font positions used to display each
280 This call is likely to return useless information if the
281 currently loaded font is more than 256 characters.
284 Get full Unicode screen mapping from kernel.
288 .IR "E_TABSZ*sizeof(unsigned short)" ,
289 which is loaded with the
290 Unicodes each character represent.
291 A special set of Unicodes,
292 starting at U+F000, are used to represent "direct to font" mappings.
296 Loads the "user definable" (fourth) table in the kernel which maps
297 bytes into console screen symbols.
303 Loads the "user definable" (fourth) table in the kernel which maps
304 bytes into Unicodes, which are then translated into screen symbols
305 according to the currently loaded Unicode-to-font map.
306 Special Unicodes starting at U+F000 can be used to map directly to the font
311 Get Unicode-to-font mapping from kernel.
318 unsigned short entry_ct;
319 struct unipair *entries;
326 points to an array of
331 unsigned short unicode;
332 unsigned short fontpos;
337 (Since Linux 1.1.92.)
340 Put unicode-to-font mapping in kernel.
343 .IR "struct unimapdesc" .
347 Clear table, possibly advise hash algorithm.
354 unsigned short advised_hashsize; /* 0 if no opinion */
355 unsigned short advised_hashstep; /* 0 if no opinion */
356 unsigned short advised_hashlevel; /* 0 if no opinion */
361 (Since Linux 1.1.92.)
364 Gets current keyboard mode.
372 K_RAW 0x00 /* Raw (scancode) mode */
373 K_XLATE 0x01 /* Translate keycodes using keymap */
374 K_MEDIUMRAW 0x02 /* Medium raw (scancode) mode */
375 K_UNICODE 0x03 /* Unicode mode */
376 K_OFF 0x04 /* Disabled mode; since Linux 2.6.39 */
377 .\" K_OFF: commit 9fc3de9c83565fcaa23df74c2fc414bb6e7efb0a
381 Sets current keyboard mode.
385 equal to one of the values shown for
389 Gets meta key handling mode.
397 K_METABIT 0x03 set high order bit
398 K_ESCPREFIX 0x04 escape prefix
402 Sets meta key handling mode.
406 equal to one of the values shown above for
410 Gets one entry in key translation table (keycode to action code).
417 unsigned char kb_table;
418 unsigned char kb_index;
419 unsigned short kb_value;
424 with the first two members filled in:
426 selects the key table (0 <=
435 is set to the corresponding action code,
436 or K_HOLE if there is no such key,
442 Sets one entry in translation table.
445 .IR "struct kbentry" .
448 Gets one function key string.
455 unsigned char kb_func;
456 unsigned char kb_string[512];
462 is set to the (null-terminated) string corresponding to
465 function key action code.
468 Sets one function key string entry.
471 .IR "struct kbsentry" .
474 Read kernel accent table.
482 struct kbdiacr kbdiacr[256];
489 is the number of entries in the array, each of which
497 unsigned char result;
503 Read kernel keycode table entry (scan code to keycode).
510 unsigned int scancode;
511 unsigned int keycode;
517 is set to correspond to the given
525 .IR keycode == scancode .)
526 (Since Linux 1.1.63.)
529 Write kernel keycode table entry.
532 .IR "struct kbkeycode" .
533 (Since Linux 1.1.63.)
536 The calling process indicates its willingness to accept the signal
538 when it is generated by pressing an appropriate key combination.
545 .IR linux/drivers/char/keyboard.c .)
548 Returns the first available (non-opened) console.
553 number of the vt (1 <=
558 Get mode of active vt.
565 char mode; /* vt mode */
566 char waitv; /* if set, hang on writes if not active */
567 short relsig; /* signal to raise on release req */
568 short acqsig; /* signal to raise on acquisition */
569 short frsig; /* unused (set to 0) */
574 which is set to the mode of the active vt.
576 is set to one of these values:
579 VT_AUTO auto vt switching
580 VT_PROCESS process controls switching
581 VT_ACKACQ acknowledge switch
585 Set mode of active vt.
588 .IR "struct vt_mode" .
591 Get global vt state info.
598 unsigned short v_active; /* active vt */
599 unsigned short v_signal; /* signal to send */
600 unsigned short v_state; /* vt bit mask */
605 For each vt in use, the corresponding bit in the
608 (Kernels 1.0 through 1.1.92.)
626 Deallocate the memory associated with vt
628 (Since Linux 1.1.54.)
631 Set the kernel's idea of screensize.
638 unsigned short v_rows; /* # rows */
639 unsigned short v_cols; /* # columns */
640 unsigned short v_scrollsize; /* no longer used */
645 Note that this does not change the videomode.
648 (Since Linux 1.1.54.)
651 Set the kernel's idea of various screen parameters.
658 unsigned short v_rows; /* number of rows */
659 unsigned short v_cols; /* number of columns */
660 unsigned short v_vlin; /* number of pixel rows
662 unsigned short v_clin; /* number of pixel rows
664 unsigned short v_vcol; /* number of pixel columns
666 unsigned short v_ccol; /* number of pixel columns
672 Any parameter may be set to zero, indicating "no change", but if
673 multiple parameters are set, they must be self-consistent.
674 Note that this does not change the videomode.
679 The action of the following ioctls depends on the first byte in the struct
682 referred to here as the
684 These are legal only for the superuser or the owner of the current terminal.
686 .B "TIOCLINUX, subcode=0"
688 Disappeared in Linux 1.1.92. (With kernel 1.1.92 or later, read from
694 .B "TIOCLINUX, subcode=1"
695 Get task information.
696 Disappeared in Linux 1.1.92.
698 .B "TIOCLINUX, subcode=2"
707 short xs, ys, xe, ye;
716 are the starting column and row.
722 (Upper left corner is row=column=1.)
724 is 0 for character-by-character selection,
725 1 for word-by-word selection,
726 or 2 for line-by-line selection.
727 The indicated screen characters are highlighted and saved
728 in the static array sel_buffer in
729 .IR devices/char/console.c .
731 .B "TIOCLINUX, subcode=3"
733 The characters in the selection buffer are
737 .B "TIOCLINUX, subcode=4"
740 .B "TIOCLINUX, subcode=5"
741 Sets contents of a 256-bit look up table defining characters in a "word",
742 for word-by-word selection.
743 (Since Linux 1.1.32.)
745 .B "TIOCLINUX, subcode=6"
747 points to a char which is set to the value of the kernel
750 (Since Linux 1.1.32.)
752 .B "TIOCLINUX, subcode=7"
754 points to a char which is set to the value of the kernel
757 (Since Linux 1.1.33.)
759 .B "TIOCLINUX, subcode=8"
760 Dump screen width and height, cursor position, and all the
761 character-attribute pairs.
762 (Kernels 1.1.67 through 1.1.91 only.
763 With kernel 1.1.92 or later, read from
767 .B "TIOCLINUX, subcode=9"
768 Restore screen width and height, cursor position, and all the
769 character-attribute pairs.
770 (Kernels 1.1.67 through 1.1.91 only.
771 With kernel 1.1.92 or later, write to
775 .B "TIOCLINUX, subcode=10"
776 Handles the Power Saving
777 feature of the new generation of monitors.
778 VESA screen blanking mode is set to
781 screen blanking does:
784 Screen blanking is disabled.
786 The current video adapter
787 register settings are saved, then the controller is programmed to turn off
788 the vertical synchronization pulses.
789 This puts the monitor into "standby" mode.
790 If your monitor has an Off_Mode timer, then
791 it will eventually power down by itself.
793 The current settings are saved, then both the vertical and horizontal
794 synchronization pulses are turned off.
795 This puts the monitor into "off" mode.
796 If your monitor has no Off_Mode timer,
797 or if you want your monitor to power down immediately when the
798 blank_timer times out, then you choose this option.
800 Powering down frequently will damage the monitor.)
801 (Since Linux 1.1.76.)
804 On success, 0 is returned.
805 On failure, \-1 is returned, and
807 is set to indicate the error.
811 The file descriptor is invalid.
814 The file descriptor or
819 The file descriptor is not associated with a character special device,
820 or the specified request does not apply to it.
823 Insufficient permission.
826 Do not regard this man page as documentation of the Linux console ioctls.
827 This is provided for the curious only, as an alternative to reading the
829 Ioctl's are undocumented Linux internals, liable to be changed
831 (And indeed, this page more or less describes the
832 situation as of kernel version 1.1.94;
833 there are many minor and not-so-minor
834 differences with earlier versions.)
836 Very often, ioctls are introduced for communication between the
837 kernel and one particular well-known program (fdisk, hdparm, setserial,
838 tunelp, loadkeys, selection, setfont, etc.), and their behavior will be
839 changed when required by this particular program.
841 Programs using these ioctls will not be portable to other versions
842 of UNIX, will not work on older versions of Linux, and will not work
843 on future versions of Linux.
858 .BR console_codes (4),
870 .IR /usr/include/linux/kd.h ,
871 .I /usr/include/linux/vt.h