2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 1991-1996 Søren Schmidt
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer
12 * in this position and unchanged.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef _SYS_CONSIO_H_
34 #define _SYS_CONSIO_H_
37 #include <sys/types.h>
39 #include <sys/ioccom.h>
42 * Console ioctl commands. Some commands are named as KDXXXX, GIO_XXX, and
43 * PIO_XXX, rather than CONS_XXX, for historical and compatibility reasons.
44 * Some other CONS_XXX commands are works as wrapper around frame buffer
45 * ioctl commands FBIO_XXX. Do not try to change all these commands,
46 * otherwise we shall have compatibility problems.
49 /* get/set video mode */
50 #define KD_TEXT 0 /* set text mode restore fonts */
51 #define KD_TEXT0 0 /* ditto */
52 #define KD_GRAPHICS 1 /* set graphics mode */
53 #define KD_TEXT1 2 /* set text mode !restore fonts */
54 #define KD_PIXEL 3 /* set pixel mode */
55 #define KDGETMODE _IOR('K', 9, int)
56 #define KDSETMODE _IOWINT('K', 10)
58 /* set border color */
59 #define KDSBORDER _IOWINT('K', 13)
61 /* set up raster(pixel) text mode */
65 typedef struct _scr_size scr_size_t;
67 #define KDRASTER _IOW('K', 100, scr_size_t)
69 /* get/set screen char map */
73 typedef struct _scrmap scrmap_t;
75 #define GIO_SCRNMAP _IOR('k', 2, scrmap_t)
76 #define PIO_SCRNMAP _IOW('k', 3, scrmap_t)
78 /* get the current text attribute */
79 #define GIO_ATTR _IOR('a', 0, int)
81 /* get the current text color */
82 #define GIO_COLOR _IOR('c', 0, int)
84 /* get the adapter type (equivalent to FBIO_ADPTYPE) */
85 #define CONS_CURRENT _IOR('c', 1, int)
87 /* get the current video mode (equivalent to FBIO_GETMODE) */
88 #define CONS_GET _IOR('c', 2, int)
91 #define CONS_IO _IO('c', 3)
93 /* set blank time interval */
94 #define CONS_BLANKTIME _IOW('c', 4, int)
96 /* set/get the screen saver (these ioctls are current noop) */
103 typedef struct ssaver ssaver_t;
105 #define CONS_SSAVER _IOW('c', 5, ssaver_t)
106 #define CONS_GSAVER _IOWR('c', 6, ssaver_t)
109 * Set the text cursor type.
111 * This is an old interface extended to support the CONS_HIDDEN_CURSOR bit.
112 * New code should use CONS_CURSORSHAPE. CONS_CURSOR_ATTRS gives the 3
113 * bits supported by the (extended) old interface. The old interface is
114 * especially unusable for hiding the cursor (even with its extension)
115 * since it changes the cursor on all vtys.
117 #define CONS_CURSORTYPE _IOW('c', 7, int)
119 /* set the bell type to audible or visual */
120 #define CONS_VISUAL_BELL (1 << 0)
121 #define CONS_QUIET_BELL (1 << 1)
122 #define CONS_BELLTYPE _IOW('c', 8, int)
124 /* set the history (scroll back) buffer size (in lines) */
125 #define CONS_HISTORY _IOW('c', 9, int)
127 /* clear the history (scroll back) buffer */
128 #define CONS_CLRHIST _IO('c', 10)
130 /* mouse cursor ioctl */
137 typedef struct mouse_data mouse_data_t;
143 typedef struct mouse_mode mouse_mode_t;
146 int id; /* one based */
149 typedef struct mouse_event mouse_event_t;
153 #define MOUSE_SHOW 0x01
154 #define MOUSE_HIDE 0x02
155 #define MOUSE_MOVEABS 0x03
156 #define MOUSE_MOVEREL 0x04
157 #define MOUSE_GETINFO 0x05
158 #define MOUSE_MODE 0x06
159 #define MOUSE_ACTION 0x07
160 #define MOUSE_MOTION_EVENT 0x08
161 #define MOUSE_BUTTON_EVENT 0x09
162 #define MOUSE_MOUSECHAR 0x0a
170 typedef struct mouse_info mouse_info_t;
172 #define CONS_MOUSECTL _IOWR('c', 10, mouse_info_t)
174 /* see if the vty has been idle */
175 #define CONS_IDLE _IOR('c', 11, int)
177 /* set the screen saver mode */
178 #define CONS_NO_SAVER (-1)
179 #define CONS_LKM_SAVER 0
180 #define CONS_USR_SAVER 1
181 #define CONS_SAVERMODE _IOW('c', 12, int)
183 /* start the screen saver */
184 #define CONS_SAVERSTART _IOW('c', 13, int)
186 /* set the text cursor shape (see also CONS_CURSORTYPE above) */
187 #define CONS_BLINK_CURSOR (1 << 0)
188 #define CONS_CHAR_CURSOR (1 << 1)
189 #define CONS_HIDDEN_CURSOR (1 << 2)
190 #define CONS_CURSOR_ATTRS (CONS_BLINK_CURSOR | CONS_CHAR_CURSOR | \
192 #define CONS_CHARCURSOR_COLORS (1 << 26)
193 #define CONS_MOUSECURSOR_COLORS (1 << 27)
194 #define CONS_DEFAULT_CURSOR (1 << 28)
195 #define CONS_SHAPEONLY_CURSOR (1 << 29)
196 #define CONS_RESET_CURSOR (1 << 30)
197 #define CONS_LOCAL_CURSOR (1U << 31)
199 /* shape[0]: flags, shape[1]: base, shape[2]: height */
202 #define CONS_GETCURSORSHAPE _IOWR('c', 14, struct cshape)
203 #define CONS_SETCURSORSHAPE _IOW('c', 15, struct cshape)
205 /* set/get font data */
209 typedef struct fnt8 fnt8_t;
212 char fnt8x14[14*256];
214 typedef struct fnt14 fnt14_t;
217 char fnt8x16[16*256];
219 typedef struct fnt16 fnt16_t;
226 typedef struct vfnt_map vfnt_map_t;
228 #define VFNT_MAP_NORMAL 0
229 #define VFNT_MAP_NORMAL_RIGHT 1
230 #define VFNT_MAP_BOLD 2
231 #define VFNT_MAP_BOLD_RIGHT 3
234 vfnt_map_t *map[VFNT_MAPS];
236 unsigned int map_count[VFNT_MAPS];
237 unsigned int glyph_count;
241 typedef struct vfnt vfnt_t;
243 #define PIO_FONT8x8 _IOW('c', 64, fnt8_t)
244 #define GIO_FONT8x8 _IOR('c', 65, fnt8_t)
245 #define PIO_FONT8x14 _IOW('c', 66, fnt14_t)
246 #define GIO_FONT8x14 _IOR('c', 67, fnt14_t)
247 #define PIO_FONT8x16 _IOW('c', 68, fnt16_t)
248 #define GIO_FONT8x16 _IOR('c', 69, fnt16_t)
249 #define PIO_VFONT _IOW('c', 70, vfnt_t)
250 #define GIO_VFONT _IOR('c', 71, vfnt_t)
251 #define PIO_VFONT_DEFAULT _IO('c', 72)
253 /* get video mode information */
263 u_short mv_row, mv_col;
264 u_short mv_rsz, mv_csz;
266 struct colors mv_norm,
272 typedef struct vid_info vid_info_t;
274 #define CONS_GETINFO _IOWR('c', 73, vid_info_t)
277 #define CONS_GETVERS _IOR('c', 74, int)
279 /* get the video adapter index (equivalent to FBIO_ADAPTER) */
280 #define CONS_CURRENTADP _IOR('c', 100, int)
282 /* get the video adapter information (equivalent to FBIO_ADPINFO) */
283 #define CONS_ADPINFO _IOWR('c', 101, video_adapter_info_t)
285 /* get the video mode information (equivalent to FBIO_MODEINFO) */
286 #define CONS_MODEINFO _IOWR('c', 102, video_info_t)
288 /* find a video mode (equivalent to FBIO_FINDMODE) */
289 #define CONS_FINDMODE _IOWR('c', 103, video_info_t)
291 /* set the frame buffer window origin (equivalent to FBIO_SETWINORG) */
292 #define CONS_SETWINORG _IOWINT('c', 104)
294 /* use the specified keyboard */
295 #define CONS_SETKBD _IOWINT('c', 110)
297 /* release the current keyboard */
298 #define CONS_RELKBD _IO('c', 111)
307 typedef struct scrshot scrshot_t;
309 /* Snapshot the current video buffer */
310 #define CONS_SCRSHOT _IOWR('c', 105, scrshot_t)
312 /* get/set the current terminal emulator info. */
313 #define TI_NAME_LEN 32
314 #define TI_DESC_LEN 64
319 u_char ti_name[TI_NAME_LEN];
320 u_char ti_desc[TI_DESC_LEN];
322 typedef struct term_info term_info_t;
324 #define CONS_GETTERM _IOWR('c', 112, term_info_t)
325 #define CONS_SETTERM _IOW('c', 113, term_info_t)
328 * Vty switching ioctl commands.
331 /* get the next available vty */
332 #define VT_OPENQRY _IOR('v', 1, int)
334 /* set/get vty switching mode */
335 #ifndef _VT_MODE_DECLARED
336 #define _VT_MODE_DECLARED
339 #define VT_AUTO 0 /* switching is automatic */
340 #define VT_PROCESS 1 /* switching controlled by prog */
341 #define VT_KERNEL 255 /* switching controlled in kernel */
342 char waitv; /* not implemented yet SOS */
345 short frsig; /* not implemented yet SOS */
347 typedef struct vt_mode vtmode_t;
348 #endif /* !_VT_MODE_DECLARED */
350 #define VT_SETMODE _IOW('v', 2, vtmode_t)
351 #define VT_GETMODE _IOR('v', 3, vtmode_t)
353 /* acknowledge release or acquisition of a vty */
357 #define VT_RELDISP _IOWINT('v', 4)
359 /* activate the specified vty */
360 #define VT_ACTIVATE _IOWINT('v', 5)
362 /* wait until the specified vty is activate */
363 #define VT_WAITACTIVE _IOWINT('v', 6)
365 /* get the currently active vty */
366 #define VT_GETACTIVE _IOR('v', 7, int)
368 /* get the index of the vty */
369 #define VT_GETINDEX _IOR('v', 8, int)
371 /* prevent switching vtys */
372 #define VT_LOCKSWITCH _IOW('v', 9, int)
375 * Video mode switching ioctl. See sys/fbio.h for mode numbers.
378 #define SW_B40x25 _IO('S', M_B40x25)
379 #define SW_C40x25 _IO('S', M_C40x25)
380 #define SW_B80x25 _IO('S', M_B80x25)
381 #define SW_C80x25 _IO('S', M_C80x25)
382 #define SW_BG320 _IO('S', M_BG320)
383 #define SW_CG320 _IO('S', M_CG320)
384 #define SW_BG640 _IO('S', M_BG640)
385 #define SW_EGAMONO80x25 _IO('S', M_EGAMONO80x25)
386 #define SW_CG320_D _IO('S', M_CG320_D)
387 #define SW_CG640_E _IO('S', M_CG640_E)
388 #define SW_EGAMONOAPA _IO('S', M_EGAMONOAPA)
389 #define SW_CG640x350 _IO('S', M_CG640x350)
390 #define SW_ENH_MONOAPA2 _IO('S', M_ENHMONOAPA2)
391 #define SW_ENH_CG640 _IO('S', M_ENH_CG640)
392 #define SW_ENH_B40x25 _IO('S', M_ENH_B40x25)
393 #define SW_ENH_C40x25 _IO('S', M_ENH_C40x25)
394 #define SW_ENH_B80x25 _IO('S', M_ENH_B80x25)
395 #define SW_ENH_C80x25 _IO('S', M_ENH_C80x25)
396 #define SW_ENH_B80x43 _IO('S', M_ENH_B80x43)
397 #define SW_ENH_C80x43 _IO('S', M_ENH_C80x43)
398 #define SW_MCAMODE _IO('S', M_MCA_MODE)
399 #define SW_VGA_C40x25 _IO('S', M_VGA_C40x25)
400 #define SW_VGA_C80x25 _IO('S', M_VGA_C80x25)
401 #define SW_VGA_C80x30 _IO('S', M_VGA_C80x30)
402 #define SW_VGA_C80x50 _IO('S', M_VGA_C80x50)
403 #define SW_VGA_C80x60 _IO('S', M_VGA_C80x60)
404 #define SW_VGA_M80x25 _IO('S', M_VGA_M80x25)
405 #define SW_VGA_M80x30 _IO('S', M_VGA_M80x30)
406 #define SW_VGA_M80x50 _IO('S', M_VGA_M80x50)
407 #define SW_VGA_M80x60 _IO('S', M_VGA_M80x60)
408 #define SW_VGA11 _IO('S', M_VGA11)
409 #define SW_BG640x480 _IO('S', M_VGA11)
410 #define SW_VGA12 _IO('S', M_VGA12)
411 #define SW_CG640x480 _IO('S', M_VGA12)
412 #define SW_VGA13 _IO('S', M_VGA13)
413 #define SW_VGA_CG320 _IO('S', M_VGA13)
414 #define SW_VGA_CG640 _IO('S', M_VGA_CG640)
415 #define SW_VGA_MODEX _IO('S', M_VGA_MODEX)
417 #define SW_VGA_C90x25 _IO('S', M_VGA_C90x25)
418 #define SW_VGA_M90x25 _IO('S', M_VGA_M90x25)
419 #define SW_VGA_C90x30 _IO('S', M_VGA_C90x30)
420 #define SW_VGA_M90x30 _IO('S', M_VGA_M90x30)
421 #define SW_VGA_C90x43 _IO('S', M_VGA_C90x43)
422 #define SW_VGA_M90x43 _IO('S', M_VGA_M90x43)
423 #define SW_VGA_C90x50 _IO('S', M_VGA_C90x50)
424 #define SW_VGA_M90x50 _IO('S', M_VGA_M90x50)
425 #define SW_VGA_C90x60 _IO('S', M_VGA_C90x60)
426 #define SW_VGA_M90x60 _IO('S', M_VGA_M90x60)
428 #define SW_TEXT_80x25 _IO('S', M_TEXT_80x25)
429 #define SW_TEXT_80x30 _IO('S', M_TEXT_80x30)
430 #define SW_TEXT_80x43 _IO('S', M_TEXT_80x43)
431 #define SW_TEXT_80x50 _IO('S', M_TEXT_80x50)
432 #define SW_TEXT_80x60 _IO('S', M_TEXT_80x60)
433 #define SW_TEXT_132x25 _IO('S', M_TEXT_132x25)
434 #define SW_TEXT_132x30 _IO('S', M_TEXT_132x30)
435 #define SW_TEXT_132x43 _IO('S', M_TEXT_132x43)
436 #define SW_TEXT_132x50 _IO('S', M_TEXT_132x50)
437 #define SW_TEXT_132x60 _IO('S', M_TEXT_132x60)
439 #define SW_VESA_CG640x400 _IO('V', M_VESA_CG640x400 - M_VESA_BASE)
440 #define SW_VESA_CG640x480 _IO('V', M_VESA_CG640x480 - M_VESA_BASE)
441 #define SW_VESA_800x600 _IO('V', M_VESA_800x600 - M_VESA_BASE)
442 #define SW_VESA_CG800x600 _IO('V', M_VESA_CG800x600 - M_VESA_BASE)
443 #define SW_VESA_1024x768 _IO('V', M_VESA_1024x768 - M_VESA_BASE)
444 #define SW_VESA_CG1024x768 _IO('V', M_VESA_CG1024x768 - M_VESA_BASE)
445 #define SW_VESA_1280x1024 _IO('V', M_VESA_1280x1024 - M_VESA_BASE)
446 #define SW_VESA_CG1280x1024 _IO('V', M_VESA_CG1280x1024 - M_VESA_BASE)
447 #define SW_VESA_C80x60 _IO('V', M_VESA_C80x60 - M_VESA_BASE)
448 #define SW_VESA_C132x25 _IO('V', M_VESA_C132x25 - M_VESA_BASE)
449 #define SW_VESA_C132x43 _IO('V', M_VESA_C132x43 - M_VESA_BASE)
450 #define SW_VESA_C132x50 _IO('V', M_VESA_C132x50 - M_VESA_BASE)
451 #define SW_VESA_C132x60 _IO('V', M_VESA_C132x60 - M_VESA_BASE)
452 #define SW_VESA_32K_320 _IO('V', M_VESA_32K_320 - M_VESA_BASE)
453 #define SW_VESA_64K_320 _IO('V', M_VESA_64K_320 - M_VESA_BASE)
454 #define SW_VESA_FULL_320 _IO('V', M_VESA_FULL_320 - M_VESA_BASE)
455 #define SW_VESA_32K_640 _IO('V', M_VESA_32K_640 - M_VESA_BASE)
456 #define SW_VESA_64K_640 _IO('V', M_VESA_64K_640 - M_VESA_BASE)
457 #define SW_VESA_FULL_640 _IO('V', M_VESA_FULL_640 - M_VESA_BASE)
458 #define SW_VESA_32K_800 _IO('V', M_VESA_32K_800 - M_VESA_BASE)
459 #define SW_VESA_64K_800 _IO('V', M_VESA_64K_800 - M_VESA_BASE)
460 #define SW_VESA_FULL_800 _IO('V', M_VESA_FULL_800 - M_VESA_BASE)
461 #define SW_VESA_32K_1024 _IO('V', M_VESA_32K_1024 - M_VESA_BASE)
462 #define SW_VESA_64K_1024 _IO('V', M_VESA_64K_1024 - M_VESA_BASE)
463 #define SW_VESA_FULL_1024 _IO('V', M_VESA_FULL_1024 - M_VESA_BASE)
464 #define SW_VESA_32K_1280 _IO('V', M_VESA_32K_1280 - M_VESA_BASE)
465 #define SW_VESA_64K_1280 _IO('V', M_VESA_64K_1280 - M_VESA_BASE)
466 #define SW_VESA_FULL_1280 _IO('V', M_VESA_FULL_1280 - M_VESA_BASE)
468 #endif /* !_SYS_CONSIO_H_ */