Retrotechtacular: Where The Linux/UNIX TTY Came From

retrotechtacular-tty-demystified

From time to time we realize that sayings which make sense to us probably will have no meaning for future generations. Two of the examples that spring to mind are “hang up the phone” or in a vehicle you might “roll down the window”. And so is the case for today’s Retrotechtacular. Linux users surely know about TTY, but if you look up the term you actually get references to “Teletypewriter”. What’s that all about?

[Linus Akesson] wrote a fantastic essay on the subject called The TTY Demystified. We often feature old video as the subject of this column, but we think you’ll agree that [Linus’] article is worth its weight in film (if that can be possible). The TTY system in Linux is a throwback to when computers first because interactive in real-time. They were connected to the typewriter-mutant of the day known as a teletype machine and basically shot off your keystrokes over a wire to the computer the terminal was controlling.

This copper pipeline to the processor is still basically how the terminal emulators function today. They just don’t require any more hardware than a monitor and keyboard. We consider ourselves fairly advanced Linux users, but the noob and expert alike will find nuggets and tidbits which are sure to switch on the lightbulb in your mind.

[Thanks Chuck]

Retrotechtacular is a weekly column featuring hacks, technology, and kitsch from ages of yore. Help keep it fresh by sending in your ideas for future installments.

USB Adapter For An Old VT100 Keyboard

VT100

Ah, the VT100, the first dumb terminal that was controlled with a microprocessor. This ancient beast from the late 70s is quite unlike the terminals you’d find from even five years after its vintage – the keyboard connects via a TRS quarter-inch jack – the electronic and code design of this terminal is a bit weird. [Seth] was up to the challenge of making this mechanical keyboard work as a standard USB device, so he created his own USB adapter.

On the little quarter-inch to USB adapter, [Seth] included an HD 6402 UART to talk to the keyboard, along with a Teensy dev board and a few bits of circuits stolen from DEC engineers. The protocol between the keyboard and terminal is a little weird – first the terminal sets a bit in a status word, then the keyboard scans all the key rows and columns in sequence before telling the terminal it’s done. Yes, this gives the VT100 full n-key rollover, but it’s just weird compared to even an IBM Model M keyboard that’s just a few years younger.

[Seth] finally completed his circuit and wired it up on a perfboard. Everything works just as it should, although a little key remapping was done to keep this keyboard adapter useful for Mac and Windows computers. It’s a wonderful bit of kit, and any insight we can get into the old DEC engineers is a wonderful read in any event.

Vidias below.

Continue reading “USB Adapter For An Old VT100 Keyboard”

Controlling A Terminal With Google Voice

sms

For how awesome Google Voice is, we’re surprised we haven’t seen this before. [Steve] is using Google Voice to run commands on just about any Linux box.

Google Voice doesn’t have an official API, and existing unofficial APIs weren’t up to snuff for [Steve]’s project. He ended up writing his own that checks his unread message inbox every minute and looks for new text messages beginning with the phrase, ‘Cmd’. If a series of checks pass – the text coming from a known phone number and a proper terminal command – the command runs and sends the a text back indicating success or failure.

While [Steve] probably won’t be playing nethack or Zork via SMS anytime soon, we can see this being very useful for a Raspi home automation task. Just send a text message and a properly configured Linux box can open your garage door, turn on the lights, or even start a webcam.

Having Fun With Dumb Terminals

terminal

For a long time now, [Morgan] has been wanting an old serial terminal. In a stroke of luck, one of his pals at the Quelab hackerspace scored an awesome ADM-3A terminal from a collector. It’s a historically significant piece of computing and UNIX history, so obviously [Morgan] needed to get it working.

The ADM-3A terminal pre-dates the famous DEC VT-100 terminal, but since [Morgan]’s new acquisition speaks RS-232, he had a good shot at getting it to work with one of his more modern boxes. He’s using a Windows laptop loaded up with FreeBSD in a VM to talk to the terminal. Surprisingly, the only additional hardware required was a USB to serial cable and a DE9-DB25 serial adapter.

It may not be as cool (or as loud) as Quelab’s Teletype ASR-35 they have set up for Zork sessions, but it’s great to see ancient hardware have some
use. Right now, [Morgan] is editing files with vi and of course playing Zork. Seems like there’s plenty of life left in this old dumb terminal. After looking for an old VT-100 for a while now, I’ve got to say I’m pretty jealous.

BASH Games

Get serious about your shell scripting skills and maybe you can pull this one off. It’s a game of snake played in a BASH shell. It seems like a coding nightmare, but the final product turns out to be organized well enough for us to understand and took less than 250 lines of code.

[Martin Bruchanov] started on the project after pining for an old DOS game called Housenka. It’s another version of the classic Snake game which we’ve coded ourselves and seen in several projects including this head-to-head version using musical recorders as controllers. When using a terminal emulator capable of ANSI sequences the game is displayed in color using extended characters.

We give [Martin] bonus points for the way he wrote about his project. It describes the mechanics most would be interested in, like how the user input is captured and what drives the update function and food generation. The rest of the details can be gleaned by reading through the code itself.

Adding A Bluetooth Terminal To Your Router

bluetooth-router-terminal

This image shows an Android tablet monitoring the terminal of a router via Bluetooth. It makes it a snap to tweak your router from a multitude of devices as long as you’re within range (usually BT works up to about 30 feet or so). The only part that [Yohanes] needed to pull off the hack was a Bluetooth module which he picked up for a few dollars.

All routers will have serial connections somewhere on the board. His model (Asus RT-N16) even had the GND, RX, TX, and VCC pads labeled. He soldered a SIL pin socket to the port which accepts the pin header from the Bluetooth module. Before plugging that in he had to issue a few commands to the device to get it using the same baud rate and settings as the router’s serial port. With that taken care of he can now wirelessly monitor and control the device via the serial terminal.

The one issue which he did encounter is that the module is slower to boot than the router. This means that at power-up you will not see anything on the terminal until the router has already started to load the Linux kernel. If you don’t plan on doing any bootloader hacks this shouldn’t make any difference.

Rooting Your AT&T U-verse Modem

Unhappy with the performance of his U-verse modem [Jordan] decided to dig in and see if a bit of hacking could improve the situation. Motorola makes this exclusively for AT&T and there are no other modems on the market which can used instead. Luckily he was able to fix almost everything that was causing him grief. This can be done in one of two ways. The first is a hardware hack that gains access to a shell though the UART. The second is a method of rooting the device from its stock web interface.

We think the biggest improvement gained by hacking this router is true bridge mode. The hardware is more than capable of behaving this way but AT&T has disabled the feature with no option for an unmodified device to use it. By enabling it the modem does what a modem is supposed to do: translate between WAN and LAN. This allows routing to be handled by a router (novel idea huh?).