Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons Add hw.wsdisplay.multicons sysctl that can be...
details: https://anonhg.NetBSD.org/src/rev/3bd5988fdf7f
branches: trunk
changeset: 994958:3bd5988fdf7f
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Nov 29 23:18:40 2018 +0000
description:
Add hw.wsdisplay.multicons sysctl that can be used to disable mirroring wsdisplay output to serial port.
diffstat:
sys/dev/wscons/wsdisplay.c | 45 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 37 insertions(+), 8 deletions(-)
diffs (119 lines):
diff -r c97d262c1100 -r 3bd5988fdf7f sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c Thu Nov 29 20:58:36 2018 +0000
+++ b/sys/dev/wscons/wsdisplay.c Thu Nov 29 23:18:40 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.148 2018/11/15 13:50:51 jmcneill Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.149 2018/11/29 23:18:40 jmcneill Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.148 2018/11/15 13:50:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.149 2018/11/29 23:18:40 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_wsdisplay_compat.h"
@@ -58,6 +58,7 @@
#include <sys/fcntl.h>
#include <sys/vnode.h>
#include <sys/kauth.h>
+#include <sys/sysctl.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wseventvar.h>
@@ -71,6 +72,10 @@
#include "locators.h"
+#ifdef WSDISPLAY_MULTICONS
+static bool wsdisplay_multicons_enable = true;
+#endif
+
/* Console device before replaced by wsdisplay */
static struct consdev *wsdisplay_ocn;
@@ -277,7 +282,8 @@
struct wsscreen *scr = priv;
int c;
- if (wsdisplay_ocn && wsdisplay_ocn->cn_getc &&
+ if (wsdisplay_multicons_enable &&
+ wsdisplay_ocn && wsdisplay_ocn->cn_getc &&
WSSCREEN_HAS_EMULATOR(scr) && WSSCREEN_HAS_TTY(scr)) {
struct tty *tp = scr->scr_tty;
do {
@@ -1670,7 +1676,8 @@
(*scr->scr_dconf->wsemul->output)(scr->scr_dconf->wsemulcookie,
tbuf, n, 0);
#ifdef WSDISPLAY_MULTICONS
- if (scr->scr_dconf == &wsdisplay_console_conf &&
+ if (wsdisplay_multicons_enable &&
+ scr->scr_dconf == &wsdisplay_console_conf &&
wsdisplay_ocn && wsdisplay_ocn->cn_putc) {
for (int i = 0; i < n; i++)
wsdisplay_ocn->cn_putc(
@@ -1689,7 +1696,8 @@
(scr->scr_dconf->wsemulcookie, tbuf, n, 0);
#ifdef WSDISPLAY_MULTICONS
- if (scr->scr_dconf == &wsdisplay_console_conf &&
+ if (wsdisplay_multicons_enable &&
+ scr->scr_dconf == &wsdisplay_console_conf &&
wsdisplay_ocn && wsdisplay_ocn->cn_putc) {
for (int i = 0; i < n; i++)
wsdisplay_ocn->cn_putc(
@@ -2293,7 +2301,7 @@
(*dc->wsemul->output)(dc->wsemulcookie, &c, 1, 1);
#ifdef WSDISPLAY_MULTICONS
- if (wsdisplay_ocn && wsdisplay_ocn->cn_putc)
+ if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_putc)
wsdisplay_ocn->cn_putc(wsdisplay_ocn->cn_dev, i);
#endif
}
@@ -2310,7 +2318,7 @@
}
#ifdef WSDISPLAY_MULTICONS
- if (wsdisplay_ocn && wsdisplay_ocn->cn_getc) {
+ if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_getc) {
c = wsdisplay_ocn->cn_getc(wsdisplay_ocn->cn_dev);
if (c >= 0)
return c;
@@ -2337,7 +2345,7 @@
#ifdef WSDISPLAY_MULTICONS
/* notify to old console driver */
- if (wsdisplay_ocn && wsdisplay_ocn->cn_pollc)
+ if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_pollc)
wsdisplay_ocn->cn_pollc(wsdisplay_ocn->cn_dev, on);
#endif
}
@@ -2358,3 +2366,24 @@
wsdisplay_cons_kbd_getc = NULL;
wsdisplay_cons_kbd_pollc = NULL;
}
+
+#ifdef WSDISPLAY_MULTICONS
+SYSCTL_SETUP(sysctl_hw_wsdisplay_setup, "sysctl hw.wsdisplay subtree setup")
+{
+ const struct sysctlnode *wsdisplay_node;
+
+ if (sysctl_createv(clog, 0, NULL, &wsdisplay_node,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "wsdisplay", NULL,
+ NULL, 0, NULL, 0,
+ CTL_HW, CTL_CREATE, CTL_EOL) != 0)
+ return;
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_READWRITE,
+ CTLTYPE_BOOL, "multicons",
+ SYSCTL_DESCR("Enable wsdisplay multicons"),
+ NULL, 0, &wsdisplay_multicons_enable, 0,
+ CTL_HW, wsdisplay_node->sysctl_num, CTL_CREATE, CTL_EOL);
+}
+#endif
Home |
Main Index |
Thread Index |
Old Index