From 3de72f45135d7c79b43ad25b539f117d040aa246 Mon Sep 17 00:00:00 2001 From: Jason Wessel Date: Mon, 2 Nov 2020 14:28:52 -0800 Subject: [PATCH] systemd-serialgetty: Switch to TERM=linux 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 Signed-off-by: Richard Purdie --- meta/recipes-core/systemd/systemd-serialgetty.bb | 2 ++ .../systemd/systemd-serialgetty/serial-getty@.service | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb index 0cc0dc8c79c..d142b30f7e1 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -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 diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service index 549d5660091..b16fe1188e7 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service +++ b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service @@ -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 -- 2.47.2