I previously set up basic functionality to use an original VT520 with linux. This post covers additional advances.

F-Keys

The F-Keys in the vt520 terminfo db actually only cover the use of an original DEC keyboard. I only have regular PC PS/2 keyboards. I ended up shipping a custom vt520.src file with my dotfiles, which i compile with tic if necessary.

Carrier Detect

When getty is not started with -L and the CD (Carrier Detect) control line is properly connected, shutting off the terminal will kill all remote processes with SIGHUP (modem hangup).

Hardware flow control

When the DSR and DTR lines and properly connected, the terminal can be configured to use it to halt the data flow temporarily. For this to work, getty needs to be started with -h.

MMJ Connectivity

To make use of the propietary 6-pin MMJ plug, you likely need to hand-crimp an custom cable. The MMJ plug is like RJ11 or RJ12, except with the nose at the side except in the middle. For some reason most crimp tools available don’t support this configuration even if they are advertised as DEC compatible.

Because the MMJ plug only allows a single control line per direction, you can only use one of hardware flow control or carrier detect. If you choose one, you must disable the other both on getty and on the terminal.

Higher Speeds

For working productively, 9600 baud are quite slow and not really useful. Faster speeds only worked without garbled output when hardware flow control is enabled. This is because shifting of characters around the screen is quite CPU intensive for the terminal, and at higher speeds, the delay caused by this is enough to overflow the input buffer. Redrawing a nested tmux buffer reliably caused this.

Temporarily switching speeds

I wanted to keep the serial line compatible to my slower devices, so switching getty to the faster baud rate wasn’t much of an option to me.

To still be able to enjoy faster speeds, i consulted the VT datasheet and found that the baud rate can be dynamically reconfigured at run time. This is the script i ended up using:

#!/bin/sh

printf '\033[0;11*r'
sleep 1
stty 115200

echo "Fast serial"
$SHELL -i

printf '\033[0;6*r'
sleep 1
stty 9600

echo "Slow serial"

The escape sequence uses a propietary extension, the numbers are constants for fixed baud rates:

  • 6 for 9600 baud
  • 7 for 19200 baud
  • 8 or 38400 baud
  • 9 for 57600 baud
  • 10 for 76800 baud
  • 11 for 115200 baud

Without the sleep times, the stty command would switch the baud rate while the escape sequence wasn’t completely written out, obstructing the process.