static void change_private_mode(int mode, int set) { switch (mode) { case 1: /* DECCKM */ console->cursor_key_mode = set; break; case 3: if (set) /* 132 column mode */ console_set_size(132, 24); else /* 80 column mode */ console_set_size(80, 24); /* Clear window content and reset scrolling regions */ erase_screen(2); set_pos(0, 0); break; case 6: console->origin_mode = set; break; case 7: console->wraparound_mode = set; break; default: log_error("change_private_mode(): private mode %d not supported.\n", mode); } }
/** * Configure console * * @v config Console configuration * @ret rc Return status code * * The configuration is passed to all configurable consoles, including * those which are currently disabled. Consoles may choose to enable * or disable themselves depending upon the configuration. * * If configuration fails, then all consoles will be reset. */ int console_configure ( struct console_configuration *config ) { struct console_driver *console; int rc; /* Reset console width and height */ console_set_size ( CONSOLE_DEFAULT_WIDTH, CONSOLE_DEFAULT_HEIGHT ); /* Try to configure each console */ for_each_table_entry ( console, CONSOLES ) { if ( ( console->configure ) && ( ( rc = console->configure ( config ) ) != 0 ) ) goto err; } return 0; err: /* Reset all consoles, avoiding a potential infinite loop */ if ( config ) console_reset(); return rc; }
static int console_ioctl(struct file *f, unsigned int cmd, unsigned long arg) { console_lock(); int r; /* TODO: What is the different between S/SW/SF variants? */ switch (cmd) { case TCGETS: { struct termios *t = (struct termios *)arg; memcpy(t, &console->termios, sizeof(struct termios)); r = 0; break; } case TCSETS: case TCSETSW: case TCSETSF: { struct termios *t = (struct termios *)arg; memcpy(&console->termios, t, sizeof(struct termios)); console_update_termios(); r = 0; break; } case TIOCGPGRP: { log_warning("Unsupported TIOCGPGRP: Return fake result.\n"); *(pid_t *)arg = GetCurrentProcessId(); r = 0; break; } case TIOCSPGRP: { log_warning("Unsupported TIOCSPGRP: Do nothing.\n"); r = 0; break; } case TIOCGWINSZ: { struct winsize *win = (struct winsize *)arg; CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(console->out, &info); win->ws_col = info.srWindow.Right - info.srWindow.Left + 1; win->ws_row = info.srWindow.Bottom - info.srWindow.Top + 1; win->ws_xpixel = 0; win->ws_ypixel = 0; r = 0; break; } case TIOCSWINSZ: { const struct winsize *win = (const struct winsize *)arg; console_set_size(win->ws_col, win->ws_row); r = 0; break; } default: log_error("console: unknown ioctl command: %x\n", cmd); r = -EINVAL; break; } console_unlock(); return r; }
static void change_private_mode(int mode, int set) { switch (mode) { case 1: /* DECCKM */ console->cursor_key_mode = set; break; case 3: if (set) /* 132 column mode */ console_set_size(132, 24); else /* 80 column mode */ console_set_size(80, 24); /* Clear window content and reset scrolling regions */ erase_screen(2); set_pos(0, 0); break; case 6: console->origin_mode = set; break; case 7: console->wraparound_mode = set; break; case 47: if (set) switch_to_alternate_buffer(); else switch_to_normal_buffer(); break; case 1047: if (set) { if (console->out == console->normal_buffer) { switch_to_alternate_buffer(); erase_screen(ERASE_SCREEN_BEGIN_TO_END); } } else { if (console->out == console->alternate_buffer) { switch_to_normal_buffer(); erase_screen(ERASE_SCREEN_BEGIN_TO_END); } } break; case 1048: if (set) save_cursor(); else restore_cursor(); break; case 1049: if (set) { save_cursor(); if (console->out == console->normal_buffer) { switch_to_alternate_buffer(); erase_screen(ERASE_SCREEN_BEGIN_TO_END); } } else { if (console->out == console->alternate_buffer) { switch_to_normal_buffer(); erase_screen(ERASE_SCREEN_BEGIN_TO_END); } restore_cursor(); } break; default: log_error("change_private_mode(): private mode %d not supported.\n", mode); } }