Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/console-tools/loadkmap.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/console-tools/loadkmap.c
r3232 r3621 11 11 //usage: "< keymap" 12 12 //usage:#define loadkmap_full_usage "\n\n" 13 //usage: "Load a binary keyboard translation table from stdin\n" 14 /* //usage: "\n -C TTY Affect TTY instead of /dev/tty" */ 13 //usage: "Load a binary keyboard translation table from stdin" 14 ////usage: "\n" 15 ////usage: "\n -C TTY Affect TTY instead of /dev/tty" 15 16 //usage: 16 17 //usage:#define loadkmap_example_usage … … 49 50 bb_show_usage(); 50 51 /* bb_warn_ignoring_args(argv[1]); */ 52 51 53 fd = get_console_fd_or_die(); 52 54 /* or maybe: … … 56 58 57 59 xread(STDIN_FILENO, flags, 7); 58 if ( strncmp(flags, BINARY_KEYMAP_MAGIC, 7))60 if (!is_prefixed_with(flags, BINARY_KEYMAP_MAGIC)) 59 61 bb_error_msg_and_die("not a valid binary keymap"); 60 62 … … 62 64 63 65 for (i = 0; i < MAX_NR_KEYMAPS; i++) { 64 if (flags[i] == 1) { 65 xread(STDIN_FILENO, ibuff, NR_KEYS * sizeof(uint16_t)); 66 for (j = 0; j < NR_KEYS; j++) { 67 ke.kb_index = j; 68 ke.kb_table = i; 69 ke.kb_value = ibuff[j]; 70 ioctl(fd, KDSKBENT, &ke); 71 } 66 if (flags[i] != 1) 67 continue; 68 xread(STDIN_FILENO, ibuff, NR_KEYS * sizeof(uint16_t)); 69 for (j = 0; j < NR_KEYS; j++) { 70 ke.kb_index = j; 71 ke.kb_table = i; 72 ke.kb_value = ibuff[j]; 73 /* 74 * Note: table[idx:0] can contain special value 75 * K_ALLOCATED (marks allocated tables in kernel). 76 * dumpkmap saves the value as-is; but attempts 77 * to load it here fail, since it isn't a valid 78 * key value: it is K(KT_SPEC,126) == 2<<8 + 126, 79 * whereas last valid KT_SPEC is 80 * K_BARENUMLOCK == K(KT_SPEC,19). 81 * So far we just ignore these errors: 82 */ 83 ioctl(fd, KDSKBENT, &ke); 72 84 } 73 85 }
Note:
See TracChangeset
for help on using the changeset viewer.