svn commit: r228644 - head/sys/dev/syscons

Andriy Gapon avg at FreeBSD.org
Sat Dec 17 16:17:03 UTC 2011


on 17/12/2011 17:57 Andriy Gapon said the following:
> Author: avg
> Date: Sat Dec 17 15:57:39 2011
> New Revision: 228644
> URL: http://svn.freebsd.org/changeset/base/228644
> 
> Log:
>   syscons: provide a first iteration of cngrab/cnungrab implementation
>   
>   - put underlying keyboard(s) into the polling mode for the whole
>     duration of the grab, instead of the previous behavior of going into
>     and out of the polling mode around each polling attempt
>   - ditto for setting K_XLATE mode and enabling a disabled keyboard
>   
>   Inspired by:	bde
>   MFC after:	2 months
> 
> Modified:
>   head/sys/dev/syscons/syscons.c
>   head/sys/dev/syscons/syscons.h
> 
> Modified: head/sys/dev/syscons/syscons.c
> ==============================================================================
> --- head/sys/dev/syscons/syscons.c	Sat Dec 17 15:50:45 2011	(r228643)
> +++ head/sys/dev/syscons/syscons.c	Sat Dec 17 15:57:39 2011	(r228644)
> @@ -1613,11 +1613,46 @@ sc_cnterm(struct consdev *cp)
>  static void
>  sc_cngrab(struct consdev *cp)
>  {
> +    scr_stat *scp;
> +
> +    scp = sc_console->sc->cur_scp;
> +    if (scp->sc->kbd == NULL)
> +	return;
> +
> +    if (scp->grabbed++ > 0)
> +	return;
> +
> +    /*
> +     * Make sure the keyboard is accessible even when the kbd device
> +     * driver is disabled.
> +     */
> +    kbdd_enable(scp->sc->kbd);
> +
> +    /* we shall always use the keyboard in the XLATE mode here */
> +    scp->kbd_prev_mode = scp->kbd_mode;
> +    scp->kbd_mode = K_XLATE;
> +    (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
> +
> +    kbdd_poll(scp->sc->kbd, TRUE);
>  }

What people think about adding something like the following best effort attempt
to switch to console VTY?

Index: sys/dev/syscons/syscons.c
===================================================================
--- sys/dev/syscons/syscons.c	(revision 228644)
+++ sys/dev/syscons/syscons.c	(working copy)
@@ -1615,7 +1615,14 @@
 {
     scr_stat *scp;

+    if (!cold &&
+	sc_console->sc->cur_scp->index != sc_console->index &&
+	sc_console->sc->cur_scp->smode.mode == VT_AUTO &&
+	sc_console->smode.mode == VT_AUTO)
+	    sc_switch_scr(sc_console->sc, sc_console->index);
+
     scp = sc_console->sc->cur_scp;
+
     if (scp->sc->kbd == NULL)
 	return;

The code is borrowed from scshutdown().

-- 
Andriy Gapon


More information about the svn-src-head mailing list