Our console enhancement patchset updated for the latest OpenBSD release
Missing these features from your new OpenBSD 7.3 system?
True bold font rendering
Keyboard control sequences that better match Xterm
There's no need to cry a river!
Just apply our rather spiffy patchset and compile away!
We've created updated versions of our console enhancement patches, and they now apply to OpenBSD 7.3-release. What's more, these new versions are available to download immediately right from this page!
During the development cycle of OpenBSD 7.3, various patches developed at Exotic Silicon to enhance the functionality of the framebuffer console were accepted and added to CVS.
As a result of this, a stock installation of OpenBSD 7.3 now already includes support for a few additional control sequences for cursor movement, a backtab key, and directly setting the foreground and background color to the bright versions of the ANSI colors.
No additional manual patching is required to use these features anymore!
However, some of the other functionality that we developed at the same time has not yet been added to CVS, and as a result is not included in the standard OpenBSD 7.3 release.
(That's what this patchset fixes.)
The patchset has been divided in to four parts:
Part 1256 colors, dim, invisible, double underline, and strike-through
Part 2Updated key sequences
Part 3True bold, and italic text rendering
Part 4Screenshot functionality
Note: a small piece of the italic code is intentionally included in part 1, to reduce the overall size of the patchset. However this code is effectively a no-op without part 3 installed.
Status of each part
Well tested, and is expected to work on most if not all systems.
The actual rendering of the new attributes is only supported on 32-bpp framebuffers, but the code is not expected to crash or cause issues when run on non 32-bpp displays.
Also well tested, and not expected to crash the kernel.
Compatibility with userland programs when using a termtype compatible with xterm should be very good. However there exists the possibility of differences in behaviour compared to the framebuffer console without this patch when using programs that configure the keyboard in unusual ways, (such as using the keypad in application mode).
Known to have issues with some graphics drivers.
Typically such issues will result in a crash very early in the kernel initialisation. These issues have not been fully debugged yet, making this part currently unusable on the affected systems.
Tested on a limited range of graphics hardware.
Whilst it is not expected the crash the kernel, the quality of the results from the graphical screendump routines may be sub-optimal. This function is still considered to be in the alpha stage of development. Text based screenshots are expected to work without problems, with the limitation that codepoints above 255 will not be preserved, but instead be reduced to the 0 - 255 range.
Compatibility of the various parts
The combination of all four patches applied has received much more testing than any other.
However, with some restrictions, it is possible to apply each part selectively if you don't want or can't use all of the features:
Either of parts 1 and 2 can be applied in isolation, or both can be applied together.
Part 3 requires part 1, which should be applied first if applying all of the first three patches.
Part 4 is intended to be applied on top of parts 1, 2, and 3.
Part 4 can be applied to a system which has only received parts 1 and 2, and skipped part 3. In this case, the patch for part 4 will apply with an offset which can be ignored.
Part 4 can also be applied to a system which has not received any of the other parts. In this case, the patch will report some offsets and a non-existent line in the source file, which can also be ignored.
Quick-start cheat sheet
The simplest option, with the widest hardware compatibility is to:
Apply parts 1 and 2, and set TERM=xterm-256color.
Once this has been tested and seen to be working, then apply part 3 for testing.
If necessary, back out part 3.
Apply part 4.
Copy the kernel header file /usr/src/sys/dev/wscons/wsconsio.h to /usr/include/dev/wscons/wsconsio.h
Remember to copy the updated kernel header file to the location expected by userland programs
Choosing a suitable termtype
The default termtype for the framebuffer console is vt220.
With none of the patches above installed, in other words on a stock installation of OpenBSD 7.3-release, the following termtype options are usable to varying degrees:
Basically the lowest common denominator. No color support. Some function keys incorrectly mapped.
Mostly works, but has known issues. ANSI colors 0-7 only. Can't use color together with underline.
Works well for output. Some function keys will be incorrectly mapped. ANSI colors 0-7.
With parts 1 and 2 applied, the following options become available:
Now works well for input and output. Function keys should work in the vast majority of cases. ANSI colors 0-7.
As above, but with 256 color support.
Here at Exotic Silicon, we are using the xterm-256color entry on a daily basis on production machines without any issues.
Using just one of either part 1 or part 2
It is technically possible to apply either part 1 or part 2 without the other part.
However this doesn't really create a useful system in most cases.
Note that with part 2 applied, (either alone or with other parts), the use of pccon is no longer recommended as some function keys will not work due to the new sequences.
If you particularly want or need to use the pccon termtype entry and cannot switch to either xterm or xterm-256color, but would like to have direct access to the new escape sequences implemented in part 1 independently of the terminfo system, then applying part 1 without part 2 will achieve this.
Alternatively, if you are not interested in the enhanced text rendering functions, but would like to use the xterm entry with programs that use function keys, then applying part 2 without part 1 is also possible. In this case, the xterm-16color entry can likely be used successfully, but this configuration has not been widely tested by us.
Using part 3
Part 3 requires part 1 to have been applied first.
Part 3 does not require part 2 in order to compile, but for practical usage in conjunction with the xterm-256color termtype, part 2 will likely be desired so that the function keys generate control sequences that are appropriate for that termtype.
Screendumps - using part 4
To use the screendump kernel facilities, some accompanying userspace programs are required. These are almost unchanged from the versions used with the previous kernel patches for screendumps.
The userland utility for graphical screendumps does not require any changes to work on an OpenBSD 7.3 system with the new version of the kernel patches.
The userland utility for text screendumps should either be re-compiled with the ENHANCED_CONSOLE compile time option set, if this was not previously enabled, or alternatively upgraded to version 1.1, which always has this functionality included and removes support for the old bitfield layout used in OpenBSD 7.2.
The file /usr/src/sys/dev/wscons/wsconsio.h needs to be copied to /usr/include/dev/wscons/wsconsio.h after applying the kernel patch, so that the userland screendump programs can find the new version.
Remember to copy the updated kernel header file to the location expected by userland programs after applying part 4 of the patchset
Downloading and applying the patches
The kernel patchset and userland utilities for the screendump facility are available to download in a single tar archive.
The individual files in the archive are signed with our signify key.
Assuming that you have downloaded the tar archive and our signify key to /root, the first two kernel patches can be applied as follows:
# cc -O3 -o demo_256_and_attributes demo_256_and_attributes.c
# mv demo_256_and_attributes /usr/local/bin/
The userland screendump utilities are very simplistic, and intended as examples of how to use the new ioctls rather than comprehensive applications in their own right. For more programming information, please refer to the original console screendumps article.
Nevertheless, they are somewhat usable and can be invoked from the command line without any arguments.
The graphical screendump utility will create a single file rgb_screendump.ppm in the current directory.
The text screendump utility will create three files in the current directory:
screendump.asc contains the contents of the screen as ASCII, (or more correctly, 8-bit), text, with lines trimmed to their correct length, and line breaks inserted at the end of each line. Codepoints above 255 are reduced modulo 256.
screendump.raw also contains the raw values reduced modulo 256, but doesn't trim lines or insert line breaks. As a result, each visible screen line is effectively padded with spaces to the width of the terminal.
screendump.html is a very simple attempt to preserve color and some formatting of the dumped display as HTML with embedded CSS.
Note that text-based screendumps of displays containing codepoints above 255 may contain unexpected control characters in the 0-31 and 160-192 range, due to the reduction of the character cell value to an unsigned 8-bit value.