# Real terminal call-out

Via a serial connection, and either a pair of modems or a "null modem" cable, one system can act as a terminal for another system. This is variously known as "call out" or "dial up". This package contains tools for emulating a real terminal on another system via a "call out" serial port when the "null modem" case applies.

Call-out is done with `ttycallout@device` services, configured to use those devices. Such a call-out service is a very simple service, which can be managed just like other ordinary services, started and stopped and enabled and disabled in the usual way.

The service runs `console-terminal-emulator` to provide terminal emulation, attached to the "call out" serial device `/dev/device` and presenting itself as the `/run/dev/device` user-space virtual terminal. This is just another user-space virtual terminal that can be realized and multiplexed like any others. So (for example) one could run a bank of such `ttycallout@cuauN` services under a multiplexor and an input method; configure them with specific dedicated HIDs and framebuffers; and use individualized keyboard maps and fonts.

These services are suitable for serial ports connected via "null modem" cables; they have no modem command functionality. It is assumed that the cable is always connected, and the speed/parity/bits are pre-configured by the machines at both ends of the connection. Since `console-terminal-emulator` provides a fixed known terminal emulation, the system at the other end of the connection must be told the appropriate `TERM` environment variable for the terminal type.

## What the service bundle `run` scripts look like

The `run` script for such services is basically this (using `ttycallout@cuau1` as an example):

>     #!/bin/nosh
>     setenv TTY /dev/cuau1
>     setsid
>     setlogin -- user-vt-emulator
>     open-controlling-terminal
>     setuidgid --primary-group user-vt-realizer -- user-vt-emulator
>     foreground stty 115200 raw -crtscts -tostop ;
>     console-terminal-emulator /run/dev/cuau1

### FreeBSD, DragonFly BSD, and similar

The services are `ttycallout@cuau0` through to `ttycallout@cuauf`, matching the operating system's real terminal devices `/dev/cuau0` to `/dev/cuauf`. These should not be run at the same time as the matching `getty@ttyu0` through to `getty@ttyuf` service(s).

### OpenBSD

The services are `ttycallout@tty00` through to `ttycallout@tty07` and `ttycallout@ttyU0` through to `ttycallout@ttyU3`, matching the operating system's real terminal devices `/dev/tty00` to `/dev/tty07` and `/dev/ttyU0` to `/dev/ttyU3`. These should not be run at the same time as the matching `getty@tty00` through to `getty@tty07` and `getty@ttyU0` through to `getty@ttyU3` service(s).

### Linux-based operating systems

The services are `ttycallout@ttyS0` through to `ttycallout@ttyS3`, matching the operating system's real terminal devices `/dev/ttyS0` to `/dev/ttyS3`. These should not be run at the same time as the matching `agetty@ttyS0`/`mgetty@ttyS0` through to `agetty@ttyS3`/`mgetty@ttyS3` service(s).