Blame man2/ioctl_console.2

Packit 7cfc04
.\" Copyright (c) 1995 Jim Van Zandt <jrv@vanzandt.mv.com> and aeb
Packit 7cfc04
.\" Sun Feb 26 11:46:23 MET 1995
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
Packit 7cfc04
.\" This is free documentation; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\"
Packit 7cfc04
.\" The GNU General Public License's references to "object code"
Packit 7cfc04
.\" and "executables" are to be interpreted as the output of any
Packit 7cfc04
.\" document formatting or typesetting system, including
Packit 7cfc04
.\" intermediate and printed output.
Packit 7cfc04
.\"
Packit 7cfc04
.\" This manual is distributed in the hope that it will be useful,
Packit 7cfc04
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7cfc04
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7cfc04
.\" GNU General Public License for more details.
Packit 7cfc04
.\"
Packit 7cfc04
.\" You should have received a copy of the GNU General Public
Packit 7cfc04
.\" License along with this manual; if not, see
Packit 7cfc04
.\" <http://www.gnu.org/licenses/>.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" Modified, Sun Feb 26 15:04:20 1995, faith@cs.unc.edu
Packit 7cfc04
.\" Modified, Thu Apr 20 22:08:17 1995, jrv@vanzandt.mv.com
Packit 7cfc04
.\" Modified, Mon Sep 18 22:32:47 1995, hpa@storm.net (H. Peter Anvin)
Packit 7cfc04
.\" FIXME The following are not documented:
Packit 7cfc04
.\"     KDFONTOP (since 2.1.111)
Packit 7cfc04
.\"     KDGKBDIACRUC (since 2.6.24)
Packit 7cfc04
.\"     KDSKBDIACR
Packit 7cfc04
.\"     KDSKBDIACRUC (since 2.6.24)
Packit 7cfc04
.\"     KDKBDREP (since 2.1.113)
Packit 7cfc04
.\"     KDMAPDISP (not implemented as at 2.6.27)
Packit 7cfc04
.\"     KDUNMAPDISP (not implemented as at 2.6.27)
Packit 7cfc04
.\"     VT_LOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG)
Packit 7cfc04
.\"     VT_UNLOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG)
Packit 7cfc04
.\"     VT_GETHIFONTMASK (since 2.6.18)
Packit 7cfc04
.\"
Packit 7cfc04
.TH IOCTL_CONSOLE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
ioctl_console \- ioctls for console terminal and virtual consoles
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The following Linux-specific
Packit 7cfc04
.BR ioctl (2)
Packit 7cfc04
requests are supported for console terminals and virtual consoles.
Packit 7cfc04
Each requires a third argument, assumed here to be
Packit 7cfc04
.IR argp .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGETLED
Packit 7cfc04
Get state of LEDs.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IR char .
Packit 7cfc04
The lower three bits
Packit 7cfc04
of
Packit 7cfc04
.I *argp
Packit 7cfc04
are set to the state of the LEDs, as follows:
Packit 7cfc04
.TS
Packit 7cfc04
l l l.
Packit 7cfc04
LED_CAP 	0x04	caps lock led
Packit 7cfc04
LED_NUM 	0x02	num lock led
Packit 7cfc04
LED_SCR 	0x01	scroll lock led
Packit 7cfc04
.TE
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSETLED
Packit 7cfc04
Set the LEDs.
Packit 7cfc04
The LEDs are set to correspond to the lower three bits of the
Packit 7cfc04
unsigned long integer in
Packit 7cfc04
.IR argp .
Packit 7cfc04
However, if a higher order bit is set,
Packit 7cfc04
the LEDs revert to normal: displaying the state of the
Packit 7cfc04
keyboard functions of caps lock, num lock, and scroll lock.
Packit 7cfc04
.PP
Packit 7cfc04
Before Linux 1.1.54, the LEDs just reflected the state of the corresponding
Packit 7cfc04
keyboard flags, and KDGETLED/KDSETLED would also change the keyboard
Packit 7cfc04
flags.
Packit 7cfc04
Since Linux 1.1.54 the LEDs can be made to display arbitrary
Packit 7cfc04
information, but by default they display the keyboard flags.
Packit 7cfc04
The following two ioctls are used to access the keyboard flags.
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGKBLED
Packit 7cfc04
Get keyboard flags CapsLock, NumLock, ScrollLock (not lights).
Packit 7cfc04
.I argp
Packit 7cfc04
points to a char which is set to the flag state.
Packit 7cfc04
The low order three bits (mask 0x7) get the current flag state,
Packit 7cfc04
and the low order bits of the next nibble (mask 0x70) get
Packit 7cfc04
the default flag state.
Packit 7cfc04
(Since Linux 1.1.54.)
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSKBLED
Packit 7cfc04
Set keyboard flags CapsLock, NumLock, ScrollLock (not lights).
Packit 7cfc04
.I argp
Packit 7cfc04
is an unsigned long integer that has the desired flag state.
Packit 7cfc04
The low order three bits (mask 0x7) have the flag state,
Packit 7cfc04
and the low order bits of the next nibble (mask 0x70) have
Packit 7cfc04
the default flag state.
Packit 7cfc04
(Since Linux 1.1.54.)
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGKBTYPE
Packit 7cfc04
Get keyboard type.
Packit 7cfc04
This returns the value KB_101, defined as 0x02.
Packit 7cfc04
.TP
Packit 7cfc04
.B KDADDIO
Packit 7cfc04
Add I/O port as valid.
Packit 7cfc04
Equivalent to
Packit 7cfc04
.IR ioperm(arg,1,1) .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDDELIO
Packit 7cfc04
Delete I/O port as valid.
Packit 7cfc04
Equivalent to
Packit 7cfc04
.IR ioperm(arg,1,0) .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDENABIO
Packit 7cfc04
Enable I/O to video board.
Packit 7cfc04
Equivalent to
Packit 7cfc04
.IR "ioperm(0x3b4, 0x3df\-0x3b4+1, 1)" .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDDISABIO
Packit 7cfc04
Disable I/O to video board.
Packit 7cfc04
Equivalent to
Packit 7cfc04
.IR "ioperm(0x3b4, 0x3df\-0x3b4+1, 0)" .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSETMODE
Packit 7cfc04
Set text/graphics mode.
Packit 7cfc04
.I argp
Packit 7cfc04
is an unsigned integer containing one of:
Packit 7cfc04
.TS
Packit 7cfc04
l l.
Packit 7cfc04
KD_TEXT	0x00
Packit 7cfc04
KD_GRAPHICS	0x01
Packit 7cfc04
.TE
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGETMODE
Packit 7cfc04
Get text/graphics mode.
Packit 7cfc04
.I argp
Packit 7cfc04
points to an
Packit 7cfc04
.I int
Packit 7cfc04
which is set to one
Packit 7cfc04
of the values shown above for
Packit 7cfc04
.BR KDSETMODE .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDMKTONE
Packit 7cfc04
Generate tone of specified length.
Packit 7cfc04
The lower 16 bits of the unsigned long integer in
Packit 7cfc04
.I argp
Packit 7cfc04
specify the period in clock cycles,
Packit 7cfc04
and the upper 16 bits give the duration in msec.
Packit 7cfc04
If the duration is zero, the sound is turned off.
Packit 7cfc04
Control returns immediately.
Packit 7cfc04
For example,
Packit 7cfc04
.I argp
Packit 7cfc04
= (125<<16) + 0x637 would specify
Packit 7cfc04
the beep normally associated with a ctrl-G.
Packit 7cfc04
(Thus since Linux 0.99pl1; broken in Linux 2.1.49-50.)
Packit 7cfc04
.TP
Packit 7cfc04
.B KIOCSOUND
Packit 7cfc04
Start or stop sound generation.
Packit 7cfc04
The lower 16 bits of
Packit 7cfc04
.I argp
Packit 7cfc04
specify the period in clock cycles
Packit 7cfc04
(that is,
Packit 7cfc04
.I argp
Packit 7cfc04
= 1193180/frequency).
Packit 7cfc04
.I argp
Packit 7cfc04
= 0 turns sound off.
Packit 7cfc04
In either case, control returns immediately.
Packit 7cfc04
.TP
Packit 7cfc04
.B GIO_CMAP
Packit 7cfc04
Get the current default color map from kernel.
Packit 7cfc04
.I argp
Packit 7cfc04
points to
Packit 7cfc04
a 48-byte array.
Packit 7cfc04
(Since Linux 1.3.3.)
Packit 7cfc04
.TP
Packit 7cfc04
.B PIO_CMAP
Packit 7cfc04
Change the default text-mode color map.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
48-byte array which contains, in order, the Red, Green, and Blue
Packit 7cfc04
values for the 16 available screen colors: 0 is off, and 255 is full
Packit 7cfc04
intensity.
Packit 7cfc04
The default colors are, in order: black, dark red, dark
Packit 7cfc04
green, brown, dark blue, dark purple, dark cyan, light grey, dark
Packit 7cfc04
grey, bright red, bright green, yellow, bright blue, bright purple,
Packit 7cfc04
bright cyan and white.
Packit 7cfc04
(Since Linux 1.3.3.)
Packit 7cfc04
.TP
Packit 7cfc04
.B GIO_FONT
Packit 7cfc04
Gets 256-character screen font in expanded form.
Packit 7cfc04
.I argp
Packit 7cfc04
points to an 8192-byte array.
Packit 7cfc04
Fails with error code
Packit 7cfc04
.B EINVAL
Packit 7cfc04
if the
Packit 7cfc04
currently loaded font is a 512-character font, or if the console is
Packit 7cfc04
not in text mode.
Packit 7cfc04
.TP
Packit 7cfc04
.B GIO_FONTX
Packit 7cfc04
Gets screen font and associated information.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.I "struct consolefontdesc"
Packit 7cfc04
(see
Packit 7cfc04
.BR PIO_FONTX ).
Packit 7cfc04
On call, the
Packit 7cfc04
.I charcount
Packit 7cfc04
field should be set to the maximum number of
Packit 7cfc04
characters that would fit in the buffer pointed to by
Packit 7cfc04
.IR chardata .
Packit 7cfc04
On return, the
Packit 7cfc04
.I charcount
Packit 7cfc04
and
Packit 7cfc04
.I charheight
Packit 7cfc04
are filled with
Packit 7cfc04
the respective data for the currently loaded font, and the
Packit 7cfc04
.I chardata
Packit 7cfc04
array contains the font data if the initial value of
Packit 7cfc04
.I charcount
Packit 7cfc04
indicated enough space was available; otherwise the
Packit 7cfc04
buffer is untouched and
Packit 7cfc04
.I errno
Packit 7cfc04
is set to
Packit 7cfc04
.BR ENOMEM .
Packit 7cfc04
(Since Linux 1.3.1.)
Packit 7cfc04
.TP
Packit 7cfc04
.B PIO_FONT
Packit 7cfc04
Sets 256-character screen font.
Packit 7cfc04
Load font into the EGA/VGA character
Packit 7cfc04
generator.
Packit 7cfc04
.I argp
Packit 7cfc04
points to an 8192-byte map, with 32 bytes per
Packit 7cfc04
character.
Packit 7cfc04
Only the first
Packit 7cfc04
.I N
Packit 7cfc04
of them are used for an 8x\fIN\fP font
Packit 7cfc04
(0 <
Packit 7cfc04
.I N
Packit 7cfc04
<= 32).
Packit 7cfc04
This call also invalidates the Unicode mapping.
Packit 7cfc04
.TP
Packit 7cfc04
.B PIO_FONTX
Packit 7cfc04
Sets screen font and associated rendering information.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct consolefontdesc {
Packit 7cfc04
    unsigned short charcount;  /* characters in font
Packit 7cfc04
                                  (256 or 512) */
Packit 7cfc04
    unsigned short charheight; /* scan lines per
Packit 7cfc04
                                  character (1\-32) */
Packit 7cfc04
    char          *chardata;   /* font data in
Packit 7cfc04
                                  expanded form */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
If necessary, the screen will be appropriately resized, and
Packit 7cfc04
.B SIGWINCH
Packit 7cfc04
sent to the appropriate processes.
Packit 7cfc04
This call also invalidates the Unicode mapping.
Packit 7cfc04
(Since Linux 1.3.1.)
Packit 7cfc04
.TP
Packit 7cfc04
.B PIO_FONTRESET
Packit 7cfc04
Resets the screen font, size and Unicode mapping to the bootup
Packit 7cfc04
defaults.
Packit 7cfc04
.I argp
Packit 7cfc04
is unused, but should be set to NULL to
Packit 7cfc04
ensure compatibility with future versions of Linux.
Packit 7cfc04
(Since Linux 1.3.28.)
Packit 7cfc04
.TP
Packit 7cfc04
.B GIO_SCRNMAP
Packit 7cfc04
Get screen mapping from kernel.
Packit 7cfc04
.I argp
Packit 7cfc04
points to an area of size
Packit 7cfc04
E_TABSZ, which is loaded with the font positions used to display each
Packit 7cfc04
character.
Packit 7cfc04
This call is likely to return useless information if the
Packit 7cfc04
currently loaded font is more than 256 characters.
Packit 7cfc04
.TP
Packit 7cfc04
.B GIO_UNISCRNMAP
Packit 7cfc04
Get full Unicode screen mapping from kernel.
Packit 7cfc04
.I argp
Packit 7cfc04
points to an
Packit 7cfc04
area of size
Packit 7cfc04
.IR "E_TABSZ*sizeof(unsigned short)" ,
Packit 7cfc04
which is loaded with the
Packit 7cfc04
Unicodes each character represent.
Packit 7cfc04
A special set of Unicodes,
Packit 7cfc04
starting at U+F000, are used to represent "direct to font" mappings.
Packit 7cfc04
(Since Linux 1.3.1.)
Packit 7cfc04
.TP
Packit 7cfc04
.B PIO_SCRNMAP
Packit 7cfc04
Loads the "user definable" (fourth) table in the kernel which maps
Packit 7cfc04
bytes into console screen symbols.
Packit 7cfc04
.I argp
Packit 7cfc04
points to an area of
Packit 7cfc04
size E_TABSZ.
Packit 7cfc04
.TP
Packit 7cfc04
.B PIO_UNISCRNMAP
Packit 7cfc04
Loads the "user definable" (fourth) table in the kernel which maps
Packit 7cfc04
bytes into Unicodes, which are then translated into screen symbols
Packit 7cfc04
according to the currently loaded Unicode-to-font map.
Packit 7cfc04
Special Unicodes starting at U+F000 can be used to map directly to the font
Packit 7cfc04
symbols.
Packit 7cfc04
(Since Linux 1.3.1.)
Packit 7cfc04
.TP
Packit 7cfc04
.B GIO_UNIMAP
Packit 7cfc04
Get Unicode-to-font mapping from kernel.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct unimapdesc {
Packit 7cfc04
    unsigned short  entry_ct;
Packit 7cfc04
    struct unipair *entries;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
where
Packit 7cfc04
.I entries
Packit 7cfc04
points to an array of
Packit 7cfc04
,IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct unipair {
Packit 7cfc04
    unsigned short unicode;
Packit 7cfc04
    unsigned short fontpos;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
(Since Linux 1.1.92.)
Packit 7cfc04
.TP
Packit 7cfc04
.B PIO_UNIMAP
Packit 7cfc04
Put unicode-to-font mapping in kernel.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IR "struct unimapdesc" .
Packit 7cfc04
(Since Linux 1.1.92)
Packit 7cfc04
.TP
Packit 7cfc04
.B PIO_UNIMAPCLR
Packit 7cfc04
Clear table, possibly advise hash algorithm.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct unimapinit {
Packit 7cfc04
    unsigned short advised_hashsize;  /* 0 if no opinion */
Packit 7cfc04
    unsigned short advised_hashstep;  /* 0 if no opinion */
Packit 7cfc04
    unsigned short advised_hashlevel; /* 0 if no opinion */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
(Since Linux 1.1.92.)
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGKBMODE
Packit 7cfc04
Gets current keyboard mode.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.I long
Packit 7cfc04
which is set to one
Packit 7cfc04
of these:
Packit 7cfc04
.TS
Packit 7cfc04
l l.
Packit 7cfc04
K_RAW	0x00  /* Raw (scancode) mode */
Packit 7cfc04
K_XLATE	0x01  /* Translate keycodes using keymap */
Packit 7cfc04
K_MEDIUMRAW	0x02  /* Medium raw (scancode) mode */
Packit 7cfc04
K_UNICODE	0x03  /* Unicode mode */
Packit 7cfc04
K_OFF	0x04  /* Disabled mode; since Linux 2.6.39 */
Packit 7cfc04
.\" K_OFF: commit 9fc3de9c83565fcaa23df74c2fc414bb6e7efb0a
Packit 7cfc04
.TE
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSKBMODE
Packit 7cfc04
Sets current keyboard mode.
Packit 7cfc04
.I argp
Packit 7cfc04
is a
Packit 7cfc04
.I long
Packit 7cfc04
equal to one of the values shown for
Packit 7cfc04
.BR KDGKBMODE .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGKBMETA
Packit 7cfc04
Gets meta key handling mode.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.I long
Packit 7cfc04
which is
Packit 7cfc04
set to one of these:
Packit 7cfc04
.TS
Packit 7cfc04
l l l.
Packit 7cfc04
K_METABIT	0x03	set high order bit
Packit 7cfc04
K_ESCPREFIX	0x04	escape prefix
Packit 7cfc04
.TE
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSKBMETA
Packit 7cfc04
Sets meta key handling mode.
Packit 7cfc04
.I argp
Packit 7cfc04
is a
Packit 7cfc04
.I long
Packit 7cfc04
equal to one of the values shown above for
Packit 7cfc04
.BR KDGKBMETA .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGKBENT
Packit 7cfc04
Gets one entry in key translation table (keycode to action code).
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct kbentry {
Packit 7cfc04
    unsigned char  kb_table;
Packit 7cfc04
    unsigned char  kb_index;
Packit 7cfc04
    unsigned short kb_value;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
with the first two members filled in:
Packit 7cfc04
.I kb_table
Packit 7cfc04
selects the key table (0 <=
Packit 7cfc04
.I kb_table
Packit 7cfc04
< MAX_NR_KEYMAPS),
Packit 7cfc04
and
Packit 7cfc04
.IR kb_index
Packit 7cfc04
is the keycode (0 <=
Packit 7cfc04
.I kb_index
Packit 7cfc04
< NR_KEYS).
Packit 7cfc04
.I kb_value
Packit 7cfc04
is set to the corresponding action code,
Packit 7cfc04
or K_HOLE if there is no such key,
Packit 7cfc04
or K_NOSUCHMAP if
Packit 7cfc04
.I kb_table
Packit 7cfc04
is invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSKBENT
Packit 7cfc04
Sets one entry in translation table.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IR "struct kbentry" .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGKBSENT
Packit 7cfc04
Gets one function key string.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct kbsentry {
Packit 7cfc04
    unsigned char kb_func;
Packit 7cfc04
    unsigned char kb_string[512];
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
.I kb_string
Packit 7cfc04
is set to the (null-terminated) string corresponding to
Packit 7cfc04
the
Packit 7cfc04
.IR kb_func th
Packit 7cfc04
function key action code.
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSKBSENT
Packit 7cfc04
Sets one function key string entry.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IR "struct kbsentry" .
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGKBDIACR
Packit 7cfc04
Read kernel accent table.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct kbdiacrs {
Packit 7cfc04
    unsigned int   kb_cnt;
Packit 7cfc04
    struct kbdiacr kbdiacr[256];
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
where
Packit 7cfc04
.I kb_cnt
Packit 7cfc04
is the number of entries in the array, each of which
Packit 7cfc04
is a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct kbdiacr {
Packit 7cfc04
    unsigned char diacr;
Packit 7cfc04
    unsigned char base;
Packit 7cfc04
    unsigned char result;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.TP
Packit 7cfc04
.B KDGETKEYCODE
Packit 7cfc04
Read kernel keycode table entry (scan code to keycode).
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct kbkeycode {
Packit 7cfc04
    unsigned int scancode;
Packit 7cfc04
    unsigned int keycode;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
.I keycode
Packit 7cfc04
is set to correspond to the given
Packit 7cfc04
.IR scancode .
Packit 7cfc04
(89 <=
Packit 7cfc04
.I scancode
Packit 7cfc04
<= 255 only.
Packit 7cfc04
For 1 <=
Packit 7cfc04
.I scancode
Packit 7cfc04
<= 88,
Packit 7cfc04
.IR keycode == scancode .)
Packit 7cfc04
(Since Linux 1.1.63.)
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSETKEYCODE
Packit 7cfc04
Write kernel keycode table entry.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IR "struct kbkeycode" .
Packit 7cfc04
(Since Linux 1.1.63.)
Packit 7cfc04
.TP
Packit 7cfc04
.B KDSIGACCEPT
Packit 7cfc04
The calling process indicates its willingness to accept the signal
Packit 7cfc04
.I argp
Packit 7cfc04
when it is generated by pressing an appropriate key combination.
Packit 7cfc04
(1 <=
Packit 7cfc04
.I argp
Packit 7cfc04
<= NSIG).
Packit 7cfc04
(See
Packit 7cfc04
.IR spawn_console ()
Packit 7cfc04
in
Packit 7cfc04
.IR linux/drivers/char/keyboard.c .)
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_OPENQRY
Packit 7cfc04
Returns the first available (non-opened) console.
Packit 7cfc04
.I argp
Packit 7cfc04
points to an
Packit 7cfc04
.I int
Packit 7cfc04
which is set to the
Packit 7cfc04
number of the vt (1 <=
Packit 7cfc04
.I *argp
Packit 7cfc04
<= MAX_NR_CONSOLES).
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_GETMODE
Packit 7cfc04
Get mode of active vt.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct vt_mode {
Packit 7cfc04
    char  mode;    /* vt mode */
Packit 7cfc04
    char  waitv;   /* if set, hang on writes if not active */
Packit 7cfc04
    short relsig;  /* signal to raise on release req */
Packit 7cfc04
    short acqsig;  /* signal to raise on acquisition */
Packit 7cfc04
    short frsig;   /* unused (set to 0) */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
which is set to the mode of the active vt.
Packit 7cfc04
.I mode
Packit 7cfc04
is set to one of these values:
Packit 7cfc04
.TS
Packit 7cfc04
l l.
Packit 7cfc04
VT_AUTO	auto vt switching
Packit 7cfc04
VT_PROCESS	process controls switching
Packit 7cfc04
VT_ACKACQ	acknowledge switch
Packit 7cfc04
.TE
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_SETMODE
Packit 7cfc04
Set mode of active vt.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IR "struct vt_mode" .
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_GETSTATE
Packit 7cfc04
Get global vt state info.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct vt_stat {
Packit 7cfc04
    unsigned short v_active;  /* active vt */
Packit 7cfc04
    unsigned short v_signal;  /* signal to send */
Packit 7cfc04
    unsigned short v_state;   /* vt bit mask */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
For each vt in use, the corresponding bit in the
Packit 7cfc04
.I v_state
Packit 7cfc04
member is set.
Packit 7cfc04
(Kernels 1.0 through 1.1.92.)
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_RELDISP
Packit 7cfc04
Release a display.
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_ACTIVATE
Packit 7cfc04
Switch to vt
Packit 7cfc04
.IR argp
Packit 7cfc04
(1 <=
Packit 7cfc04
.I argp
Packit 7cfc04
<= MAX_NR_CONSOLES).
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_WAITACTIVE
Packit 7cfc04
Wait until vt
Packit 7cfc04
.I argp
Packit 7cfc04
has been activated.
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_DISALLOCATE
Packit 7cfc04
Deallocate the memory associated with vt
Packit 7cfc04
.IR argp .
Packit 7cfc04
(Since Linux 1.1.54.)
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_RESIZE
Packit 7cfc04
Set the kernel's idea of screensize.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct vt_sizes {
Packit 7cfc04
    unsigned short v_rows;       /* # rows */
Packit 7cfc04
    unsigned short v_cols;       /* # columns */
Packit 7cfc04
    unsigned short v_scrollsize; /* no longer used */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
Note that this does not change the videomode.
Packit 7cfc04
See
Packit 7cfc04
.BR resizecons (8).
Packit 7cfc04
(Since Linux 1.1.54.)
Packit 7cfc04
.TP
Packit 7cfc04
.B VT_RESIZEX
Packit 7cfc04
Set the kernel's idea of various screen parameters.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct vt_consize {
Packit 7cfc04
    unsigned short v_rows;  /* number of rows */
Packit 7cfc04
    unsigned short v_cols;  /* number of columns */
Packit 7cfc04
    unsigned short v_vlin;  /* number of pixel rows
Packit 7cfc04
                               on screen */
Packit 7cfc04
    unsigned short v_clin;  /* number of pixel rows
Packit 7cfc04
                               per character */
Packit 7cfc04
    unsigned short v_vcol;  /* number of pixel columns
Packit 7cfc04
                               on screen */
Packit 7cfc04
    unsigned short v_ccol;  /* number of pixel columns
Packit 7cfc04
                               per character */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
Any parameter may be set to zero, indicating "no change", but if
Packit 7cfc04
multiple parameters are set, they must be self-consistent.
Packit 7cfc04
Note that this does not change the videomode.
Packit 7cfc04
See
Packit 7cfc04
.BR resizecons (8).
Packit 7cfc04
(Since Linux 1.3.3.)
Packit 7cfc04
.PP
Packit 7cfc04
The action of the following ioctls depends on the first byte in the struct
Packit 7cfc04
pointed to by
Packit 7cfc04
.IR argp ,
Packit 7cfc04
referred to here as the
Packit 7cfc04
.IR subcode .
Packit 7cfc04
These are legal only for the superuser or the owner of the current terminal.
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=0"
Packit 7cfc04
Dump the screen.
Packit 7cfc04
Disappeared in Linux 1.1.92.  (With kernel 1.1.92 or later, read from
Packit 7cfc04
.I /dev/vcsN
Packit 7cfc04
or
Packit 7cfc04
.I /dev/vcsaN
Packit 7cfc04
instead.)
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=1"
Packit 7cfc04
Get task information.
Packit 7cfc04
Disappeared in Linux 1.1.92.
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=2"
Packit 7cfc04
Set selection.
Packit 7cfc04
.I argp
Packit 7cfc04
points to a
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct {
Packit 7cfc04
    char  subcode;
Packit 7cfc04
    short xs, ys, xe, ye;
Packit 7cfc04
    short sel_mode;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
.I xs
Packit 7cfc04
and
Packit 7cfc04
.I ys
Packit 7cfc04
are the starting column and row.
Packit 7cfc04
.I xe
Packit 7cfc04
and
Packit 7cfc04
.I ye
Packit 7cfc04
are the ending
Packit 7cfc04
column and row.
Packit 7cfc04
(Upper left corner is row=column=1.)
Packit 7cfc04
.I sel_mode
Packit 7cfc04
is 0 for character-by-character selection,
Packit 7cfc04
1 for word-by-word selection,
Packit 7cfc04
or 2 for line-by-line selection.
Packit 7cfc04
The indicated screen characters are highlighted and saved
Packit 7cfc04
in the static array sel_buffer in
Packit 7cfc04
.IR devices/char/console.c .
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=3"
Packit 7cfc04
Paste selection.
Packit 7cfc04
The characters in the selection buffer are
Packit 7cfc04
written to
Packit 7cfc04
.IR fd .
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=4"
Packit 7cfc04
Unblank the screen.
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=5"
Packit 7cfc04
Sets contents of a 256-bit look up table defining characters in a "word",
Packit 7cfc04
for word-by-word selection.
Packit 7cfc04
(Since Linux 1.1.32.)
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=6"
Packit 7cfc04
.I argp
Packit 7cfc04
points to a char which is set to the value of the kernel
Packit 7cfc04
variable
Packit 7cfc04
.IR shift_state .
Packit 7cfc04
(Since Linux 1.1.32.)
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=7"
Packit 7cfc04
.I argp
Packit 7cfc04
points to a char which is set to the value of the kernel
Packit 7cfc04
variable
Packit 7cfc04
.IR report_mouse .
Packit 7cfc04
(Since Linux 1.1.33.)
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=8"
Packit 7cfc04
Dump screen width and height, cursor position, and all the
Packit 7cfc04
character-attribute pairs.
Packit 7cfc04
(Kernels 1.1.67 through 1.1.91 only.
Packit 7cfc04
With kernel 1.1.92 or later, read from
Packit 7cfc04
.I /dev/vcsa*
Packit 7cfc04
instead.)
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=9"
Packit 7cfc04
Restore screen width and height, cursor position, and all the
Packit 7cfc04
character-attribute pairs.
Packit 7cfc04
(Kernels 1.1.67 through 1.1.91 only.
Packit 7cfc04
With kernel 1.1.92 or later, write to
Packit 7cfc04
.I /dev/vcsa*
Packit 7cfc04
instead.)
Packit 7cfc04
.TP
Packit 7cfc04
.B "TIOCLINUX, subcode=10"
Packit 7cfc04
Handles the Power Saving
Packit 7cfc04
feature of the new generation of monitors.
Packit 7cfc04
VESA screen blanking mode is set to
Packit 7cfc04
.IR argp[1] ,
Packit 7cfc04
which governs what
Packit 7cfc04
screen blanking does:
Packit 7cfc04
.RS
Packit 7cfc04
.IP 0: 3
Packit 7cfc04
Screen blanking is disabled.
Packit 7cfc04
.IP 1:
Packit 7cfc04
The current video adapter
Packit 7cfc04
register settings are saved, then the controller is programmed to turn off
Packit 7cfc04
the vertical synchronization pulses.
Packit 7cfc04
This puts the monitor into "standby" mode.
Packit 7cfc04
If your monitor has an Off_Mode timer, then
Packit 7cfc04
it will eventually power down by itself.
Packit 7cfc04
.IP 2:
Packit 7cfc04
The current settings are saved, then both the vertical and horizontal
Packit 7cfc04
synchronization pulses are turned off.
Packit 7cfc04
This puts the monitor into "off" mode.
Packit 7cfc04
If your monitor has no Off_Mode timer,
Packit 7cfc04
or if you want your monitor to power down immediately when the
Packit 7cfc04
blank_timer times out, then you choose this option.
Packit 7cfc04
.RI ( Caution:
Packit 7cfc04
Powering down frequently will damage the monitor.)
Packit 7cfc04
(Since Linux 1.1.76.)
Packit 7cfc04
.RE
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
On success, 0 is returned.
Packit 7cfc04
On error, \-1 is returned, and
Packit 7cfc04
.I errno
Packit 7cfc04
is set.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.I errno
Packit 7cfc04
may take on these values:
Packit 7cfc04
.TP
Packit 7cfc04
.B EBADF
Packit 7cfc04
The file descriptor is invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
The file descriptor or
Packit 7cfc04
.I argp
Packit 7cfc04
is invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOTTY
Packit 7cfc04
The file descriptor is not associated with a character special device,
Packit 7cfc04
or the specified request does not apply to it.
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
Insufficient permission.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
.BR Warning :
Packit 7cfc04
Do not regard this man page as documentation of the Linux console ioctls.
Packit 7cfc04
This is provided for the curious only, as an alternative to reading the
Packit 7cfc04
source.
Packit 7cfc04
Ioctl's are undocumented Linux internals, liable to be changed
Packit 7cfc04
without warning.
Packit 7cfc04
(And indeed, this page more or less describes the
Packit 7cfc04
situation as of kernel version 1.1.94;
Packit 7cfc04
there are many minor and not-so-minor
Packit 7cfc04
differences with earlier versions.)
Packit 7cfc04
.PP
Packit 7cfc04
Very often, ioctls are introduced for communication between the
Packit 7cfc04
kernel and one particular well-known program (fdisk, hdparm, setserial,
Packit 7cfc04
tunelp, loadkeys, selection, setfont, etc.), and their behavior will be
Packit 7cfc04
changed when required by this particular program.
Packit 7cfc04
.PP
Packit 7cfc04
Programs using these ioctls will not be portable to other versions
Packit 7cfc04
of UNIX, will not work on older versions of Linux, and will not work
Packit 7cfc04
on future versions of Linux.
Packit 7cfc04
.PP
Packit 7cfc04
Use POSIX functions.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR dumpkeys (1),
Packit 7cfc04
.BR kbd_mode (1),
Packit 7cfc04
.BR loadkeys (1),
Packit 7cfc04
.BR mknod (1),
Packit 7cfc04
.BR setleds (1),
Packit 7cfc04
.BR setmetamode (1),
Packit 7cfc04
.BR execve (2),
Packit 7cfc04
.BR fcntl (2),
Packit 7cfc04
.BR ioctl_tty (2),
Packit 7cfc04
.BR ioperm (2),
Packit 7cfc04
.BR termios (3),
Packit 7cfc04
.BR console_codes (4),
Packit 7cfc04
.BR mt (4),
Packit 7cfc04
.BR sd (4),
Packit 7cfc04
.BR tty (4),
Packit 7cfc04
.BR ttyS (4),
Packit 7cfc04
.BR vcs (4),
Packit 7cfc04
.BR vcsa (4),
Packit 7cfc04
.BR charsets (7),
Packit 7cfc04
.BR mapscrn (8),
Packit 7cfc04
.BR resizecons (8),
Packit 7cfc04
.BR setfont (8)
Packit 7cfc04
.PP
Packit 7cfc04
.IR /usr/include/linux/kd.h ,
Packit 7cfc04
.I /usr/include/linux/vt.h
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.