Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/console-tools
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- Location:
- branches/3.2/mindi-busybox/console-tools
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/console-tools/Config.src
r2725 r3232 11 11 bool "chvt" 12 12 default y 13 depends onPLATFORM_LINUX13 select PLATFORM_LINUX 14 14 help 15 15 This program is used to change to another terminal. … … 19 19 bool "fgconsole" 20 20 default y 21 depends onPLATFORM_LINUX21 select PLATFORM_LINUX 22 22 help 23 23 This program prints active (foreground) console number. … … 32 32 bool "deallocvt" 33 33 default y 34 depends onPLATFORM_LINUX34 select PLATFORM_LINUX 35 35 help 36 36 This program deallocates unused virtual consoles. … … 39 39 bool "dumpkmap" 40 40 default y 41 depends onPLATFORM_LINUX41 select PLATFORM_LINUX 42 42 help 43 43 This program dumps the kernel's keyboard translation table to … … 47 47 bool "kbd_mode" 48 48 default y 49 depends onPLATFORM_LINUX49 select PLATFORM_LINUX 50 50 help 51 51 This program reports and sets keyboard mode. … … 54 54 bool "loadfont" 55 55 default y 56 depends onPLATFORM_LINUX56 select PLATFORM_LINUX 57 57 help 58 58 This program loads a console font from standard input. … … 61 61 bool "loadkmap" 62 62 default y 63 depends onPLATFORM_LINUX63 select PLATFORM_LINUX 64 64 help 65 65 This program loads a keyboard translation table from … … 69 69 bool "openvt" 70 70 default y 71 depends onPLATFORM_LINUX71 select PLATFORM_LINUX 72 72 help 73 73 This program is used to start a command on an unused … … 101 101 bool "setconsole" 102 102 default y 103 depends onPLATFORM_LINUX103 select PLATFORM_LINUX 104 104 help 105 105 This program redirects the system console to another device, … … 116 116 bool "setfont" 117 117 default y 118 depends onPLATFORM_LINUX118 select PLATFORM_LINUX 119 119 help 120 120 Allows to load console screen map. Useful for i18n. … … 138 138 bool "setkeycodes" 139 139 default y 140 depends onPLATFORM_LINUX140 select PLATFORM_LINUX 141 141 help 142 142 This program loads entries into the kernel's scancode-to-keycode … … 146 146 bool "setlogcons" 147 147 default y 148 depends onPLATFORM_LINUX148 select PLATFORM_LINUX 149 149 help 150 150 This program redirects the output console of kernel messages. … … 153 153 bool "showkey" 154 154 default y 155 depends onPLATFORM_LINUX155 select PLATFORM_LINUX 156 156 help 157 157 Shows keys pressed. -
branches/3.2/mindi-busybox/console-tools/chvt.c
r2725 r3232 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define chvt_trivial_usage 11 //usage: "N" 12 //usage:#define chvt_full_usage "\n\n" 13 //usage: "Change the foreground virtual terminal to /dev/ttyN" 14 9 15 #include "libbb.h" 10 16 -
branches/3.2/mindi-busybox/console-tools/clear.c
r2725 r3232 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define clear_trivial_usage 11 //usage: "" 12 //usage:#define clear_full_usage "\n\n" 13 //usage: "Clear screen" 14 9 15 #include "libbb.h" 10 16 -
branches/3.2/mindi-busybox/console-tools/deallocvt.c
r2725 r3232 10 10 11 11 /* no options, no getopt */ 12 13 //usage:#define deallocvt_trivial_usage 14 //usage: "[N]" 15 //usage:#define deallocvt_full_usage "\n\n" 16 //usage: "Deallocate unused virtual terminal /dev/ttyN" 12 17 13 18 #include "libbb.h" -
branches/3.2/mindi-busybox/console-tools/dumpkmap.c
r2725 r3232 9 9 */ 10 10 /* no options, no getopt */ 11 12 //usage:#define dumpkmap_trivial_usage 13 //usage: "> keymap" 14 //usage:#define dumpkmap_full_usage "\n\n" 15 //usage: "Print a binary keyboard translation table to stdout" 16 //usage: 17 //usage:#define dumpkmap_example_usage 18 //usage: "$ dumpkmap > keymap\n" 11 19 12 20 #include "libbb.h" -
branches/3.2/mindi-busybox/console-tools/fgconsole.c
r2725 r3232 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define fgconsole_trivial_usage 11 //usage: "" 12 //usage:#define fgconsole_full_usage "\n\n" 13 //usage: "Get active console" 9 14 10 15 #include "libbb.h" -
branches/3.2/mindi-busybox/console-tools/kbd_mode.c
r2725 r3232 9 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 10 */ 11 12 //usage:#define kbd_mode_trivial_usage 13 //usage: "[-a|k|s|u] [-C TTY]" 14 //usage:#define kbd_mode_full_usage "\n\n" 15 //usage: "Report or set the keyboard mode\n" 16 //usage: "\n -a Default (ASCII)" 17 //usage: "\n -k Medium-raw (keyboard)" 18 //usage: "\n -s Raw (scancode)" 19 //usage: "\n -u Unicode (utf-8)" 20 //usage: "\n -C TTY Affect TTY instead of /dev/tty" 21 11 22 #include "libbb.h" 12 23 #include <linux/kd.h> -
branches/3.2/mindi-busybox/console-tools/loadfont.c
r2725 r3232 10 10 * Licensed under GPLv2, see file LICENSE in this source tree. 11 11 */ 12 13 //usage:#define loadfont_trivial_usage 14 //usage: "< font" 15 //usage:#define loadfont_full_usage "\n\n" 16 //usage: "Load a console font from stdin" 17 /* //usage: "\n -C TTY Affect TTY instead of /dev/tty" */ 18 //usage: 19 //usage:#define loadfont_example_usage 20 //usage: "$ loadfont < /etc/i18n/fontname\n" 21 //usage: 22 //usage:#define setfont_trivial_usage 23 //usage: "FONT [-m MAPFILE] [-C TTY]" 24 //usage:#define setfont_full_usage "\n\n" 25 //usage: "Load a console font\n" 26 //usage: "\n -m MAPFILE Load console screen map" 27 //usage: "\n -C TTY Affect TTY instead of /dev/tty" 28 //usage: 29 //usage:#define setfont_example_usage 30 //usage: "$ setfont -m koi8-r /etc/i18n/fontname\n" 31 12 32 #include "libbb.h" 13 33 #include <sys/kd.h> … … 210 230 211 231 /* Note: after PIO_UNIMAPCLR and before PIO_UNIMAP 212 232 * this printf did not work on many kernels */ 213 233 214 234 advice.advised_hashsize = 0; -
branches/3.2/mindi-busybox/console-tools/loadkmap.c
r2725 r3232 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define loadkmap_trivial_usage 11 //usage: "< keymap" 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" */ 15 //usage: 16 //usage:#define loadkmap_example_usage 17 //usage: "$ loadkmap < /etc/i18n/lang-keymap\n" 18 9 19 #include "libbb.h" 10 20 -
branches/3.2/mindi-busybox/console-tools/openvt.c
r2725 r3232 8 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 9 */ 10 11 //usage:#define openvt_trivial_usage 12 //usage: "[-c N] [-sw] [PROG ARGS]" 13 //usage:#define openvt_full_usage "\n\n" 14 //usage: "Start PROG on a new virtual terminal\n" 15 //usage: "\n -c N Use specified VT" 16 //usage: "\n -s Switch to the VT" 17 /* //usage: "\n -l Run PROG as login shell (by prepending '-')" */ 18 //usage: "\n -w Wait for PROG to exit" 19 //usage: 20 //usage:#define openvt_example_usage 21 //usage: "openvt 2 /bin/ash\n" 10 22 11 23 #include <linux/vt.h> … … 145 157 if (!argv[0]) { 146 158 argv--; 147 argv[0] = getenv("SHELL"); 148 if (!argv[0]) 149 argv[0] = (char *) DEFAULT_SHELL; 159 argv[0] = (char *) get_shell_name(); 150 160 /*argv[1] = NULL; - already is */ 151 161 } -
branches/3.2/mindi-busybox/console-tools/reset.c
r2725 r3232 11 11 /* BTW, which "standard" package has this utility? It doesn't seem 12 12 * to be ncurses, coreutils, console-tools... then what? */ 13 14 //usage:#define reset_trivial_usage 15 //usage: "" 16 //usage:#define reset_full_usage "\n\n" 17 //usage: "Reset the screen" 13 18 14 19 #include "libbb.h" … … 32 37 /* See 'man 4 console_codes' for details: 33 38 * "ESC c" -- Reset 34 * "ESC ( K" -- Select user mapping39 * "ESC ( B" -- Select G0 Character Set (B = US) 35 40 * "ESC [ 0 m" -- Reset all display attributes 36 41 * "ESC [ J" -- Erase to the end of screen 37 42 * "ESC [ ? 25 h" -- Make cursor visible 38 43 */ 39 printf(ESC"c" ESC"( K" ESC"[0m" ESC"[J" ESC"[?25h");44 printf(ESC"c" ESC"(B" ESC"[0m" ESC"[J" ESC"[?25h"); 40 45 /* http://bugs.busybox.net/view.php?id=1414: 41 46 * people want it to reset echo etc: */ -
branches/3.2/mindi-busybox/console-tools/resize.c
r2725 r3232 8 8 */ 9 9 /* no options, no getopt */ 10 11 //usage:#define resize_trivial_usage 12 //usage: "" 13 //usage:#define resize_full_usage "\n\n" 14 //usage: "Resize the screen" 15 10 16 #include "libbb.h" 11 17 … … 54 60 fprintf(stderr, ESC"7" ESC"[r" ESC"[999;999H" ESC"[6n"); 55 61 alarm(3); /* Just in case terminal won't answer */ 62 //BUG: death by signal won't restore termios 56 63 scanf(ESC"[%hu;%huR", &w.ws_row, &w.ws_col); 57 64 fprintf(stderr, ESC"8"); -
branches/3.2/mindi-busybox/console-tools/setconsole.c
r2725 r3232 8 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 9 */ 10 11 //usage:#define setconsole_trivial_usage 12 //usage: "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]" 13 //usage:#define setconsole_full_usage "\n\n" 14 //usage: "Redirect system console output to DEVICE (default: /dev/tty)\n" 15 //usage: "\n -r Reset output to /dev/console" 10 16 11 17 #include "libbb.h" … … 35 41 } 36 42 37 xioctl(xopen(device, O_ RDONLY), TIOCCONS, NULL);43 xioctl(xopen(device, O_WRONLY), TIOCCONS, NULL); 38 44 return EXIT_SUCCESS; 39 45 } -
branches/3.2/mindi-busybox/console-tools/setkeycodes.c
r2725 r3232 9 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 10 */ 11 12 //usage:#define setkeycodes_trivial_usage 13 //usage: "SCANCODE KEYCODE..." 14 //usage:#define setkeycodes_full_usage "\n\n" 15 //usage: "Set entries into the kernel's scancode-to-keycode map,\n" 16 //usage: "allowing unusual keyboards to generate usable keycodes.\n\n" 17 //usage: "SCANCODE may be either xx or e0xx (hexadecimal),\n" 18 //usage: "and KEYCODE is given in decimal." 19 //usage: 20 //usage:#define setkeycodes_example_usage 21 //usage: "$ setkeycodes e030 127\n" 22 11 23 #include "libbb.h" 12 24 -
branches/3.2/mindi-busybox/console-tools/setlogcons.c
r2725 r3232 10 10 */ 11 11 12 //usage:#define setlogcons_trivial_usage 13 //usage: "N" 14 //usage:#define setlogcons_full_usage "\n\n" 15 //usage: "Redirect the kernel output to console N (0 for current)" 16 12 17 #include "libbb.h" 13 18 … … 18 23 char fn; 19 24 char subarg; 20 } arg = { 11, /* redirect kernel messages */ 21 0 /* to specified console (current as default) */ 22 }; 25 } arg = { 26 11, /* redirect kernel messages */ 27 0 /* to specified console (current as default) */ 28 }; 23 29 24 30 if (argv[1]) -
branches/3.2/mindi-busybox/console-tools/showkey.c
r2725 r3232 7 7 * Licensed under GPLv2, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define showkey_trivial_usage 11 //usage: "[-a | -k | -s]" 12 //usage:#define showkey_full_usage "\n\n" 13 //usage: "Show keys pressed\n" 14 //usage: "\n -a Display decimal/octal/hex values of the keys" 15 //usage: "\n -k Display interpreted keycodes (default)" 16 //usage: "\n -s Display raw scan-codes" 9 17 10 18 #include "libbb.h" … … 57 65 getopt32(argv, "aks"); 58 66 59 // get keyboard settings60 xioctl(STDIN_FILENO, KDGKBMODE, &kbmode);61 printf("kb mode was %s\n\nPress any keys. Program terminates %s\n\n",62 kbmode == K_RAW ? "RAW" :63 (kbmode == K_XLATE ? "XLATE" :64 (kbmode == K_MEDIUMRAW ? "MEDIUMRAW" :65 (kbmode == K_UNICODE ? "UNICODE" : "UNKNOWN")))66 , (option_mask32 & OPT_a) ? "on EOF (ctrl-D)" : "10s after last keypress"67 );68 69 67 // prepare for raw mode 70 68 xget1(&tio, &tio0); … … 72 70 xset1(&tio); 73 71 72 #define press_keys "Press any keys, program terminates %s:\r\n\n" 73 74 74 if (option_mask32 & OPT_a) { 75 // just read stdin char by char 75 76 unsigned char c; 76 77 77 // just read stdin char by char 78 printf(press_keys, "on EOF (ctrl-D)"); 79 80 // read and show byte values 78 81 while (1 == read(STDIN_FILENO, &c, 1)) { 79 82 printf("%3u 0%03o 0x%02x\r\n", c, c, c); … … 81 84 break; 82 85 } 86 83 87 } else { 88 // we assume a PC keyboard 89 xioctl(STDIN_FILENO, KDGKBMODE, &kbmode); 90 printf("Keyboard mode was %s.\r\n\n", 91 kbmode == K_RAW ? "RAW" : 92 (kbmode == K_XLATE ? "XLATE" : 93 (kbmode == K_MEDIUMRAW ? "MEDIUMRAW" : 94 (kbmode == K_UNICODE ? "UNICODE" : "UNKNOWN"))) 95 ); 96 84 97 // set raw keyboard mode 85 98 xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)((option_mask32 & OPT_k) ? K_MEDIUMRAW : K_RAW)); … … 87 100 // we should exit on any signal; signals should interrupt read 88 101 bb_signals_recursive_norestart(BB_FATAL_SIGS, record_signo); 102 103 // inform user that program ends after time of inactivity 104 printf(press_keys, "10s after last keypress"); 89 105 90 106 // read and show scancodes … … 95 111 // setup 10s watchdog 96 112 alarm(10); 113 97 114 // read scancodes 98 115 n = read(STDIN_FILENO, buf, sizeof(buf)); … … 122 139 puts("\r"); 123 140 } 141 142 // restore keyboard mode 143 xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)kbmode); 124 144 } 125 145 126 // restore keyboard andconsole settings146 // restore console settings 127 147 xset1(&tio0); 128 xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)kbmode);129 148 130 149 return EXIT_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.