Switch the default terminal emulation style to xterm for most platforms.

Right now syscons(4) uses a cons25-style terminal emulator. The
disadvantages of that are:

- Little compatibility with embedded devices with serial interfaces.
- Bad bandwidth efficiency, mainly because of the lack of scrolling
  regions.
- A very hard transition path to support for modern character sets like
  UTF-8.

Our terminal emulation library, libteken, has been supporting
xterm-style terminal emulation for months, so flip the switch and make
everyone use an xterm-style console driver.

I still have to enable this on i386. Right now pc98 and i386 share the
same /etc/ttys file. I'm not going to switch pc98, because it uses its
own Kanji-capable cons25 emulator.

IMPORTANT: What to do if things go wrong (i.e. graphical artifacts):

- Run the application inside script(1), try to reduce the problem and
  send me the log file.
- In the mean time, you can run `vidcontrol -T cons25' and `export
  TERM=cons25' so you can run applications the same way you did before.
  You can also build your kernel with `options TEKEN_CONS25' to make all
  virtual terminals use the cons25 emulator by default.

Discussed on:	current@
This commit is contained in:
Ed Schouten 2009-11-13 05:54:55 +00:00
parent 347c7f559c
commit e42fc36867
15 changed files with 90 additions and 54 deletions

View File

@ -22,6 +22,21 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
machines to maximize performance. (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
20091113:
The default terminal emulation for syscons(4) has been changed
from cons25 to xterm on all platforms except i386 and pc98.
This means that the /etc/ttys file needs to be updated to ensure
correct operation of applications on the console.
The terminal emulation style can be toggled per window by using
vidcontrol(1)'s -T flag. The TEKEN_XTERM and TEKEN_CONS25
kernel configuration options can be used to change the
compile-time default.
To prevent graphical artifacts, make sure the TERM environment
variable is set to match the terminal emulation that is being
performed by syscons(4).
20091109:
The layout of the structure ieee80211req_scan_result has changed.
Applications that require wireless scan results (e.g. ifconfig(8))

View File

@ -15,7 +15,7 @@
#
# type The initial terminal type for this port. For hardwired
# terminal lines, this will contain the type of terminal used.
# For virtual consoles, the correct type is typically cons25.
# For virtual consoles, the correct type is typically xterm.
# Other common values include network for network connections on
# pseudo-terminals, dialup for incoming modem ports, and unknown
# when the terminal type cannot be predetermined.
@ -30,15 +30,15 @@
# when going to single-user mode.
console none unknown off secure
#
ttyv0 "/usr/libexec/getty Pc" cons25 on secure
ttyv0 "/usr/libexec/getty Pc" xterm on secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" cons25 on secure
ttyv2 "/usr/libexec/getty Pc" cons25 on secure
ttyv3 "/usr/libexec/getty Pc" cons25 on secure
ttyv4 "/usr/libexec/getty Pc" cons25 on secure
ttyv5 "/usr/libexec/getty Pc" cons25 on secure
ttyv6 "/usr/libexec/getty Pc" cons25 on secure
ttyv7 "/usr/libexec/getty Pc" cons25 on secure
ttyv1 "/usr/libexec/getty Pc" xterm on secure
ttyv2 "/usr/libexec/getty Pc" xterm on secure
ttyv3 "/usr/libexec/getty Pc" xterm on secure
ttyv4 "/usr/libexec/getty Pc" xterm on secure
ttyv5 "/usr/libexec/getty Pc" xterm on secure
ttyv6 "/usr/libexec/getty Pc" xterm on secure
ttyv7 "/usr/libexec/getty Pc" xterm on secure
ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.

View File

@ -15,7 +15,7 @@
#
# type The initial terminal type for this port. For hardwired
# terminal lines, this will contain the type of terminal used.
# For virtual consoles, the correct type is typically cons25.
# For virtual consoles, the correct type is typically xterm.
# Other common values include network for network connections on
# pseudo-terminals, dialup for incoming modem ports, and unknown
# when the terminal type cannot be predetermined.
@ -30,15 +30,15 @@
# when going to single-user mode.
console none unknown off secure
#
ttyv0 "/usr/libexec/getty Pc" cons25 off secure
ttyv0 "/usr/libexec/getty Pc" xterm off secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" cons25 off secure
ttyv2 "/usr/libexec/getty Pc" cons25 off secure
ttyv3 "/usr/libexec/getty Pc" cons25 off secure
ttyv4 "/usr/libexec/getty Pc" cons25 off secure
ttyv5 "/usr/libexec/getty Pc" cons25 off secure
ttyv6 "/usr/libexec/getty Pc" cons25 off secure
ttyv7 "/usr/libexec/getty Pc" cons25 off secure
ttyv1 "/usr/libexec/getty Pc" xterm off secure
ttyv2 "/usr/libexec/getty Pc" xterm off secure
ttyv3 "/usr/libexec/getty Pc" xterm off secure
ttyv4 "/usr/libexec/getty Pc" xterm off secure
ttyv5 "/usr/libexec/getty Pc" xterm off secure
ttyv6 "/usr/libexec/getty Pc" xterm off secure
ttyv7 "/usr/libexec/getty Pc" xterm off secure
#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.

View File

@ -15,7 +15,7 @@
#
# type The initial terminal type for this port. For hardwired
# terminal lines, this will contain the type of terminal used.
# For virtual consoles, the correct type is typically cons25.
# For virtual consoles, the correct type is typically xterm.
# Other common values include network for network connections on
# pseudo-terminals, dialup for incoming modem ports, and unknown
# when the terminal type cannot be predetermined.
@ -30,15 +30,15 @@
# when going to single-user mode.
console none unknown off secure
#
ttyv0 "/usr/libexec/getty Pc" cons25 off secure
# Virtual terminals.
ttyv1 "/usr/libexec/getty Pc" cons25 off secure
ttyv2 "/usr/libexec/getty Pc" cons25 off secure
ttyv3 "/usr/libexec/getty Pc" cons25 off secure
ttyv4 "/usr/libexec/getty Pc" cons25 off secure
ttyv5 "/usr/libexec/getty Pc" cons25 off secure
ttyv6 "/usr/libexec/getty Pc" cons25 off secure
ttyv7 "/usr/libexec/getty Pc" cons25 off secure
ttyv0 "/usr/libexec/getty Pc" xterm off secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" xterm off secure
ttyv2 "/usr/libexec/getty Pc" xterm off secure
ttyv3 "/usr/libexec/getty Pc" xterm off secure
ttyv4 "/usr/libexec/getty Pc" xterm off secure
ttyv5 "/usr/libexec/getty Pc" xterm off secure
ttyv6 "/usr/libexec/getty Pc" xterm off secure
ttyv7 "/usr/libexec/getty Pc" xterm off secure
ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals. The 'dialup' keyword identifies dialin lines to login,
# fingerd etc.

View File

@ -15,7 +15,7 @@
#
# type The initial terminal type for this port. For hardwired
# terminal lines, this will contain the type of terminal used.
# For virtual consoles, the correct type is typically cons25.
# For virtual consoles, the correct type is typically xterm.
# Other common values include network for network connections on
# pseudo-terminals, dialup for incoming modem ports, and unknown
# when the terminal type cannot be predetermined.

View File

@ -15,7 +15,7 @@
#
# type The initial terminal type for this port. For hardwired
# terminal lines, this will contain the type of terminal used.
# For virtual consoles, the correct type is typically cons25.
# For virtual consoles, the correct type is typically xterm.
# Other common values include network for network connections on
# pseudo-terminals, dialup for incoming modem ports, and unknown
# when the terminal type cannot be predetermined.
@ -30,15 +30,15 @@
# when going to single-user mode.
console none unknown off secure
#
ttyv0 "/usr/libexec/getty Pc" cons25 on secure
ttyv0 "/usr/libexec/getty Pc" xterm on secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" cons25 on secure
ttyv2 "/usr/libexec/getty Pc" cons25 on secure
ttyv3 "/usr/libexec/getty Pc" cons25 on secure
ttyv4 "/usr/libexec/getty Pc" cons25 on secure
ttyv5 "/usr/libexec/getty Pc" cons25 on secure
ttyv6 "/usr/libexec/getty Pc" cons25 on secure
ttyv7 "/usr/libexec/getty Pc" cons25 on secure
ttyv1 "/usr/libexec/getty Pc" xterm on secure
ttyv2 "/usr/libexec/getty Pc" xterm on secure
ttyv3 "/usr/libexec/getty Pc" xterm on secure
ttyv4 "/usr/libexec/getty Pc" xterm on secure
ttyv5 "/usr/libexec/getty Pc" xterm on secure
ttyv6 "/usr/libexec/getty Pc" xterm on secure
ttyv7 "/usr/libexec/getty Pc" xterm on secure
#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.

View File

@ -15,7 +15,7 @@
#
# type The initial terminal type for this port. For hardwired
# terminal lines, this will contain the type of terminal used.
# For virtual consoles, the correct type is typically cons25.
# For virtual consoles, the correct type is typically xterm.
# Other common values include network for network connections on
# pseudo-terminals, dialup for incoming modem ports, and unknown
# when the terminal type cannot be predetermined.
@ -34,15 +34,15 @@ screen "/usr/libexec/getty Pc" vt100 off secure
ttya "/usr/libexec/getty 3wire.9600" vt100 off secure
ttyb "/usr/libexec/getty 3wire.9600" vt100 off secure
# syscons(4)
ttyv0 "/usr/libexec/getty Pc" cons25 on secure
ttyv0 "/usr/libexec/getty Pc" xterm on secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" cons25 on secure
ttyv2 "/usr/libexec/getty Pc" cons25 on secure
ttyv3 "/usr/libexec/getty Pc" cons25 on secure
ttyv4 "/usr/libexec/getty Pc" cons25 on secure
ttyv5 "/usr/libexec/getty Pc" cons25 on secure
ttyv6 "/usr/libexec/getty Pc" cons25 on secure
ttyv7 "/usr/libexec/getty Pc" cons25 on secure
ttyv1 "/usr/libexec/getty Pc" xterm on secure
ttyv2 "/usr/libexec/getty Pc" xterm on secure
ttyv3 "/usr/libexec/getty Pc" xterm on secure
ttyv4 "/usr/libexec/getty Pc" xterm on secure
ttyv5 "/usr/libexec/getty Pc" xterm on secure
ttyv6 "/usr/libexec/getty Pc" xterm on secure
ttyv7 "/usr/libexec/getty Pc" xterm on secure
ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.

View File

@ -4,7 +4,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:~/b
export PATH
HOME=/root
export HOME
TERM=${TERM:-cons25}
TERM=${TERM:-xterm}
export TERM
PAGER=more
export PAGER

View File

@ -11,8 +11,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:$HO
# Setting TERM is normally done through /etc/ttys. Do only override
# if you're sure that you'll never log in via telnet or xterm or a
# serial line.
# Use cons25l1 for iso-* fonts
# TERM=cons25; export TERM
# TERM=xterm; export TERM
BLOCKSIZE=K; export BLOCKSIZE
EDITOR=vi; export EDITOR

View File

@ -1410,8 +1410,9 @@ options SC_NO_SUSPEND_VTYSWITCH
# 0x100 Probe for a keyboard device periodically if one is not present
# Enable experimental features of the syscons terminal emulator (teken).
options TEKEN_CONS25 # cons25-style terminal emulation
options TEKEN_UTF8 # UTF-8 output handling
options TEKEN_XTERM # xterm-style terminal emulation
#options TEKEN_XTERM # xterm-style terminal emulation
#
# Optional devices:

View File

@ -732,6 +732,7 @@ SC_RENDER_DEBUG opt_syscons.h
SC_TWOBUTTON_MOUSE opt_syscons.h
# teken terminal emulator options
TEKEN_CONS25 opt_teken.h
TEKEN_UTF8 opt_teken.h
TEKEN_XTERM opt_teken.h

View File

@ -50,6 +50,15 @@ __FBSDID("$FreeBSD$");
#include <teken/teken.h>
#if defined(TEKEN_XTERM) && defined(TEKEN_CONS25)
#error "xterm and cons25 are mutually exclusive."
#endif
/* XXX: Use cons25 on i386, for compatibility with pc98. */
#if defined(__i386__) && !defined(TEKEN_XTERM) && !defined(TEKEN_CONS25)
#define TEKEN_CONS25
#endif
static void scteken_revattr(unsigned char, teken_attr_t *);
static unsigned int scteken_attr(const teken_attr_t *);
@ -132,9 +141,9 @@ scteken_init(scr_stat *scp, void **softc, int code)
#ifndef TEKEN_UTF8
teken_set_8bit(&ts->ts_teken);
#endif /* !TEKEN_UTF8 */
#ifndef TEKEN_XTERM
#ifdef TEKEN_CONS25
teken_set_cons25(&ts->ts_teken);
#endif /* !TEKEN_XTERM */
#endif /* TEKEN_CONS25 */
tp.tp_row = scp->ysize;
tp.tp_col = scp->xsize;

View File

@ -3,7 +3,7 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:~/bin
export PATH
HOME=/root; export HOME
TERM=${TERM:-cons25}; export TERM
TERM=${TERM:-xterm}; export TERM
PAGER=more; export PAGER
#set -o vi

View File

@ -83,7 +83,11 @@ set_termcap(void)
#else
if (ColorDisplay) {
if (!term) {
#ifdef __i386__
if (setenv("TERM", "cons25", 1) < 0)
#else
if (setenv("TERM", "xterm", 1) < 0)
#endif
return -1;
}
}

View File

@ -125,10 +125,17 @@ set_termcap(void)
#else
if (ColorDisplay) {
if (!term) {
#ifdef __i386__
if (setenv("TERM", "cons25", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25, 1) < 0)
return -1;
#else
if (setenv("TERM", "xterm", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_xterm, 1) < 0)
return -1;
#endif
}
}
else {