]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 1995 Jim Van Zandt <jrv@vanzandt.mv.com> and aeb |
2 | .\" Sun Feb 26 11:46:23 MET 1995 | |
3 | .\" | |
1dd72f9c | 4 | .\" %%%LICENSE_START(GPLv2+_DOC_FULL) |
fea681da MK |
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. | |
9 | .\" | |
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. | |
14 | .\" | |
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. | |
19 | .\" | |
20 | .\" You should have received a copy of the GNU General Public | |
c715f741 MK |
21 | .\" License along with this manual; if not, see |
22 | .\" <http://www.gnu.org/licenses/>. | |
6a8d8745 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
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) | |
c5571b61 | 28 | .\" FIXME The following are not documented: |
3dbca875 MK |
29 | .\" KDFONTOP (since 2.1.111) |
30 | .\" KDGKBDIACRUC (since 2.6.24) | |
e0d8018d | 31 | .\" KDSKBDIACR |
3dbca875 MK |
32 | .\" KDSKBDIACRUC (since 2.6.24) |
33 | .\" KDKBDREP (since 2.1.113) | |
e0d8018d | 34 | .\" KDMAPDISP (not implemented as at 2.6.27) |
3dbca875 | 35 | .\" KDUNMAPDISP (not implemented as at 2.6.27) |
e5f53fe5 MK |
36 | .\" VT_LOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG) |
37 | .\" VT_UNLOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG) | |
3dbca875 | 38 | .\" VT_GETHIFONTMASK (since 2.6.18) |
e0d8018d | 39 | .\" |
4b8c67d9 | 40 | .TH IOCTL_CONSOLE 2 2017-09-15 "Linux" "Linux Programmer's Manual" |
fea681da | 41 | .SH NAME |
693dc407 | 42 | ioctl_console \- ioctls for console terminal and virtual consoles |
fea681da | 43 | .SH DESCRIPTION |
60a90ecd MK |
44 | The following Linux-specific |
45 | .BR ioctl (2) | |
e86f51ac | 46 | requests are supported for console terminals and virtual consoles. |
7f63b1e7 MK |
47 | Each requires a third argument, assumed here to be |
48 | .IR argp . | |
49 | .TP | |
50 | .B KDGETLED | |
be7fff26 | 51 | Get state of LEDs. |
7f63b1e7 MK |
52 | .I argp |
53 | points to a | |
54 | .IR char . | |
c13182ef | 55 | The lower three bits |
7f63b1e7 MK |
56 | of |
57 | .I *argp | |
58 | are set to the state of the LEDs, as follows: | |
5a4d28e5 ER |
59 | .TS |
60 | l l l. | |
61 | LED_CAP 0x04 caps lock led | |
d990dc38 | 62 | LED_NUM 0x02 num lock led |
5a4d28e5 ER |
63 | LED_SCR 0x01 scroll lock led |
64 | .TE | |
7f63b1e7 MK |
65 | .TP |
66 | .B KDSETLED | |
c13182ef | 67 | Set the LEDs. |
4448aa21 MK |
68 | The LEDs are set to correspond to the lower three bits of the |
69 | unsigned long integer in | |
7f63b1e7 | 70 | .IR argp . |
c13182ef | 71 | However, if a higher order bit is set, |
fea681da MK |
72 | the LEDs revert to normal: displaying the state of the |
73 | keyboard functions of caps lock, num lock, and scroll lock. | |
dd3568a1 | 74 | .PP |
5231e1bb | 75 | Before Linux 1.1.54, the LEDs just reflected the state of the corresponding |
fea681da | 76 | keyboard flags, and KDGETLED/KDSETLED would also change the keyboard |
c13182ef | 77 | flags. |
5231e1bb | 78 | Since Linux 1.1.54 the LEDs can be made to display arbitrary |
fea681da | 79 | information, but by default they display the keyboard flags. |
5a4d28e5 | 80 | The following two ioctls are used to access the keyboard flags. |
7f63b1e7 MK |
81 | .TP |
82 | .B KDGKBLED | |
fea681da | 83 | Get keyboard flags CapsLock, NumLock, ScrollLock (not lights). |
7f63b1e7 MK |
84 | .I argp |
85 | points to a char which is set to the flag state. | |
fea681da MK |
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 | |
6387216b | 88 | the default flag state. |
5231e1bb | 89 | (Since Linux 1.1.54.) |
7f63b1e7 MK |
90 | .TP |
91 | .B KDSKBLED | |
fea681da | 92 | Set keyboard flags CapsLock, NumLock, ScrollLock (not lights). |
7f63b1e7 | 93 | .I argp |
4448aa21 | 94 | is an unsigned long integer that has the desired flag state. |
fea681da MK |
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 | |
6387216b | 97 | the default flag state. |
5231e1bb | 98 | (Since Linux 1.1.54.) |
7f63b1e7 MK |
99 | .TP |
100 | .B KDGKBTYPE | |
c13182ef MK |
101 | Get keyboard type. |
102 | This returns the value KB_101, defined as 0x02. | |
7f63b1e7 MK |
103 | .TP |
104 | .B KDADDIO | |
c13182ef | 105 | Add I/O port as valid. |
7f63b1e7 MK |
106 | Equivalent to |
107 | .IR ioperm(arg,1,1) . | |
108 | .TP | |
109 | .B KDDELIO | |
c13182ef | 110 | Delete I/O port as valid. |
7f63b1e7 MK |
111 | Equivalent to |
112 | .IR ioperm(arg,1,0) . | |
113 | .TP | |
114 | .B KDENABIO | |
c13182ef | 115 | Enable I/O to video board. |
7f63b1e7 | 116 | Equivalent to |
d2fdb1e3 | 117 | .IR "ioperm(0x3b4, 0x3df\-0x3b4+1, 1)" . |
7f63b1e7 MK |
118 | .TP |
119 | .B KDDISABIO | |
c13182ef | 120 | Disable I/O to video board. |
7f63b1e7 | 121 | Equivalent to |
d2fdb1e3 | 122 | .IR "ioperm(0x3b4, 0x3df\-0x3b4+1, 0)" . |
7f63b1e7 MK |
123 | .TP |
124 | .B KDSETMODE | |
be7fff26 | 125 | Set text/graphics mode. |
7f63b1e7 | 126 | .I argp |
4448aa21 | 127 | is an unsigned integer containing one of: |
5a4d28e5 ER |
128 | .TS |
129 | l l. | |
130 | KD_TEXT 0x00 | |
131 | KD_GRAPHICS 0x01 | |
132 | .TE | |
7f63b1e7 MK |
133 | .TP |
134 | .B KDGETMODE | |
be7fff26 | 135 | Get text/graphics mode. |
7f63b1e7 | 136 | .I argp |
40c7eed4 MK |
137 | points to an |
138 | .I int | |
7f63b1e7 | 139 | which is set to one |
789353da MK |
140 | of the values shown above for |
141 | .BR KDSETMODE . | |
7f63b1e7 MK |
142 | .TP |
143 | .B KDMKTONE | |
c13182ef | 144 | Generate tone of specified length. |
4448aa21 | 145 | The lower 16 bits of the unsigned long integer in |
7f63b1e7 MK |
146 | .I argp |
147 | specify the period in clock cycles, | |
fea681da | 148 | and the upper 16 bits give the duration in msec. |
c13182ef | 149 | If the duration is zero, the sound is turned off. |
fea681da | 150 | Control returns immediately. |
7f63b1e7 MK |
151 | For example, |
152 | .I argp | |
153 | = (125<<16) + 0x637 would specify | |
fea681da | 154 | the beep normally associated with a ctrl-G. |
5231e1bb | 155 | (Thus since Linux 0.99pl1; broken in Linux 2.1.49-50.) |
7f63b1e7 MK |
156 | .TP |
157 | .B KIOCSOUND | |
c13182ef MK |
158 | Start or stop sound generation. |
159 | The lower 16 bits of | |
7f63b1e7 MK |
160 | .I argp |
161 | specify the period in clock cycles | |
162 | (that is, | |
163 | .I argp | |
164 | = 1193180/frequency). | |
165 | .I argp | |
166 | = 0 turns sound off. | |
fea681da | 167 | In either case, control returns immediately. |
7f63b1e7 MK |
168 | .TP |
169 | .B GIO_CMAP | |
d9bfdb9c | 170 | Get the current default color map from kernel. |
7f63b1e7 MK |
171 | .I argp |
172 | points to | |
c13182ef | 173 | a 48-byte array. |
5231e1bb | 174 | (Since Linux 1.3.3.) |
7f63b1e7 MK |
175 | .TP |
176 | .B PIO_CMAP | |
d9bfdb9c | 177 | Change the default text-mode color map. |
7f63b1e7 MK |
178 | .I argp |
179 | points to a | |
fea681da | 180 | 48-byte array which contains, in order, the Red, Green, and Blue |
d9bfdb9c | 181 | values for the 16 available screen colors: 0 is off, and 255 is full |
c13182ef | 182 | intensity. |
d9bfdb9c | 183 | The default colors are, in order: black, dark red, dark |
fea681da MK |
184 | green, brown, dark blue, dark purple, dark cyan, light grey, dark |
185 | grey, bright red, bright green, yellow, bright blue, bright purple, | |
67da5267 | 186 | bright cyan and white. |
5231e1bb | 187 | (Since Linux 1.3.3.) |
7f63b1e7 MK |
188 | .TP |
189 | .B GIO_FONT | |
be7fff26 | 190 | Gets 256-character screen font in expanded form. |
7f63b1e7 | 191 | .I argp |
f0ea168c | 192 | points to an 8192-byte array. |
7f63b1e7 MK |
193 | Fails with error code |
194 | .B EINVAL | |
195 | if the | |
fea681da MK |
196 | currently loaded font is a 512-character font, or if the console is |
197 | not in text mode. | |
7f63b1e7 MK |
198 | .TP |
199 | .B GIO_FONTX | |
be7fff26 | 200 | Gets screen font and associated information. |
7f63b1e7 MK |
201 | .I argp |
202 | points to a | |
203 | .I "struct consolefontdesc" | |
204 | (see | |
205 | .BR PIO_FONTX ). | |
c13182ef | 206 | On call, the |
7f63b1e7 MK |
207 | .I charcount |
208 | field should be set to the maximum number of | |
209 | characters that would fit in the buffer pointed to by | |
210 | .IR chardata . | |
211 | On return, the | |
212 | .I charcount | |
213 | and | |
214 | .I charheight | |
215 | are filled with | |
fea681da | 216 | the respective data for the currently loaded font, and the |
9c1b6f33 | 217 | .I chardata |
7f63b1e7 MK |
218 | array contains the font data if the initial value of |
219 | .I charcount | |
220 | indicated enough space was available; otherwise the | |
221 | buffer is untouched and | |
222 | .I errno | |
223 | is set to | |
224 | .BR ENOMEM . | |
5231e1bb | 225 | (Since Linux 1.3.1.) |
7f63b1e7 MK |
226 | .TP |
227 | .B PIO_FONT | |
c13182ef MK |
228 | Sets 256-character screen font. |
229 | Load font into the EGA/VGA character | |
be7fff26 | 230 | generator. |
7f63b1e7 | 231 | .I argp |
f0ea168c | 232 | points to an 8192-byte map, with 32 bytes per |
c13182ef | 233 | character. |
7f63b1e7 MK |
234 | Only the first |
235 | .I N | |
236 | of them are used for an 8x\fIN\fP font | |
237 | (0 < | |
238 | .I N | |
239 | <= 32). | |
c13182ef | 240 | This call also invalidates the Unicode mapping. |
7f63b1e7 MK |
241 | .TP |
242 | .B PIO_FONTX | |
be7fff26 | 243 | Sets screen font and associated rendering information. |
7f63b1e7 | 244 | .I argp |
fea681da | 245 | points to a |
e646a1ba | 246 | .IP |
3ad4ddcd | 247 | .in +4n |
b76974c1 | 248 | .EX |
fea681da | 249 | struct consolefontdesc { |
c8250206 MK |
250 | unsigned short charcount; /* characters in font |
251 | (256 or 512) */ | |
252 | unsigned short charheight; /* scan lines per | |
d2fdb1e3 | 253 | character (1\-32) */ |
c8250206 MK |
254 | char *chardata; /* font data in |
255 | expanded form */ | |
fea681da | 256 | }; |
b76974c1 | 257 | .EE |
3ad4ddcd | 258 | .in |
e646a1ba | 259 | .IP |
fea681da | 260 | If necessary, the screen will be appropriately resized, and |
7f63b1e7 MK |
261 | .B SIGWINCH |
262 | sent to the appropriate processes. | |
c13182ef | 263 | This call also invalidates the Unicode mapping. |
5231e1bb | 264 | (Since Linux 1.3.1.) |
7f63b1e7 MK |
265 | .TP |
266 | .B PIO_FONTRESET | |
fea681da | 267 | Resets the screen font, size and Unicode mapping to the bootup |
c13182ef | 268 | defaults. |
7f63b1e7 MK |
269 | .I argp |
270 | is unused, but should be set to NULL to | |
67da5267 | 271 | ensure compatibility with future versions of Linux. |
5231e1bb | 272 | (Since Linux 1.3.28.) |
7f63b1e7 MK |
273 | .TP |
274 | .B GIO_SCRNMAP | |
c13182ef | 275 | Get screen mapping from kernel. |
7f63b1e7 MK |
276 | .I argp |
277 | points to an area of size | |
fea681da | 278 | E_TABSZ, which is loaded with the font positions used to display each |
c13182ef MK |
279 | character. |
280 | This call is likely to return useless information if the | |
fea681da | 281 | currently loaded font is more than 256 characters. |
7f63b1e7 MK |
282 | .TP |
283 | .B GIO_UNISCRNMAP | |
be7fff26 | 284 | Get full Unicode screen mapping from kernel. |
7f63b1e7 MK |
285 | .I argp |
286 | points to an | |
287 | area of size | |
01a900f0 | 288 | .IR "E_TABSZ*sizeof(unsigned short)" , |
7f63b1e7 | 289 | which is loaded with the |
c13182ef MK |
290 | Unicodes each character represent. |
291 | A special set of Unicodes, | |
324633ae | 292 | starting at U+F000, are used to represent "direct to font" mappings. |
5231e1bb | 293 | (Since Linux 1.3.1.) |
7f63b1e7 MK |
294 | .TP |
295 | .B PIO_SCRNMAP | |
324633ae | 296 | Loads the "user definable" (fourth) table in the kernel which maps |
be7fff26 | 297 | bytes into console screen symbols. |
7f63b1e7 MK |
298 | .I argp |
299 | points to an area of | |
fea681da | 300 | size E_TABSZ. |
7f63b1e7 MK |
301 | .TP |
302 | .B PIO_UNISCRNMAP | |
324633ae | 303 | Loads the "user definable" (fourth) table in the kernel which maps |
fea681da | 304 | bytes into Unicodes, which are then translated into screen symbols |
c13182ef MK |
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 | |
307 | symbols. | |
5231e1bb | 308 | (Since Linux 1.3.1.) |
7f63b1e7 MK |
309 | .TP |
310 | .B GIO_UNIMAP | |
be7fff26 | 311 | Get Unicode-to-font mapping from kernel. |
7f63b1e7 MK |
312 | .I argp |
313 | points to a | |
b76974c1 | 314 | .IP |
3ad4ddcd | 315 | .in +4n |
b76974c1 | 316 | .EX |
fea681da | 317 | struct unimapdesc { |
aeb4b1fc | 318 | unsigned short entry_ct; |
89ad8b13 | 319 | struct unipair *entries; |
fea681da | 320 | }; |
b76974c1 | 321 | .EE |
3ad4ddcd | 322 | .in |
b76974c1 | 323 | .IP |
7f63b1e7 MK |
324 | where |
325 | .I entries | |
326 | points to an array of | |
a202ed93 | 327 | .IP |
3ad4ddcd | 328 | .in +4n |
b76974c1 | 329 | .EX |
fea681da | 330 | struct unipair { |
aeb4b1fc MK |
331 | unsigned short unicode; |
332 | unsigned short fontpos; | |
fea681da | 333 | }; |
b76974c1 | 334 | .EE |
3ad4ddcd | 335 | .in |
b76974c1 | 336 | .IP |
5231e1bb | 337 | (Since Linux 1.1.92.) |
7f63b1e7 MK |
338 | .TP |
339 | .B PIO_UNIMAP | |
be7fff26 | 340 | Put unicode-to-font mapping in kernel. |
7f63b1e7 MK |
341 | .I argp |
342 | points to a | |
343 | .IR "struct unimapdesc" . | |
5231e1bb | 344 | (Since Linux 1.1.92) |
7f63b1e7 MK |
345 | .TP |
346 | .B PIO_UNIMAPCLR | |
be7fff26 | 347 | Clear table, possibly advise hash algorithm. |
7f63b1e7 MK |
348 | .I argp |
349 | points to a | |
b76974c1 | 350 | .IP |
3ad4ddcd | 351 | .in +4n |
b76974c1 | 352 | .EX |
fea681da | 353 | struct unimapinit { |
aeb4b1fc MK |
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 */ | |
fea681da | 357 | }; |
b76974c1 | 358 | .EE |
3ad4ddcd | 359 | .in |
b76974c1 | 360 | .IP |
5231e1bb | 361 | (Since Linux 1.1.92.) |
7f63b1e7 MK |
362 | .TP |
363 | .B KDGKBMODE | |
be7fff26 | 364 | Gets current keyboard mode. |
7f63b1e7 MK |
365 | .I argp |
366 | points to a | |
367 | .I long | |
368 | which is set to one | |
fea681da | 369 | of these: |
5a4d28e5 ER |
370 | .TS |
371 | l l. | |
baf6737e MK |
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 | |
5a4d28e5 | 378 | .TE |
7f63b1e7 MK |
379 | .TP |
380 | .B KDSKBMODE | |
fea681da | 381 | Sets current keyboard mode. |
7f63b1e7 MK |
382 | .I argp |
383 | is a | |
384 | .I long | |
789353da MK |
385 | equal to one of the values shown for |
386 | .BR KDGKBMODE . | |
7f63b1e7 MK |
387 | .TP |
388 | .B KDGKBMETA | |
be7fff26 | 389 | Gets meta key handling mode. |
7f63b1e7 MK |
390 | .I argp |
391 | points to a | |
392 | .I long | |
393 | which is | |
fea681da | 394 | set to one of these: |
5a4d28e5 ER |
395 | .TS |
396 | l l l. | |
397 | K_METABIT 0x03 set high order bit | |
398 | K_ESCPREFIX 0x04 escape prefix | |
399 | .TE | |
7f63b1e7 MK |
400 | .TP |
401 | .B KDSKBMETA | |
fea681da | 402 | Sets meta key handling mode. |
7f63b1e7 MK |
403 | .I argp |
404 | is a | |
405 | .I long | |
789353da MK |
406 | equal to one of the values shown above for |
407 | .BR KDGKBMETA . | |
7f63b1e7 MK |
408 | .TP |
409 | .B KDGKBENT | |
c13182ef | 410 | Gets one entry in key translation table (keycode to action code). |
7f63b1e7 MK |
411 | .I argp |
412 | points to a | |
b76974c1 | 413 | .IP |
3ad4ddcd | 414 | .in +4n |
b76974c1 | 415 | .EX |
fea681da | 416 | struct kbentry { |
aeb4b1fc MK |
417 | unsigned char kb_table; |
418 | unsigned char kb_index; | |
419 | unsigned short kb_value; | |
fea681da | 420 | }; |
b76974c1 | 421 | .EE |
3ad4ddcd | 422 | .in |
b76974c1 | 423 | .IP |
c13182ef | 424 | with the first two members filled in: |
7f63b1e7 MK |
425 | .I kb_table |
426 | selects the key table (0 <= | |
427 | .I kb_table | |
428 | < MAX_NR_KEYMAPS), | |
429 | and | |
430 | .IR kb_index | |
431 | is the keycode (0 <= | |
432 | .I kb_index | |
433 | < NR_KEYS). | |
434 | .I kb_value | |
435 | is set to the corresponding action code, | |
c13182ef | 436 | or K_HOLE if there is no such key, |
7f63b1e7 MK |
437 | or K_NOSUCHMAP if |
438 | .I kb_table | |
439 | is invalid. | |
440 | .TP | |
441 | .B KDSKBENT | |
be7fff26 | 442 | Sets one entry in translation table. |
7f63b1e7 MK |
443 | .I argp |
444 | points to a | |
445 | .IR "struct kbentry" . | |
446 | .TP | |
447 | .B KDGKBSENT | |
be7fff26 | 448 | Gets one function key string. |
7f63b1e7 MK |
449 | .I argp |
450 | points to a | |
b76974c1 | 451 | .IP |
3ad4ddcd | 452 | .in +4n |
b76974c1 | 453 | .EX |
fea681da | 454 | struct kbsentry { |
aeb4b1fc MK |
455 | unsigned char kb_func; |
456 | unsigned char kb_string[512]; | |
fea681da | 457 | }; |
b8302363 | 458 | .EE |
3ad4ddcd | 459 | .in |
b76974c1 | 460 | .IP |
7f63b1e7 MK |
461 | .I kb_string |
462 | is set to the (null-terminated) string corresponding to | |
463 | the | |
464 | .IR kb_func th | |
465 | function key action code. | |
466 | .TP | |
467 | .B KDSKBSENT | |
be7fff26 | 468 | Sets one function key string entry. |
7f63b1e7 MK |
469 | .I argp |
470 | points to a | |
471 | .IR "struct kbsentry" . | |
472 | .TP | |
473 | .B KDGKBDIACR | |
be7fff26 | 474 | Read kernel accent table. |
7f63b1e7 MK |
475 | .I argp |
476 | points to a | |
b76974c1 | 477 | .IP |
3ad4ddcd | 478 | .in +4n |
b76974c1 | 479 | .EX |
c13182ef | 480 | struct kbdiacrs { |
89ad8b13 MK |
481 | unsigned int kb_cnt; |
482 | struct kbdiacr kbdiacr[256]; | |
fea681da | 483 | }; |
b76974c1 | 484 | .EE |
3ad4ddcd | 485 | .in |
b76974c1 | 486 | .IP |
7f63b1e7 MK |
487 | where |
488 | .I kb_cnt | |
489 | is the number of entries in the array, each of which | |
fea681da | 490 | is a |
b76974c1 | 491 | .IP |
3ad4ddcd | 492 | .in +4n |
b76974c1 | 493 | .EX |
c13182ef | 494 | struct kbdiacr { |
aeb4b1fc MK |
495 | unsigned char diacr; |
496 | unsigned char base; | |
497 | unsigned char result; | |
fea681da | 498 | }; |
b76974c1 | 499 | .EE |
3ad4ddcd | 500 | .in |
7f63b1e7 MK |
501 | .TP |
502 | .B KDGETKEYCODE | |
c13182ef | 503 | Read kernel keycode table entry (scan code to keycode). |
7f63b1e7 MK |
504 | .I argp |
505 | points to a | |
b76974c1 | 506 | .IP |
3ad4ddcd | 507 | .in +4n |
b76974c1 | 508 | .EX |
c13182ef | 509 | struct kbkeycode { |
89ad8b13 MK |
510 | unsigned int scancode; |
511 | unsigned int keycode; | |
cf0a9ace | 512 | }; |
b76974c1 | 513 | .EE |
3ad4ddcd | 514 | .in |
b76974c1 | 515 | .IP |
7f63b1e7 MK |
516 | .I keycode |
517 | is set to correspond to the given | |
518 | .IR scancode . | |
519 | (89 <= | |
520 | .I scancode | |
521 | <= 255 only. | |
522 | For 1 <= | |
523 | .I scancode | |
524 | <= 88, | |
525 | .IR keycode == scancode .) | |
5231e1bb | 526 | (Since Linux 1.1.63.) |
7f63b1e7 MK |
527 | .TP |
528 | .B KDSETKEYCODE | |
be7fff26 | 529 | Write kernel keycode table entry. |
7f63b1e7 MK |
530 | .I argp |
531 | points to a | |
532 | .IR "struct kbkeycode" . | |
5231e1bb | 533 | (Since Linux 1.1.63.) |
7f63b1e7 MK |
534 | .TP |
535 | .B KDSIGACCEPT | |
fea681da | 536 | The calling process indicates its willingness to accept the signal |
7f63b1e7 MK |
537 | .I argp |
538 | when it is generated by pressing an appropriate key combination. | |
539 | (1 <= | |
540 | .I argp | |
541 | <= NSIG). | |
542 | (See | |
543 | .IR spawn_console () | |
544 | in | |
545 | .IR linux/drivers/char/keyboard.c .) | |
546 | .TP | |
547 | .B VT_OPENQRY | |
fea681da | 548 | Returns the first available (non-opened) console. |
7f63b1e7 MK |
549 | .I argp |
550 | points to an | |
551 | .I int | |
552 | which is set to the | |
553 | number of the vt (1 <= | |
554 | .I *argp | |
555 | <= MAX_NR_CONSOLES). | |
556 | .TP | |
557 | .B VT_GETMODE | |
be7fff26 | 558 | Get mode of active vt. |
7f63b1e7 MK |
559 | .I argp |
560 | points to a | |
b76974c1 | 561 | .IP |
3ad4ddcd | 562 | .in +4n |
b76974c1 | 563 | .EX |
fea681da | 564 | struct vt_mode { |
89ad8b13 MK |
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) */ | |
fea681da | 570 | }; |
b76974c1 | 571 | .EE |
3ad4ddcd | 572 | .in |
b76974c1 | 573 | .IP |
c13182ef | 574 | which is set to the mode of the active vt. |
7f63b1e7 MK |
575 | .I mode |
576 | is set to one of these values: | |
5a4d28e5 ER |
577 | .TS |
578 | l l. | |
579 | VT_AUTO auto vt switching | |
580 | VT_PROCESS process controls switching | |
581 | VT_ACKACQ acknowledge switch | |
582 | .TE | |
7f63b1e7 MK |
583 | .TP |
584 | .B VT_SETMODE | |
be7fff26 | 585 | Set mode of active vt. |
7f63b1e7 MK |
586 | .I argp |
587 | points to a | |
588 | .IR "struct vt_mode" . | |
589 | .TP | |
590 | .B VT_GETSTATE | |
be7fff26 | 591 | Get global vt state info. |
7f63b1e7 MK |
592 | .I argp |
593 | points to a | |
b76974c1 | 594 | .IP |
3ad4ddcd | 595 | .in +4n |
b76974c1 | 596 | .EX |
fea681da | 597 | struct vt_stat { |
aeb4b1fc MK |
598 | unsigned short v_active; /* active vt */ |
599 | unsigned short v_signal; /* signal to send */ | |
600 | unsigned short v_state; /* vt bit mask */ | |
fea681da | 601 | }; |
b76974c1 | 602 | .EE |
3ad4ddcd | 603 | .in |
b76974c1 | 604 | .IP |
7f63b1e7 MK |
605 | For each vt in use, the corresponding bit in the |
606 | .I v_state | |
607 | member is set. | |
fea681da | 608 | (Kernels 1.0 through 1.1.92.) |
7f63b1e7 MK |
609 | .TP |
610 | .B VT_RELDISP | |
fea681da | 611 | Release a display. |
7f63b1e7 MK |
612 | .TP |
613 | .B VT_ACTIVATE | |
614 | Switch to vt | |
615 | .IR argp | |
616 | (1 <= | |
617 | .I argp | |
618 | <= MAX_NR_CONSOLES). | |
619 | .TP | |
620 | .B VT_WAITACTIVE | |
621 | Wait until vt | |
622 | .I argp | |
623 | has been activated. | |
624 | .TP | |
625 | .B VT_DISALLOCATE | |
626 | Deallocate the memory associated with vt | |
627 | .IR argp . | |
5231e1bb | 628 | (Since Linux 1.1.54.) |
7f63b1e7 MK |
629 | .TP |
630 | .B VT_RESIZE | |
be7fff26 | 631 | Set the kernel's idea of screensize. |
7f63b1e7 MK |
632 | .I argp |
633 | points to a | |
b76974c1 | 634 | .IP |
3ad4ddcd | 635 | .in +4n |
b76974c1 | 636 | .EX |
fea681da | 637 | struct vt_sizes { |
aeb4b1fc MK |
638 | unsigned short v_rows; /* # rows */ |
639 | unsigned short v_cols; /* # columns */ | |
640 | unsigned short v_scrollsize; /* no longer used */ | |
fea681da | 641 | }; |
b76974c1 | 642 | .EE |
3ad4ddcd | 643 | .in |
b76974c1 | 644 | .IP |
fea681da | 645 | Note that this does not change the videomode. |
c13182ef | 646 | See |
b5cc2ffb | 647 | .BR resizecons (8). |
5231e1bb | 648 | (Since Linux 1.1.54.) |
7f63b1e7 MK |
649 | .TP |
650 | .B VT_RESIZEX | |
be7fff26 | 651 | Set the kernel's idea of various screen parameters. |
7f63b1e7 MK |
652 | .I argp |
653 | points to a | |
b76974c1 | 654 | .IP |
3ad4ddcd | 655 | .in +4n |
b76974c1 | 656 | .EX |
fea681da | 657 | struct vt_consize { |
aeb4b1fc MK |
658 | unsigned short v_rows; /* number of rows */ |
659 | unsigned short v_cols; /* number of columns */ | |
c8250206 MK |
660 | unsigned short v_vlin; /* number of pixel rows |
661 | on screen */ | |
662 | unsigned short v_clin; /* number of pixel rows | |
663 | per character */ | |
664 | unsigned short v_vcol; /* number of pixel columns | |
665 | on screen */ | |
666 | unsigned short v_ccol; /* number of pixel columns | |
667 | per character */ | |
fea681da | 668 | }; |
b76974c1 | 669 | .EE |
3ad4ddcd | 670 | .in |
b76974c1 | 671 | .IP |
324633ae | 672 | Any parameter may be set to zero, indicating "no change", but if |
c13182ef MK |
673 | multiple parameters are set, they must be self-consistent. |
674 | Note that this does not change the videomode. | |
675 | See | |
a7e1c01a | 676 | .BR resizecons (8). |
5231e1bb | 677 | (Since Linux 1.3.3.) |
fea681da | 678 | .PP |
c13182ef | 679 | The action of the following ioctls depends on the first byte in the struct |
7f63b1e7 MK |
680 | pointed to by |
681 | .IR argp , | |
682 | referred to here as the | |
683 | .IR subcode . | |
1285ff3d | 684 | These are legal only for the superuser or the owner of the current terminal. |
7f63b1e7 MK |
685 | .TP |
686 | .B "TIOCLINUX, subcode=0" | |
fea681da | 687 | Dump the screen. |
5231e1bb | 688 | Disappeared in Linux 1.1.92. (With kernel 1.1.92 or later, read from |
7f63b1e7 MK |
689 | .I /dev/vcsN |
690 | or | |
691 | .I /dev/vcsaN | |
692 | instead.) | |
693 | .TP | |
694 | .B "TIOCLINUX, subcode=1" | |
c13182ef | 695 | Get task information. |
5231e1bb | 696 | Disappeared in Linux 1.1.92. |
7f63b1e7 MK |
697 | .TP |
698 | .B "TIOCLINUX, subcode=2" | |
fea681da | 699 | Set selection. |
7f63b1e7 MK |
700 | .I argp |
701 | points to a | |
b76974c1 | 702 | .IP |
66812c74 | 703 | .in +4n |
b76974c1 | 704 | .EX |
cf0a9ace | 705 | struct { |
b76974c1 MK |
706 | char subcode; |
707 | short xs, ys, xe, ye; | |
708 | short sel_mode; | |
3ad4ddcd | 709 | }; |
b76974c1 | 710 | .EE |
66812c74 | 711 | .in |
b76974c1 | 712 | .IP |
7f63b1e7 MK |
713 | .I xs |
714 | and | |
715 | .I ys | |
716 | are the starting column and row. | |
717 | .I xe | |
718 | and | |
719 | .I ye | |
720 | are the ending | |
c13182ef MK |
721 | column and row. |
722 | (Upper left corner is row=column=1.) | |
7f63b1e7 MK |
723 | .I sel_mode |
724 | is 0 for character-by-character selection, | |
c13182ef | 725 | 1 for word-by-word selection, |
fea681da | 726 | or 2 for line-by-line selection. |
c13182ef | 727 | The indicated screen characters are highlighted and saved |
7f63b1e7 MK |
728 | in the static array sel_buffer in |
729 | .IR devices/char/console.c . | |
730 | .TP | |
731 | .B "TIOCLINUX, subcode=3" | |
fea681da MK |
732 | Paste selection. |
733 | The characters in the selection buffer are | |
7f63b1e7 MK |
734 | written to |
735 | .IR fd . | |
736 | .TP | |
737 | .B "TIOCLINUX, subcode=4" | |
fea681da | 738 | Unblank the screen. |
7f63b1e7 MK |
739 | .TP |
740 | .B "TIOCLINUX, subcode=5" | |
fea681da | 741 | Sets contents of a 256-bit look up table defining characters in a "word", |
67da5267 | 742 | for word-by-word selection. |
5231e1bb | 743 | (Since Linux 1.1.32.) |
7f63b1e7 MK |
744 | .TP |
745 | .B "TIOCLINUX, subcode=6" | |
746 | .I argp | |
747 | points to a char which is set to the value of the kernel | |
748 | variable | |
749 | .IR shift_state . | |
5231e1bb | 750 | (Since Linux 1.1.32.) |
7f63b1e7 MK |
751 | .TP |
752 | .B "TIOCLINUX, subcode=7" | |
753 | .I argp | |
754 | points to a char which is set to the value of the kernel | |
755 | variable | |
756 | .IR report_mouse . | |
5231e1bb | 757 | (Since Linux 1.1.33.) |
7f63b1e7 MK |
758 | .TP |
759 | .B "TIOCLINUX, subcode=8" | |
c13182ef | 760 | Dump screen width and height, cursor position, and all the |
fea681da | 761 | character-attribute pairs. |
c13182ef | 762 | (Kernels 1.1.67 through 1.1.91 only. |
7f63b1e7 MK |
763 | With kernel 1.1.92 or later, read from |
764 | .I /dev/vcsa* | |
765 | instead.) | |
766 | .TP | |
767 | .B "TIOCLINUX, subcode=9" | |
c13182ef | 768 | Restore screen width and height, cursor position, and all the |
fea681da | 769 | character-attribute pairs. |
c13182ef | 770 | (Kernels 1.1.67 through 1.1.91 only. |
7f63b1e7 MK |
771 | With kernel 1.1.92 or later, write to |
772 | .I /dev/vcsa* | |
773 | instead.) | |
774 | .TP | |
775 | .B "TIOCLINUX, subcode=10" | |
fea681da | 776 | Handles the Power Saving |
c13182ef | 777 | feature of the new generation of monitors. |
7f63b1e7 MK |
778 | VESA screen blanking mode is set to |
779 | .IR argp[1] , | |
780 | which governs what | |
fea681da | 781 | screen blanking does: |
7f63b1e7 MK |
782 | .RS |
783 | .IP 0: 3 | |
784 | Screen blanking is disabled. | |
785 | .IP 1: | |
786 | The current video adapter | |
fea681da | 787 | register settings are saved, then the controller is programmed to turn off |
c13182ef | 788 | the vertical synchronization pulses. |
35478399 | 789 | This puts the monitor into "standby" mode. |
c13182ef | 790 | If your monitor has an Off_Mode timer, then |
fea681da | 791 | it will eventually power down by itself. |
7f63b1e7 MK |
792 | .IP 2: |
793 | The current settings are saved, then both the vertical and horizontal | |
c13182ef | 794 | synchronization pulses are turned off. |
fea681da MK |
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 | |
c13182ef | 798 | blank_timer times out, then you choose this option. |
7f63b1e7 MK |
799 | .RI ( Caution: |
800 | Powering down frequently will damage the monitor.) | |
5231e1bb | 801 | (Since Linux 1.1.76.) |
7f63b1e7 | 802 | .RE |
47297adb | 803 | .SH RETURN VALUE |
c13182ef | 804 | On success, 0 is returned. |
7f63b1e7 MK |
805 | On error, \-1 is returned, and |
806 | .I errno | |
807 | is set. | |
fea681da | 808 | .SH ERRORS |
7f63b1e7 MK |
809 | .I errno |
810 | may take on these values: | |
fea681da MK |
811 | .TP |
812 | .B EBADF | |
813 | The file descriptor is invalid. | |
814 | .TP | |
fea681da | 815 | .B EINVAL |
7f63b1e7 MK |
816 | The file descriptor or |
817 | .I argp | |
818 | is invalid. | |
fea681da | 819 | .TP |
228234e4 MK |
820 | .B ENOTTY |
821 | The file descriptor is not associated with a character special device, | |
822 | or the specified request does not apply to it. | |
823 | .TP | |
fea681da MK |
824 | .B EPERM |
825 | Insufficient permission. | |
9ba9cb64 MK |
826 | .SH NOTES |
827 | .BR Warning : | |
5a4d28e5 | 828 | Do not regard this man page as documentation of the Linux console ioctls. |
fea681da | 829 | This is provided for the curious only, as an alternative to reading the |
c13182ef MK |
830 | source. |
831 | Ioctl's are undocumented Linux internals, liable to be changed | |
832 | without warning. | |
833 | (And indeed, this page more or less describes the | |
834 | situation as of kernel version 1.1.94; | |
835 | there are many minor and not-so-minor | |
fea681da | 836 | differences with earlier versions.) |
e646a1ba | 837 | .PP |
5a4d28e5 | 838 | Very often, ioctls are introduced for communication between the |
fea681da MK |
839 | kernel and one particular well-known program (fdisk, hdparm, setserial, |
840 | tunelp, loadkeys, selection, setfont, etc.), and their behavior will be | |
841 | changed when required by this particular program. | |
e646a1ba | 842 | .PP |
5a4d28e5 | 843 | Programs using these ioctls will not be portable to other versions |
008f1ecc | 844 | of UNIX, will not work on older versions of Linux, and will not work |
fea681da | 845 | on future versions of Linux. |
e646a1ba | 846 | .PP |
fea681da | 847 | Use POSIX functions. |
47297adb | 848 | .SH SEE ALSO |
fea681da MK |
849 | .BR dumpkeys (1), |
850 | .BR kbd_mode (1), | |
851 | .BR loadkeys (1), | |
852 | .BR mknod (1), | |
853 | .BR setleds (1), | |
854 | .BR setmetamode (1), | |
855 | .BR execve (2), | |
856 | .BR fcntl (2), | |
a9168840 | 857 | .BR ioctl_tty (2), |
fea681da MK |
858 | .BR ioperm (2), |
859 | .BR termios (3), | |
fea681da MK |
860 | .BR console_codes (4), |
861 | .BR mt (4), | |
862 | .BR sd (4), | |
863 | .BR tty (4), | |
f82a9fac | 864 | .BR ttyS (4), |
fea681da MK |
865 | .BR vcs (4), |
866 | .BR vcsa (4), | |
867 | .BR charsets (7), | |
868 | .BR mapscrn (8), | |
869 | .BR resizecons (8), | |
173fe7e7 | 870 | .BR setfont (8) |
e646a1ba | 871 | .PP |
fea681da MK |
872 | .IR /usr/include/linux/kd.h , |
873 | .I /usr/include/linux/vt.h |