1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<!-- lifted from man+troff by doclifter -->
<refentry>
<!-- Copyright (c) 1995 Jim Van Zandt <jrv@vanzandt.mv.com> and aeb
Sun Feb 26 11:46:23 MET 1995 -->
<!-- This is free documentation; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version. -->
<!-- The GNU General Public License's references to "object code"
and "executables" are to be interpreted as the output of any
document formatting or typesetting system, including
intermediate and printed output. -->
<!-- This manual is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. -->
<!-- You should have received a copy of the GNU General Public
License along with this manual; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
USA. -->
<!-- Modified, Sun Feb 26 15:04:20 1995, faith@cs.unc.edu
Modified, Thu Apr 20 22:08:17 1995, jrv@vanzandt.mv.com
Modified, Mon Sep 18 22:32:47 1995, hpa@storm.net (H. Peter Anvin)
FIXME The following are not documented:
KDFONTOP (since 2.1.111)
KDGKBDIACRUC (since 2.6.24)
KDSKBDIACR
KDSKBDIACRUC (since 2.6.24)
KDKBDREP (since 2.1.113)
KDMAPDISP (not implemented as at 2.6.27)
KDUNMAPDISP (not implemented as at 2.6.27)
VT_LOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG)
VT_UNLOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG)
VT_GETHIFONTMASK (since 2.6.18) -->
<refentryinfo><date>2009-02-28</date></refentryinfo>
<refmeta>
<refentrytitle>CONSOLE_IOCTL</refentrytitle>
<manvolnum>4</manvolnum>
<refmiscinfo class='date'>2009-02-28</refmiscinfo>
<refmiscinfo class='source'>Linux</refmiscinfo>
<refmiscinfo class='manual'>Linux Programmer's Manual</refmiscinfo>
</refmeta>
<refnamediv>
<refname>console_ioctl</refname>
<refpurpose>ioctl's for console terminal and virtual consoles</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsect1 id='description'><title>DESCRIPTION</title>
<para>The following Linux-specific
<citerefentry><refentrytitle>ioctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
requests are supported.
Each requires a third argument, assumed here to be <emphasis remap='I'>argp</emphasis>.</para>
<variablelist remap='IP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGETLED</emphasis></term>
<listitem>
<para>Get state of LEDs.
<emphasis remap='I'>argp</emphasis> points to a <emphasis remap='I'>char</emphasis>.
The lower three bits
of <emphasis remap='I'>*argp</emphasis> are set to the state of the LEDs, as follows:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='3' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<tbody>
<row>
<entry align='left'>LED_CAP </entry>
<entry align='left'>0x04</entry>
<entry align='left'>caps lock led</entry>
</row>
<row>
<entry align='left'>LEC_NUM </entry>
<entry align='left'>0x02</entry>
<entry align='left'>num lock led</entry>
</row>
<row>
<entry align='left'>LED_SCR </entry>
<entry align='left'>0x01</entry>
<entry align='left'>scroll lock led</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSETLED</emphasis></term>
<listitem>
<para>Set the LEDs.
The LEDs are set to correspond to the lower three bits of
<emphasis remap='I'>argp</emphasis>.
However, if a higher order bit is set,
the LEDs revert to normal: displaying the state of the
keyboard functions of caps lock, num lock, and scroll lock.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Before 1.1.54, the LEDs just reflected the state of the corresponding
keyboard flags, and KDGETLED/KDSETLED would also change the keyboard
flags.
Since 1.1.54 the leds can be made to display arbitrary
information, but by default they display the keyboard flags.
The following two ioctl's are used to access the keyboard flags.</para>
<variablelist remap='IP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGKBLED</emphasis></term>
<listitem>
<para>Get keyboard flags CapsLock, NumLock, ScrollLock (not lights).
<emphasis remap='I'>argp</emphasis> points to a char which is set to the flag state.
The low order three bits (mask 0x7) get the current flag state,
and the low order bits of the next nibble (mask 0x70) get
the default flag state.
(Since 1.1.54.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSKBLED</emphasis></term>
<listitem>
<para>Set keyboard flags CapsLock, NumLock, ScrollLock (not lights).
<emphasis remap='I'>argp</emphasis> has the desired flag state.
The low order three bits (mask 0x7) have the flag state,
and the low order bits of the next nibble (mask 0x70) have
the default flag state.
(Since 1.1.54.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGKBTYPE</emphasis></term>
<listitem>
<para>Get keyboard type.
This returns the value KB_101, defined as 0x02.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDADDIO</emphasis></term>
<listitem>
<para>Add I/O port as valid.
Equivalent to <emphasis remap='I'>ioperm(arg,1,1)</emphasis>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDDELIO</emphasis></term>
<listitem>
<para>Delete I/O port as valid.
Equivalent to <emphasis remap='I'>ioperm(arg,1,0)</emphasis>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDENABIO</emphasis></term>
<listitem>
<para>Enable I/O to video board.
Equivalent to <emphasis remap='I'>ioperm(0x3b4, 0x3df-0x3b4+1, 1)</emphasis>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDDISABIO</emphasis></term>
<listitem>
<para>Disable I/O to video board.
Equivalent to <emphasis remap='I'>ioperm(0x3b4, 0x3df-0x3b4+1, 0)</emphasis>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSETMODE</emphasis></term>
<listitem>
<para>Set text/graphics mode.
<emphasis remap='I'>argp</emphasis> is one of these:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<tbody>
<row>
<entry align='left'>KD_TEXT </entry>
<entry align='left'>0x00</entry>
</row>
<row>
<entry align='left'>KD_GRAPHICS</entry>
<entry align='left'>0x01</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGETMODE</emphasis></term>
<listitem>
<para>Get text/graphics mode.
<emphasis remap='I'>argp</emphasis> points to a <emphasis remap='I'>long</emphasis> which is set to one
of the above values.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDMKTONE</emphasis></term>
<listitem>
<para>Generate tone of specified length.
The lower 16 bits of <emphasis remap='I'>argp</emphasis> specify the period in clock cycles,
and the upper 16 bits give the duration in msec.
If the duration is zero, the sound is turned off.
Control returns immediately.
For example, <emphasis remap='I'>argp</emphasis> = (125<<16) + 0x637 would specify
the beep normally associated with a ctrl-G.
(Thus since 0.99pl1; broken in 2.1.49-50.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KIOCSOUND</emphasis></term>
<listitem>
<para>Start or stop sound generation.
The lower 16 bits of
<emphasis remap='I'>argp</emphasis> specify the period in clock cycles
(that is, <emphasis remap='I'>argp</emphasis> = 1193180/frequency).
<emphasis remap='I'>argp</emphasis> = 0 turns sound off.
In either case, control returns immediately.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>GIO_CMAP</emphasis></term>
<listitem>
<para>Get the current default color map from kernel.
<emphasis remap='I'>argp</emphasis> points to
a 48-byte array.
(Since 1.3.3.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>PIO_CMAP</emphasis></term>
<listitem>
<para>Change the default text-mode color map.
<emphasis remap='I'>argp</emphasis> points to a
48-byte array which contains, in order, the Red, Green, and Blue
values for the 16 available screen colors: 0 is off, and 255 is full
intensity.
The default colors are, in order: black, dark red, dark
green, brown, dark blue, dark purple, dark cyan, light grey, dark
grey, bright red, bright green, yellow, bright blue, bright purple,
bright cyan and white.
(Since 1.3.3.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>GIO_FONT</emphasis></term>
<listitem>
<para>Gets 256-character screen font in expanded form.
<emphasis remap='I'>argp</emphasis> points to an 8192 byte array.
Fails with error code <emphasis role='strong' remap='B'>EINVAL</emphasis> if the
currently loaded font is a 512-character font, or if the console is
not in text mode.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>GIO_FONTX</emphasis></term>
<listitem>
<para>Gets screen font and associated information.
<emphasis remap='I'>argp</emphasis> points to a
<emphasis remap='I'>struct consolefontdesc</emphasis> (see <emphasis role='strong' remap='B'>PIO_FONTX</emphasis>).
On call, the
<emphasis remap='I'>charcount</emphasis> field should be set to the maximum number of
characters that would fit in the buffer pointed to by <emphasis remap='I'>chardata</emphasis>.
On return, the <emphasis remap='I'>charcount</emphasis> and <emphasis remap='I'>charheight</emphasis> are filled with
the respective data for the currently loaded font, and the
<emphasis remap='I'>chardata</emphasis> array contains the font data if the initial value of
<emphasis remap='I'>charcount</emphasis> indicated enough space was available; otherwise the
buffer is untouched and <varname>errno</varname> is set to <emphasis role='strong' remap='B'>ENOMEM</emphasis>.
(Since 1.3.1.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>PIO_FONT</emphasis></term>
<listitem>
<para>Sets 256-character screen font.
Load font into the EGA/VGA character
generator.
<emphasis remap='I'>argp</emphasis> points to a 8192 byte map, with 32 bytes per
character.
Only first <emphasis remap='I'>N</emphasis> of them are used for an 8x<emphasis remap='I'>N</emphasis> font
(0 < <emphasis remap='I'>N</emphasis> <= 32).
This call also invalidates the Unicode mapping.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>PIO_FONTX</emphasis></term>
<listitem>
<para>Sets screen font and associated rendering information.
<emphasis remap='I'>argp</emphasis>
points to a</para>
<programlisting remap='.nf .ft CW'>
struct consolefontdesc {
unsigned short charcount; /* characters in font
(256 or 512) */
unsigned short charheight; /* scan lines per
character (1-32) */
char *chardata; /* font data in
expanded form */
};
</programlisting> <!-- .fi -->
<para>If necessary, the screen will be appropriately resized, and
<emphasis role='strong' remap='B'>SIGWINCH</emphasis> sent to the appropriate processes.
This call also invalidates the Unicode mapping.
(Since 1.3.1.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>PIO_FONTRESET</emphasis></term>
<listitem>
<para>Resets the screen font, size and Unicode mapping to the bootup
defaults.
<emphasis remap='I'>argp</emphasis> is unused, but should be set to NULL to
ensure compatibility with future versions of Linux.
(Since 1.3.28.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>GIO_SCRNMAP</emphasis></term>
<listitem>
<para>Get screen mapping from kernel.
<emphasis remap='I'>argp</emphasis> points to an area of size
E_TABSZ, which is loaded with the font positions used to display each
character.
This call is likely to return useless information if the
currently loaded font is more than 256 characters.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>GIO_UNISCRNMAP</emphasis></term>
<listitem>
<para>Get full Unicode screen mapping from kernel.
<emphasis remap='I'>argp</emphasis> points to an
area of size E_TABSZ*sizeof(unsigned short), which is loaded with the
Unicodes each character represent.
A special set of Unicodes,
starting at U+F000, are used to represent "direct to font" mappings.
(Since 1.3.1.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>PIO_SCRNMAP</emphasis></term>
<listitem>
<para>Loads the "user definable" (fourth) table in the kernel which maps
bytes into console screen symbols.
<emphasis remap='I'>argp</emphasis> points to an area of
size E_TABSZ.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>PIO_UNISCRNMAP</emphasis></term>
<listitem>
<para>Loads the "user definable" (fourth) table in the kernel which maps
bytes into Unicodes, which are then translated into screen symbols
according to the currently loaded Unicode-to-font map.
Special Unicodes starting at U+F000 can be used to map directly to the font
symbols.
(Since 1.3.1.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>GIO_UNIMAP</emphasis></term>
<listitem>
<para>Get Unicode-to-font mapping from kernel.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct unimapdesc {
unsigned short entry_ct;
struct unipair *entries;
};
</programlisting> <!-- .fi -->
<para>where <emphasis remap='I'>entries</emphasis> points to an array of</para>
<programlisting remap='.nf .ft CW'>
struct unipair {
unsigned short unicode;
unsigned short fontpos;
};
</programlisting> <!-- .fi -->
<para>(Since 1.1.92.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>PIO_UNIMAP</emphasis></term>
<listitem>
<para>Put unicode-to-font mapping in kernel.
<emphasis remap='I'>argp</emphasis> points to a
<emphasis remap='I'>struct unimapdesc</emphasis>.
(Since 1.1.92)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>PIO_UNIMAPCLR</emphasis></term>
<listitem>
<para>Clear table, possibly advise hash algorithm.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct unimapinit {
unsigned short advised_hashsize; /* 0 if no opinion */
unsigned short advised_hashstep; /* 0 if no opinion */
unsigned short advised_hashlevel; /* 0 if no opinion */
};
</programlisting> <!-- .fi -->
<para>(Since 1.1.92.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGKBMODE</emphasis></term>
<listitem>
<para>Gets current keyboard mode.
<emphasis remap='I'>argp</emphasis> points to a <emphasis remap='I'>long</emphasis> which is set to one
of these:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<tbody>
<row>
<entry align='left'>K_RAW </entry>
<entry align='left'>0x00</entry>
</row>
<row>
<entry align='left'>K_XLATE </entry>
<entry align='left'>0x01</entry>
</row>
<row>
<entry align='left'>K_MEDIUMRAW</entry>
<entry align='left'>0x02</entry>
</row>
<row>
<entry align='left'>K_UNICODE </entry>
<entry align='left'>0x03</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSKBMODE</emphasis></term>
<listitem>
<para>Sets current keyboard mode.
<emphasis remap='I'>argp</emphasis> is a <emphasis remap='I'>long</emphasis> equal to one of the above values.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGKBMETA</emphasis></term>
<listitem>
<para>Gets meta key handling mode.
<emphasis remap='I'>argp</emphasis> points to a <emphasis remap='I'>long</emphasis> which is
set to one of these:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='3' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<tbody>
<row>
<entry align='left'>K_METABIT </entry>
<entry align='left'>0x03</entry>
<entry align='left'>set high order bit</entry>
</row>
<row>
<entry align='left'>K_ESCPREFIX</entry>
<entry align='left'>0x04</entry>
<entry align='left'>escape prefix</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSKBMETA</emphasis></term>
<listitem>
<para>Sets meta key handling mode.
<emphasis remap='I'>argp</emphasis> is a <emphasis remap='I'>long</emphasis> equal to one of the above values.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGKBENT</emphasis></term>
<listitem>
<para>Gets one entry in key translation table (keycode to action code).
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct kbentry {
unsigned char kb_table;
unsigned char kb_index;
unsigned short kb_value;
};
</programlisting> <!-- .fi -->
<para>with the first two members filled in:
<emphasis remap='I'>kb_table</emphasis> selects the key table (0 <= <emphasis remap='I'>kb_table</emphasis> < MAX_NR_KEYMAPS),
and <emphasis remap='I'>kb_index</emphasis> is the keycode (0 <= <emphasis remap='I'>kb_index</emphasis> < NR_KEYS).
<emphasis remap='I'>kb_value</emphasis> is set to the corresponding action code,
or K_HOLE if there is no such key,
or K_NOSUCHMAP if <emphasis remap='I'>kb_table</emphasis> is invalid.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSKBENT</emphasis></term>
<listitem>
<para>Sets one entry in translation table.
<emphasis remap='I'>argp</emphasis> points to
a <emphasis remap='I'>struct kbentry</emphasis>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGKBSENT</emphasis></term>
<listitem>
<para>Gets one function key string.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct kbsentry {
unsigned char kb_func;
unsigned char kb_string[512];
};
</programlisting> <!-- .fi -->
<para><emphasis remap='I'>kb_string</emphasis> is set to the (null-terminated) string corresponding to
the <emphasis remap='I'>kb_func</emphasis>th function key action code.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSKBSENT</emphasis></term>
<listitem>
<para>Sets one function key string entry.
<emphasis remap='I'>argp</emphasis> points to
a <emphasis remap='I'>struct kbsentry</emphasis>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGKBDIACR</emphasis></term>
<listitem>
<para>Read kernel accent table.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct kbdiacrs {
unsigned int kb_cnt;
struct kbdiacr kbdiacr[256];
};
</programlisting> <!-- .fi -->
<para>where <emphasis remap='I'>kb_cnt</emphasis> is the number of entries in the array, each of which
is a</para>
<programlisting remap='.nf .ft CW'>
struct kbdiacr {
unsigned char diacr;
unsigned char base;
unsigned char result;
};
</programlisting> <!-- .fi -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDGETKEYCODE</emphasis></term>
<listitem>
<para>Read kernel keycode table entry (scan code to keycode).
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct kbkeycode {
unsigned int scancode;
unsigned int keycode;
};
</programlisting> <!-- .fi -->
<para><emphasis remap='I'>keycode</emphasis> is set to correspond to the given <emphasis remap='I'>scancode</emphasis>.
(89 <= <emphasis remap='I'>scancode</emphasis> <= 255 only.
For 1 <= <emphasis remap='I'>scancode</emphasis> <= 88, <emphasis remap='I'>keycode</emphasis>==<emphasis remap='I'>scancode</emphasis>.)
(Since 1.1.63.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSETKEYCODE</emphasis></term>
<listitem>
<para>Write kernel keycode table entry.
<emphasis remap='I'>argp</emphasis> points to
a <emphasis remap='I'>struct kbkeycode</emphasis>.
(Since 1.1.63.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>KDSIGACCEPT</emphasis></term>
<listitem>
<para>The calling process indicates its willingness to accept the signal
<emphasis remap='I'>argp</emphasis> when it is generated by pressing an appropriate key combination.
(1 <= <emphasis remap='I'>argp</emphasis> <= NSIG).
(See spawn_console() in linux/drivers/char/keyboard.c.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_OPENQRY</emphasis></term>
<listitem>
<para>Returns the first available (non-opened) console.
<emphasis remap='I'>argp</emphasis> points to an <emphasis remap='I'>int</emphasis> which is set to the
number of the vt (1 <= <emphasis remap='I'>*argp</emphasis> <= MAX_NR_CONSOLES).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_GETMODE</emphasis></term>
<listitem>
<para>Get mode of active vt.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct vt_mode {
char mode; /* vt mode */
char waitv; /* if set, hang on writes if not active */
short relsig; /* signal to raise on release req */
short acqsig; /* signal to raise on acquisition */
short frsig; /* unused (set to 0) */
};
</programlisting> <!-- .fi -->
<para>which is set to the mode of the active vt.
<emphasis remap='I'>mode</emphasis> is set to one of these values:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<tbody>
<row>
<entry align='left'>VT_AUTO </entry>
<entry align='left'>auto vt switching</entry>
</row>
<row>
<entry align='left'>VT_PROCESS</entry>
<entry align='left'>process controls switching</entry>
</row>
<row>
<entry align='left'>VT_ACKACQ </entry>
<entry align='left'>acknowledge switch</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_SETMODE</emphasis></term>
<listitem>
<para>Set mode of active vt.
<emphasis remap='I'>argp</emphasis> points to
a <emphasis remap='I'>struct vt_mode</emphasis>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_GETSTATE</emphasis></term>
<listitem>
<para>Get global vt state info.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct vt_stat {
unsigned short v_active; /* active vt */
unsigned short v_signal; /* signal to send */
unsigned short v_state; /* vt bit mask */
};
</programlisting> <!-- .fi -->
<para>For each vt in use, the corresponding bit in the <emphasis remap='I'>v_state</emphasis> member is set.
(Kernels 1.0 through 1.1.92.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_RELDISP</emphasis></term>
<listitem>
<para>Release a display.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_ACTIVATE</emphasis></term>
<listitem>
<para>Switch to vt <emphasis remap='I'>argp</emphasis> (1 <= <emphasis remap='I'>argp</emphasis> <= MAX_NR_CONSOLES).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_WAITACTIVE</emphasis></term>
<listitem>
<para>Wait until vt <emphasis remap='I'>argp</emphasis> has been activated.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_DISALLOCATE</emphasis></term>
<listitem>
<para>Deallocate the memory associated with vt <emphasis remap='I'>argp</emphasis>.
(Since 1.1.54.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_RESIZE</emphasis></term>
<listitem>
<para>Set the kernel's idea of screensize.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct vt_sizes {
unsigned short v_rows; /* # rows */
unsigned short v_cols; /* # columns */
unsigned short v_scrollsize; /* no longer used */
};
</programlisting> <!-- .fi -->
<para>Note that this does not change the videomode.
See
<citerefentry><refentrytitle>resizecons</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
(Since 1.1.54.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>VT_RESIZEX</emphasis></term>
<listitem>
<para>Set the kernel's idea of various screen parameters.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct vt_consize {
unsigned short v_rows; /* number of rows */
unsigned short v_cols; /* number of columns */
unsigned short v_vlin; /* number of pixel rows
on screen */
unsigned short v_clin; /* number of pixel rows
per character */
unsigned short v_vcol; /* number of pixel columns
on screen */
unsigned short v_ccol; /* number of pixel columns
per character */
};
</programlisting> <!-- .fi -->
<para>Any parameter may be set to zero, indicating "no change", but if
multiple parameters are set, they must be self-consistent.
Note that this does not change the videomode.
See
<citerefentry><refentrytitle>resizecons</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
(Since 1.3.3.)</para>
</listitem>
</varlistentry>
</variablelist>
<para>The action of the following ioctls depends on the first byte in the struct
pointed to by <emphasis remap='I'>argp</emphasis>, referred to here as the <emphasis remap='I'>subcode</emphasis>.
These are legal only for the superuser or the owner of the current tty.</para>
<variablelist remap='IP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=0</emphasis></term>
<listitem>
<para>Dump the screen.
Disappeared in 1.1.92. (With kernel 1.1.92 or later, read from
/dev/vcsN or /dev/vcsaN instead.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=1</emphasis></term>
<listitem>
<para>Get task information.
Disappeared in 1.1.92.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=2</emphasis></term>
<listitem>
<para>Set selection.
<emphasis remap='I'>argp</emphasis> points to a</para>
<programlisting remap='.nf .ft CW'>
struct {
char subcode;
short xs, ys, xe, ye;
short sel_mode;
};
</programlisting> <!-- .fi -->
<para><emphasis remap='I'>xs</emphasis> and <emphasis remap='I'>ys</emphasis> are the starting column and row.
<emphasis remap='I'>xe</emphasis> and <emphasis remap='I'>ye</emphasis> are the ending
column and row.
(Upper left corner is row=column=1.)
<emphasis remap='I'>sel_mode</emphasis> is 0 for character-by-character selection,
1 for word-by-word selection,
or 2 for line-by-line selection.
The indicated screen characters are highlighted and saved
in the static array sel_buffer in devices/char/console.c.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=3</emphasis></term>
<listitem>
<para>Paste selection.
The characters in the selection buffer are
written to <emphasis remap='I'>fd</emphasis>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=4</emphasis></term>
<listitem>
<para>Unblank the screen.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=5</emphasis></term>
<listitem>
<para>Sets contents of a 256-bit look up table defining characters in a "word",
for word-by-word selection.
(Since 1.1.32.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=6</emphasis></term>
<listitem>
<para><emphasis remap='I'>argp</emphasis> points to a char which is set to the value of the kernel
variable <emphasis remap='I'>shift_state</emphasis>.
(Since 1.1.32.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=7</emphasis></term>
<listitem>
<para><emphasis remap='I'>argp</emphasis> points to a char which is set to the value of the kernel
variable <emphasis remap='I'>report_mouse</emphasis>.
(Since 1.1.33.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=8</emphasis></term>
<listitem>
<para>Dump screen width and height, cursor position, and all the
character-attribute pairs.
(Kernels 1.1.67 through 1.1.91 only.
With kernel 1.1.92 or later, read from /dev/vcsa* instead.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=9</emphasis></term>
<listitem>
<para>Restore screen width and height, cursor position, and all the
character-attribute pairs.
(Kernels 1.1.67 through 1.1.91 only.
With kernel 1.1.92 or later, write to /dev/vcsa* instead.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>TIOCLINUX, subcode=10</emphasis></term>
<listitem>
<para>Handles the Power Saving
feature of the new generation of monitors.
VESA screen blanking mode is set to <emphasis remap='I'>argp</emphasis>[1], which governs what
screen blanking does:</para>
<para> <literal>0</literal>: Screen blanking is disabled.</para>
<para> <literal>1</literal>: The current video adapter
register settings are saved, then the controller is programmed to turn off
the vertical synchronization pulses.
This puts the monitor into "standby" mode.
If your monitor has an Off_Mode timer, then
it will eventually power down by itself.</para>
<para> <literal>2</literal>: The current
settings are saved, then both the vertical and horizontal
synchronization pulses are turned off.
This puts the monitor into "off" mode.
If your monitor has no Off_Mode timer,
or if you want your monitor to power down immediately when the
blank_timer times out, then you choose this option.
(<emphasis remap='I'>Caution:</emphasis> Powering down frequently will damage the monitor.)</para>
<para>(Since 1.1.76.)</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='return_value'><title>RETURN VALUE</title>
<para>On success, 0 is returned.
On error -1 is returned, and <varname>errno</varname> is set.</para>
</refsect1>
<refsect1 id='errors'><title>ERRORS</title>
<para><varname>errno</varname> may take on these values:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>EBADF</emphasis></term>
<listitem>
<para>The file descriptor is invalid.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>ENOTTY</emphasis></term>
<listitem>
<para>The file descriptor is not associated with a character special device,
or the specified request does not apply to it.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>EINVAL</emphasis></term>
<listitem>
<para>The file descriptor or <emphasis remap='I'>argp</emphasis> is invalid.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>EPERM</emphasis></term>
<listitem>
<para>Insufficient permission.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='notes'><title>NOTES</title>
<para><emphasis role='strong' remap='B'>Warning</emphasis>:
Do not regard this man page as documentation of the Linux console ioctl's.
This is provided for the curious only, as an alternative to reading the
source.
Ioctl's are undocumented Linux internals, liable to be changed
without warning.
(And indeed, this page more or less describes the
situation as of kernel version 1.1.94;
there are many minor and not-so-minor
differences with earlier versions.)</para>
<para>Very often, ioctl's are introduced for communication between the
kernel and one particular well-known program (fdisk, hdparm, setserial,
tunelp, loadkeys, selection, setfont, etc.), and their behavior will be
changed when required by this particular program.</para>
<para>Programs using these ioctl's will not be portable to other versions
of UNIX, will not work on older versions of Linux, and will not work
on future versions of Linux.</para>
<para>Use POSIX functions.</para>
</refsect1>
<refsect1 id='see_also'><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>dumpkeys</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>kbd_mode</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>loadkeys</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>mknod</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>setleds</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>setmetamode</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>execve</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
<citerefentry><refentrytitle>fcntl</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
<citerefentry><refentrytitle>ioperm</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
<citerefentry><refentrytitle>termios</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>console</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>console_codes</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>mt</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>tty</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>tty_ioctl</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>ttyS</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>vcs</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>vcsa</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
<citerefentry><refentrytitle>charsets</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
<citerefentry><refentrytitle>mapscrn</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>resizecons</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>setfont</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<filename>/usr/include/linux/kd.h</filename>,
<filename>/usr/include/linux/vt.h</filename></para>
</refsect1>
<refsect1 id='colophon'><title>COLOPHON</title>
<para>This page is part of release 3.35 of the Linux
<emphasis remap='I'>man-pages</emphasis>
project.
A description of the project,
and information about reporting bugs,
can be found at
<ulink url='http://man7.org/linux/man-pages/'>http://man7.org/linux/man-pages/</ulink>.</para>
</refsect1>
</refentry>
|