A Minitel as a Linux terminal

The Minitel (from the French Médium Interactif par Numérisation d'Information Téléphonique) was an interactive videotex online service accessible through phone lines, operated in France from 1982 by the state-owned PTT (Postes, Télégraphes et Téléphones), the ancestor of France Télécom. The service was retired in 2012, after more than 30 years of existence. It might have been the world's most successful early online service, before the World Wide Web era. It offered services like telephone directory, purchases, reservations, mail, and chat just like the Web offers today.

The Minitel, starting from model 1B, can be used as a VT100-compatible Linux terminal with the proper wiring. So let's try...

Minitel 1

The first version of the Minitel, made by Telic Alcatel. So 80s.

Before starting to tinker, it's interesting to recall that the story behind the Minitel is actually pretty tragic despite its success. In the 70s, France was leading research on packet-switched networks. The CYCLADES project, directed by Louis Pouzin, inventor of the datagram, designed an early datagram-based packet communications network. In parallel, the French PTT was developing Transpac, a packet network based on virtual circuit switching with the emerging X.25 standard, which would be used by the Télétel network of the Minitel. The debate between datagrams and virtual circuits was eventually cut short by bureaucratic decisions in favor of the PTT. Datagram-based projects were stopped, but Pouzin's work on datagram networks served as an inspiration for academics Robert Kahn and Vinton Cerf in the development of TCP/IP, the future cornerstone of the Internet, for ARPANET, its ancestor, which was already running since the pionneering work of Leonard Kleinrock at UCLA, California. In the following years, France Télécom, backed by the French administration, enforced monopolistic prices and wanted to stick to a centralized circuit-switched network. They tried to resist the emerging Internet, maintaining it was only a flash in the pan. You know the rest.

Back to our terminal: several tutorials already exist on the Web, but most of them use a COM port, which is becoming rather uncommon, and expect a Linux distribution with System V init, which is now deprecated in most distributions in favor of Systemd. I'm using a Minitel 1B, but every Minitel with a Fnct key should serve the purpose as well (so the Minitel 1 is not compatible with this setup).

We will use a CP2102 USB to UART bridge so we can connect the Minitel via USB, as suggested on Pila's blog.

Schematic for the adaptation circuit between the Minitel and CP2102

Schematic for the adaptation circuit between the Minitel and CP2102

The Minitel has a DIN socket with 5 pins on the back to use it in VT100 mode. The TX pin of the Minitel is connected directly to the RX pin of the UART with a 220 kΩ pull-up resistor to the 5V VCC. The RX pin of the Minitel might output a voltage up to 15V, so we need to adapt the level to 3.3V with a 2N2222A transistor and a voltage divider.

The USB to Minitel cable soldered and ready to connect

The USB to Minitel cable soldered and ready to connect

Now that the hardware is ready, let's do some software configuration. First, we need a dedicated terminfo file so it works smoothly: mntl.ti written by Alexandre Montaron.

Compile and install it with tic:

$ wget http://canal.chez.com/mntl.ti
$ tic mntl.ti

My Linux machine, like any modern system, is set up with a UTF-8 locale. We have to disable it and switch to ASCII English when using the Minitel as a terminal by adding the following to ~/.bashrc:

[...]
# Minitel
case "$TERM" in
m1*|m2*)
    export LC_ALL=C
    ;;
esac

The Minitel requires specific escape codes for accents, so if you want them to work, the trick is to use screen with some termcapinfo commands added to ~/.screenrc, as specified in the mntl.ti file.

The Minitel has no memory and needs to be configured at each restart:

  • Fnct+T then A to switch to VT100 mode (default is Videotex)
  • Fnct+T then E to disable local echo (local echo is enabled by default)
  • Fnct+P then 4 to switch to 4800 bauds, the maximum the Minitel 1 can handle (default is 1200)

Eventually, let's send a prompt to the Minitel with agetty.

Calling agetty directly is possible, except the login prompt is ugly. The reason for this issue is that the Minitel actually expects 7 bits with one even parity bit, and this has to be autodetected, but only after the login is sent. Therefore, we first issue a stty to set the terminal flags properly, then call agetty with the -c argument so it does not reset them.

#!/bin/sh

TTY=${1:-ttyUSB0}
BPS=4800

stty -F "/dev/$TTY" $BPS istrip cs7 parenb -parodd brkint \
        ignpar icrnl ixon ixany opost onlcr cread hupcl isig icanon \
        echo echoe echok;

while [ -e "/dev/$TTY" ]; do
        agetty -c -L -i -I "\033\143" $TTY $BPS m1b-x80
        sleep 1
done

I'm setting the TERM environment variable to m1b-x80 for model 1B in 80-column mode. The purpose of the init string "\033\143" is to clear the screen before sending the prompt.

# chmod +x getty_mntl.sh
# ./getty_mntl.sh ttyUSB0

It works perfectly, and most Linux console-based programs work without any issue on this old-fashioned terminal. For instance, Lynx works like a charm.

Browsing Wikipedia like it's 1989

Browsing Wikipedia like it's 1989

Music on Console (MOC) also runs flawlessly, turning the Minitel into a nice retro music player interface!

Music on Console (MOC) running on the Minitel

Music on Console (MOC) running on the Minitel

This was only the beginning of my Minitel saga, see my Minitel 2.0 article about integrating a Raspberry Pi into a Minitel!

Categories
Tags
Feeds