commit | 255d9f0589909ce80dd9bfe413ef6805ad069008 | [log] [tgz] |
---|---|---|
author | Chris Morin <cmtm@google.com> | Tue Feb 05 07:29:27 2019 |
committer | chrome-bot <chrome-bot@chromium.org> | Fri Feb 08 22:26:53 2019 |
tree | a71ebcfc9aee9782e03f35f639d9ccbad02822a3 | |
parent | a2c76efc8a0ca6988f4270a88543f75d05ccd5bb [diff] |
frecon: fix logging to /dev/kmsg frecon is setup to log to /dev/kmsg. Each call to LOG consisted of several calls to write(): one for the prefix, another for the message, and a final one to add a trailing newline. The kernel interprets each of these write() calls as a separate log entry, causing the message to be broken into contextless fragments. Instead, make a single call to write(). Include the severity of the log message using the prefix notation understood by the kernel. The LOG function previously ignored the severity argument. The log_tsm function converted them to a string and included them in the message prefix. Use "frecon" as the syslog tag for the log_tsm function to make it easier to group messages from frecon. Add pid to messages from log_tsm. Surround the pid in square brackets instead of round brackets. This is the standard way syslog expresses it, and consumers of kernel messages such as journald expect them. BUG=chromium:929010 TEST=frecon messages in dmsg are correctly formatted TEST=frecon messages in journalctl have correct _PID and SYSLOG_IDENTIFIER values Change-Id: I3fa80d51759daf1cda51b3a4adec46f9bd26272f Reviewed-on: https://chromium-review.googlesource.com/1456564 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Christopher Morin <cmtm@google.com> Reviewed-by: Dominik Behr <dbehr@chromium.org>
This is a terminal emulator that replaces the kernel Virtual Terminal (VT) console. It uses the Kernel Mode Setting (KMS) support in the kernel. It is similar to the kmscon project: https://www.freedesktop.org/wiki/Software/kmscon
A new project was created (rather than re-using kmscon) because:
However, it‘s not as bad as it sounds! We haven’t re-implemented our own terminal emulator -- we use the same library that kmscon does: libtsm. That's the much more tricky part too.
For even more details, check out the design doc in this repo.
--clear=color
Specify clear color for splash screen terminal. The color is 32-bit integer in a framebuffer format (ARGB) in any format supported by strtoul.--daemon
Daemonize frecon.--enable-gfx
Enable image and box drawing OSC escape codes.--enable-vts
Enable additional terminals in addition to splash screen.--enable-vt1
Enable switching to VT1 (aka splash screen) and keep a terminal on it after finishing splash animation.--frame-interval=N
Specify default time (in milliseconds) between frames of splash screen animation.--loop-start=N
Specify frame to start splash animation loop. This option also enables the animation loop.--loop-count=N
Specify number of splash animation loop repetitions. Default of 0 repeats forever. Looping has to be enabled using --loop-start
.--loop-interval=N
Specify default time (in milliseconds) between frames of loop animation.--loop-offset=x,y
Specify default offset to centered image in loop.--no-login
When additional terminals are enabled do not display login prompt on them. Can be used by scripts to display debugging information and logs on additional terminals.--num-vts=N
Specify number of enabled VTs. The default is 4, the maximum is 12.--offset=x,y
Specify absolute location of the splash image on screen.--pre-create-vts
Normally VTs are create on demand the the user switches to a VT. In some cases it may be necessary to pre-create them at startup, for instance to write a log or debug output for them while they are not active so it can be examined later. This option allows for that. This option also ensures daemon parent waits for daemon child to finish initalization so consoles are created by the time daemon parent exits.--print-resolution
Print detected screen resolution and exit. Deprecated.--scale=N
Set default scale for splash screen images. The scale is a positive integer number. Default scale is 1. 0 has a special meaning - using scale 1 for screens with horizontal resolution lower and equal than 1920 and 2 otherwise. Scale affects image/box size and offset.--splash-only
Exit immediately after finishing splash animation. Otherwise frecon will wait for DBUS signal (LoginScreenVisible) from Chrome before exiting when extra terminals are not enabled.--image=/path/to/image.png
--image-hires=/path/to/image.png
or any image file name specified after options Add image to splash screen animation. --image
and --image-hires
are added conditionally depending whether horizontal or vertical screen resolution is above 1920. This allows frecon to make runtime decision which set of images to use instead running frecon first with --print-resolution
option and making this decision in a script that invokes frecon. Free form image file name in the command line are added unconditionally.Frecon implements rudimentary functionality to display images and draw single color boxes on the terminal screen using OSC (Operating System Command) based terminal escape codes.
The OSC sequences always start with ESC+] (\033]
) and end with either the String Terminator (ST) sequence (\033\\
) or a BEL (\a
) character.
Two escapes are implemented, all escape parameters can be specified in any order.
image:file=/full/path/to/file.png;location=x,y;offset=x,y;scale=s
box:size=w,h;color=c;location=x,y;offset=x,y;scale=s
location
is the absolute location on screen.offset
is an image offset starting with image centered on screen.color
is a 32-bit number in the same format as --clear
command line argument, it defaults to 0
.size
is two integer numbers.scale
is integer scaling factor applied to image size or box size.Examples:
printf "\033]image:file=/usr/share/chromeos-assets/images_100_percent/boot_splash_frame18.png\a" > /dev/pts/1 printf "\033]box:color=0xFFFFFFFF;size=100,100\a" > /dev/pts/1
An escape code can be used to enable/disable keyboard input processing on a terminal. The setting is stored per terminal and applies to input “within” terminal. Swithing between terminals, scrolling, backlight control etc remains operational.
input:onoff
onoff
is one of: on,1,true or off,0,falseExamples:
printf "\033]input:on\a" > /run/frecon/vt0 printf "\033]input:off\a" > /run/frecon/vt1
Frecon creates the following files and links in /run/frecon
directory:
/run/frecon/pid
which contains pid for frecon daemon process (only when --daemon
is specified on command line).
for every VT it creates, a link from /run/frecon/vt%u
to /dev/pts/X
where %u
is terminal number from 0 to num-vts - 1 so the user can determine which VT uses which pts since pts number assignment is not deterministic.