1 /// A translation of `linux/kd.h` 2 module sily.terminal.linux.kd; 3 4 /* 0x4B is 'K', to avoid collision with termios and vt */ 5 6 enum GIO_FONT = 0x4B60; /* gets font in expanded form */ 7 enum PIO_FONT = 0x4B61; /* use font in expanded form */ 8 9 enum GIO_FONTX = 0x4B6B; /* get font using struct consolefontdesc */ 10 enum PIO_FONTX = 0x4B6C; /* set font using struct consolefontdesc */ 11 struct consolefontdesc { 12 ushort charcount; /* characters in font (256 or 512) */ 13 ushort charheight; /* scan lines per character (1-32) */ 14 char* chardata; /* font data in expanded form */ 15 } 16 17 enum PIO_FONTRESET = 0x4B6D; /* reset to default font */ 18 19 enum GIO_CMAP = 0x4B70; /* gets colour palette on VGA+ */ 20 enum PIO_CMAP = 0x4B71; /* sets colour palette on VGA+ */ 21 22 enum KIOCSOUND = 0x4B2F; /* start sound generation (0 for off) */ 23 enum KDMKTONE = 0x4B30; /* generate tone */ 24 25 enum KDGETLED = 0x4B31; /* return current led state */ 26 enum KDSETLED = 0x4B32; /* set led state [lights, not flags] */ 27 enum LED_SCR = 0x01; /* scroll lock led */ 28 enum LED_NUM = 0x02; /* num lock led */ 29 enum LED_CAP = 0x04; /* caps lock led */ 30 31 enum KDGKBTYPE = 0x4B33; /* get keyboard type */ 32 enum KB_84 = 0x01; 33 enum KB_101 = 0x02; /* this is what we always answer */ 34 enum KB_OTHER = 0x03; 35 36 enum KDADDIO = 0x4B34; /* add i/o port as valid */ 37 enum KDDELIO = 0x4B35; /* del i/o port as valid */ 38 enum KDENABIO = 0x4B36; /* enable i/o to video board */ 39 enum KDDISABIO = 0x4B37; /* disable i/o to video board */ 40 41 enum KDSETMODE = 0x4B3A; /* set text/graphics mode */ 42 enum KD_TEXT = 0x00; 43 enum KD_GRAPHICS = 0x01; 44 enum KD_TEXT0 = 0x02; /* obsolete */ 45 enum KD_TEXT1 = 0x03; /* obsolete */ 46 enum KDGETMODE = 0x4B3B; /* get current mode */ 47 48 enum KDMAPDISP = 0x4B3C; /* map display into address space */ 49 enum KDUNMAPDISP = 0x4B3D; /* unmap display from address space */ 50 51 alias scrnmap_t = char; 52 enum E_TABSZ = 256; 53 enum GIO_SCRNMAP = 0x4B40; /* get screen mapping from kernel */ 54 enum PIO_SCRNMAP = 0x4B41; /* put screen mapping table in kernel */ 55 enum GIO_UNISCRNMAP = 0x4B69; /* get full Unicode screen mapping */ 56 enum PIO_UNISCRNMAP = 0x4B6A; /* set full Unicode screen mapping */ 57 58 enum GIO_UNIMAP = 0x4B66; /* get unicode-to-font mapping from kernel */ 59 struct unipair { 60 ushort unicode; 61 ushort fontpos; 62 }; 63 struct unimapdesc { 64 ushort entry_ct; 65 unipair* entries; 66 }; 67 enum PIO_UNIMAP = 0x4B67; /* put unicode-to-font mapping in kernel */ 68 enum PIO_UNIMAPCLR = 0x4B68; /* clear table, possibly advise hash algorithm */ 69 struct unimapinit { 70 ushort advised_hashsize; /* 0 if no opinion */ 71 ushort advised_hashstep; /* 0 if no opinion */ 72 ushort advised_hashlevel; /* 0 if no opinion */ 73 }; 74 75 enum UNI_DIRECT_BASE = 0xF000; /* start of Direct Font Region */ 76 enum UNI_DIRECT_MASK = 0x01FF; /* Direct Font Region bitmask */ 77 78 enum K_RAW = 0x00; 79 enum K_XLATE = 0x01; 80 enum K_MEDIUMRAW = 0x02; 81 enum K_UNICODE = 0x03; 82 enum K_OFF = 0x04; 83 enum KDGKBMODE = 0x4B44; /* gets current keyboard mode */ 84 enum KDSKBMODE = 0x4B45; /* sets current keyboard mode */ 85 86 enum K_METABIT = 0x03; 87 enum K_ESCPREFIX = 0x04; 88 enum KDGKBMETA = 0x4B62; /* gets meta key handling mode */ 89 enum KDSKBMETA = 0x4B63; /* sets meta key handling mode */ 90 91 enum K_SCROLLLOCK = 0x01; 92 enum K_NUMLOCK = 0x02; 93 enum K_CAPSLOCK = 0x04; 94 enum KDGKBLED = 0x4B64; /* get led flags (not lights) */ 95 enum KDSKBLED = 0x4B65; /* set led flags (not lights) */ 96 97 struct kbentry { 98 char kb_table; 99 char kb_index; 100 ushort kb_value; 101 } 102 enum K_NORMTAB = 0x00; 103 enum K_SHIFTTAB = 0x01; 104 enum K_ALTTAB = 0x02; 105 enum K_ALTSHIFTTAB = 0x03; 106 107 enum KDGKBENT = 0x4B46; /* gets one entry in translation table */ 108 enum KDSKBENT = 0x4B47; /* sets one entry in translation table */ 109 110 struct kbsentry { 111 char kb_func; 112 char[512] kb_string; 113 } 114 enum KDGKBSENT = 0x4B48; /* gets one function key string entry */ 115 enum KDSKBSENT = 0x4B49; /* sets one function key string entry */ 116 117 struct kbdiacr { 118 char diacr, base, result; 119 } 120 121 struct kbdiacrs { 122 uint kb_cnt; /* number of entries in following array */ 123 kbdiacr[256] kbdiacr_; /* MAX_DIACR from keyboard.h */ 124 } 125 126 enum KDGKBDIACR = 0x4B4A; /* read kernel accent table */ 127 enum KDSKBDIACR = 0x4B4B; /* write kernel accent table */ 128 129 struct kbdiacruc { 130 uint diacr, base, result; 131 } 132 133 struct kbdiacrsuc { 134 uint kb_cnt; /* number of entries in following array */ 135 kbdiacruc[256] kbdiacruc_; /* MAX_DIACR from keyboard.h */ 136 } 137 138 enum KDGKBDIACRUC = 0x4BFA; /* read kernel accent table - UCS */ 139 enum KDSKBDIACRUC = 0x4BFB; /* write kernel accent table - UCS */ 140 141 struct kbkeycode { 142 uint scancode, keycode; 143 } 144 145 enum KDGETKEYCODE = 0x4B4C; /* read kernel keycode table entry */ 146 enum KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */ 147 148 enum KDSIGACCEPT = 0x4B4E; /* accept kbd generated signals */ 149 150 struct kbd_repeat { 151 int delay; /* in msec; <= 0: don't change */ 152 int period; /* in msec; <= 0: don't change */ 153 /* earlier this field was misnamed "rate" */ 154 } 155 156 enum KDKBDREP = 0x4B52; /* set keyboard delay/repeat rate; 157 * actually used values are returned */ 158 159 enum KDFONTOP = 0x4B72; /* font operations */ 160 161 struct console_font_op { 162 uint op; /* operation code KD_FONT_OP_* */ 163 uint flags; /* KD_FONT_FLAG_* */ 164 uint width, height; /* font size */ 165 uint charcount; 166 char* data; /* font data with height fixed to 32 */ 167 } 168 169 struct console_font { 170 uint width, height; /* font size */ 171 uint charcount; 172 char* data; /* font data with height fixed to 32 */ 173 } 174 175 enum KD_FONT_OP_SET = 0; /* Set font */ 176 enum KD_FONT_OP_GET = 1; /* Get font */ 177 enum KD_FONT_OP_SET_DEFAULT = 2; /* Set font to default, data points to name / NULL */ 178 enum KD_FONT_OP_COPY = 3; /* Obsolete, do not use */ 179 180 enum KD_FONT_FLAG_DONT_RECALC = 1; /* Don't recalculate hw charcell size [compat] */ 181 182 /* note: 0x4B00-0x4B4E all have had a value at some time; 183 don't reuse for the time being */ 184 /* note: 0x4B60-0x4B6D, 0x4B70-0x4B72 used above */