From: Philip Homburg Date: Wed, 19 Jul 2006 11:50:18 +0000 (+0000) Subject: Switch to vc 0 and softscrolling when /dev/video is opened and switch back X-Git-Tag: v3.1.3~242 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/nslookup.html?a=commitdiff_plain;h=f6d1f6fdf66434ecfa3f7fd33504655cb224e030;p=minix.git Switch to vc 0 and softscrolling when /dev/video is opened and switch back at the close. This should prevent problems with X on (emulated) Cirrus cards. --- diff --git a/drivers/tty/console.c b/drivers/tty/console.c index 37ad0d436..c6873e018 100644 --- a/drivers/tty/console.c +++ b/drivers/tty/console.c @@ -83,6 +83,13 @@ PRIVATE unsigned scr_width; /* # characters on a line */ PRIVATE unsigned scr_lines; /* # lines on the screen */ PRIVATE unsigned scr_size; /* # characters on the screen */ +PRIVATE int disabled_vc = -1; /* Virtual console that was active when + * disable_console was called. + */ +PRIVATE int disabled_sm; /* Scroll mode to be restored when re-enabling + * console + */ + /* Per console data. */ typedef struct console { tty_t *c_tty; /* associated TTY struct */ @@ -133,9 +140,11 @@ FORWARD _PROTOTYPE( void set_6845, (int reg, unsigned val) ); FORWARD _PROTOTYPE( void get_6845, (int reg, unsigned *val) ); FORWARD _PROTOTYPE( void stop_beep, (timer_t *tmrp) ); FORWARD _PROTOTYPE( void cons_org0, (void) ); +FORWARD _PROTOTYPE( void disable_console, (void) ); +FORWARD _PROTOTYPE( void reenable_console, (void) ); FORWARD _PROTOTYPE( int ga_program, (struct sequence *seq) ); FORWARD _PROTOTYPE( int cons_ioctl, (tty_t *tp, int) ); -PRIVATE _PROTOTYPE( void ser_putc, (char c) ); +FORWARD _PROTOTYPE( void ser_putc, (char c) ); /*===========================================================================* * cons_write * @@ -792,9 +801,11 @@ PUBLIC void do_video(message *m) switch (m->m_type) { case DEV_OPEN: /* Should grant IOPL */ + disable_console(); r= OK; break; case DEV_CLOSE: + reenable_console(); r= OK; break; case DEV_IOCTL_S: @@ -1214,6 +1225,37 @@ PRIVATE void cons_org0() select_console(ccurrent); } +/*===========================================================================* + * disable_console * + *===========================================================================*/ +PRIVATE void disable_console() +{ + if (disabled_vc != -1) + return; + + disabled_vc = ccurrent; + disabled_sm = softscroll; + + cons_org0(); + softscroll = 1; + select_console(0); + + /* Should also disable further output to virtual consoles */ +} + +/*===========================================================================* + * reenable_console * + *===========================================================================*/ +PRIVATE void reenable_console() +{ + if (disabled_vc == -1) + return; + + softscroll = disabled_sm; + select_console(disabled_vc); + disabled_vc = -1; +} + /*===========================================================================* * select_console * *===========================================================================*/