Changeset 90e3d6a in mainline
- Timestamp:
- 2009-02-20T21:01:17Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 12b6796
- Parents:
- c9b550b
- Location:
- uspace/srv/kbd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/kbd/ctl/pc.c
rc9b550b r90e3d6a 41 41 #include <kbd_ctl.h> 42 42 43 static int scanmap_simple[]; 44 45 void kbd_ctl_parse_scancode(int scancode) 46 { 47 kbd_ev_type_t type; 48 unsigned int key; 49 50 if (scancode < 0 || scancode >= 0x100) 51 return; 52 53 if (scancode & 0x80) { 54 scancode &= ~0x80; 55 type = KE_RELEASE; 56 } else { 57 type = KE_PRESS; 58 } 59 60 key = scanmap_simple[scancode]; 61 if (key != 0) 62 kbd_push_ev(type, key); 63 } 64 65 static int scanmap_simple[128] = { 43 enum dec_state { 44 ds_s, 45 ds_e 46 }; 47 48 static enum dec_state ds = ds_s; 49 50 static int scanmap_simple[] = { 66 51 67 52 [0x29] = KC_BACKTICK, … … 151 136 [0x58] = KC_F12, 152 137 153 [0x1c] = KC_ENTER 154 155 /* 156 [0x1] = KC_PRNSCR, 157 [0x1] = KC_SCROLL_LOCK, 158 [0x1] = KC_PAUSE, 159 */ 138 [0x1c] = KC_ENTER, 139 140 [0x45] = KC_NUM_LOCK, 141 [0x37] = KC_NTIMES, 142 [0x4a] = KC_NMINUS, 143 [0x4e] = KC_NPLUS, 144 [0x47] = KC_N7, 145 [0x48] = KC_N8, 146 [0x49] = KC_N9, 147 [0x4b] = KC_N4, 148 [0x4c] = KC_N5, 149 [0x4d] = KC_N6, 150 [0x4f] = KC_N1, 151 [0x50] = KC_N2, 152 [0x51] = KC_N3, 153 [0x52] = KC_N0, 154 [0x53] = KC_NPERIOD 160 155 }; 156 157 static int scanmap_e0[] = { 158 [0x38] = KC_RALT, 159 [0x1d] = KC_RSHIFT, 160 161 [0x37] = KC_PRTSCR, 162 [0x52] = KC_INSERT, 163 [0x49] = KC_PAGE_UP, 164 165 [0x53] = KC_DELETE, 166 [0x4f] = KC_END, 167 [0x51] = KC_PAGE_DOWN, 168 169 [0x48] = KC_UP, 170 [0x4b] = KC_LEFT, 171 [0x50] = KC_DOWN, 172 [0x4d] = KC_RIGHT, 173 174 [0x35] = KC_NSLASH, 175 [0x1c] = KC_NENTER 176 }; 177 178 179 void kbd_ctl_parse_scancode(int scancode) 180 { 181 kbd_ev_type_t type; 182 unsigned int key; 183 int *map; 184 size_t map_length; 185 186 if (scancode == 0xe0) { 187 ds = ds_e; 188 return; 189 } 190 191 switch (ds) { 192 case ds_s: 193 map = scanmap_simple; 194 map_length = sizeof(scanmap_simple) / sizeof(int); 195 break; 196 case ds_e: 197 map = scanmap_e0; 198 map_length = sizeof(scanmap_e0) / sizeof(int); 199 break; 200 } 201 202 ds = ds_s; 203 204 if (scancode & 0x80) { 205 scancode &= ~0x80; 206 type = KE_RELEASE; 207 } else { 208 type = KE_PRESS; 209 } 210 211 if (scancode < 0 || scancode >= map_length) 212 return; 213 214 key = map[scancode]; 215 if (key != 0) 216 kbd_push_ev(type, key); 217 } 161 218 162 219 /** -
uspace/srv/kbd/generic/kbd.c
rc9b550b r90e3d6a 47 47 #include <libadt/fifo.h> 48 48 #include <kbd/kbd.h> 49 #include <kbd/keycode.h> 49 50 50 51 #include <kbd.h> … … 61 62 62 63 /** Currently active modifiers. */ 63 static unsigned mods ;64 static unsigned mods = KM_NUM_LOCK; 64 65 65 66 void kbd_push_scancode(int scancode) … … 69 70 } 70 71 71 #include <kbd/keycode.h>72 72 void kbd_push_ev(int type, unsigned int key) 73 73 { -
uspace/srv/kbd/layout/us_qwerty.c
rc9b550b r90e3d6a 161 161 [KC_TAB] = '\t', 162 162 [KC_ENTER] = '\n', 163 [KC_SPACE] = ' ' 163 [KC_SPACE] = ' ', 164 165 [KC_NSLASH] = '/', 166 [KC_NTIMES] = '*', 167 [KC_NMINUS] = '-', 168 [KC_NPLUS] = '+', 169 [KC_NENTER] = '\n' 170 }; 171 172 static char map_numeric[] = { 173 [KC_N7] = '7', 174 [KC_N8] = '8', 175 [KC_N9] = '9', 176 [KC_N4] = '4', 177 [KC_N5] = '5', 178 [KC_N6] = '6', 179 [KC_N1] = '1', 180 [KC_N2] = '2', 181 [KC_N3] = '3', 182 183 [KC_N0] = '0', 184 [KC_NPERIOD] = '.' 164 185 }; 165 186 … … 193 214 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char)); 194 215 195 if (c != 0 ) return c; 196 216 if (c != 0) return c; 217 218 if ((ev->mods & KM_NUM_LOCK) != 0) 219 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char)); 220 else 221 c = 0; 222 223 return c; 197 224 } 198 225
Note:
See TracChangeset
for help on using the changeset viewer.