]> code.ossystems Code Review - openembedded-core.git/commitdiff
systemd-serialgetty: Switch to TERM=linux
authorJason Wessel <jason.wessel@windriver.com>
Mon, 2 Nov 2020 22:28:52 +0000 (14:28 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 8 Nov 2020 14:03:16 +0000 (14:03 +0000)
Long ago in commit 473ff65c2f69de4ece3204fadfae7c5cb992149a
(serial-getty service: Add xterm as default TERM), the xterm
became the default for the serial port terminal.

Using the version of vim.tiny in oe-core master with the
serial port connected in xterm version 322 (which is one
of the most widely deployed versions at the current time)
causes artifacts and missed characters.

The example sequence is the following:
  * Start vim
  * Press "i" to enter input mode
  * Type "123"
  * Press Escape to enter command mode
  * Press "a" to enter append mode
  * Type "456"

At this point if you are using xterm less than version 535 you will
see on your screen "12456" instead of "123456".

Changing the TERM variable to "linux" will still allow you to have all
the same functionality with colorization, ansi character escapes
etc..., but will avoid the extra xterm specific escape sequence that
only exists in the most recent versions of xterm.

This patch allows the end user to set the serial terminal type to
something other than the new default of "linux" by changing the
SERIAL_TERM variable in local.conf.  For example:
    SERIAL_TERM = "xterm"

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/systemd/systemd-serialgetty.bb
meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service

index 0cc0dc8c79cdf663f7c99864b8c3cda05e516340..d142b30f7e1cd7efb8c21a0b6de5c4d93876664f 100644 (file)
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=80
 PR = "r5"
 
 SERIAL_CONSOLES ?= "115200;ttyS0"
+SERIAL_TERM ?= "linux"
 
 SRC_URI = "file://serial-getty@.service"
 
@@ -22,6 +23,7 @@ do_install() {
                install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
                install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
                sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_unitdir}/system/serial-getty@.service
+               sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_unitdir}/system/serial-getty@.service
 
                tmp="${SERIAL_CONSOLES}"
                for entry in $tmp ; do
index 549d5660091086c179db27fb676934bf0bd2f3b5..b16fe1188e7256f48f672cbf20c5d82bceff183e 100644 (file)
@@ -29,7 +29,7 @@ Conflicts=rescue.service
 Before=rescue.service
 
 [Service]
-Environment="TERM=xterm"
+Environment="TERM=@TERM@"
 ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM
 Type=idle
 Restart=always