Finally, Something is on Television:
24/7 Information Using a decTOP as a Server

External view of a decTOP computer This is an overview of setting up an inexpensive, low-power server that can be left on 24/7 to provide prompt and customized information over a regular television. When news, weather, or other data is desired, simply turn on the television and flip the channel to the PC input.

A little computer called a decTOP was used with a television that has an analog VGA input. A standard ethernet home router provided internet connectivity.

I'm going to assume moderate technical proficiency throughout this document. Familarity with Linux, or at least UNIX, is a must. Many commands will need to be run as root and may need to be varied for your particular system or needs. So be sure to read the relevant man pages and other documentation at each step. This document gives you an overview of my process, but it is up to you to understand what you are actually doing.

Motivation

The idea was to provide useful everyday information with the least amount of hassle.

Often-times sources of information are either general and quickly accessible, or customized and slow. Most television stations require long waits through exasperating drivel. Even stations such as interactive weather channels usually have local forecasts embedded in horrible interfaces with limited data. On the other hand, desktop computers can be better customized but take time to power up and retrieve the data. Newspapers have good coverage and access but only update once a day at best. None of these are ideal for my parents who have a farm and need to make timely decisions about the cutting, turning, and baling of hay.

I wanted a system that would allow instant access to customized data at the push of a button (or two). The obvious way to do this was to use some software tools to present just the information we want and leave the computer powered on all the time to eliminate the waiting. Cost, efficiency, and esthetics are always factors in a design. So, I wanted a physically small, quiet, cheap, and low power computer. Performance isn't really an issue for such lightweight tasks. I also wanted to use the television as a display for cost reasons as well as to avoid having more clutter in the house. A small device known as a "decTOP" met these criteria.

The decTOP

Information on the decTOP can be found at The Unoffical decTOP wiki.

That link appears to be defunct. Some limited information is at en.wikipedia.org/wiki/Personal_Internet_Communicator.

Internal view of a decTOP computer The essential specifications are:

See the above wiki for a complete list.

The decTOP is available from Data Evolution. The shipping costs were substantial last I checked, so be sure to factor that into your costs.

The Operating System

The decTOP doesn't come with an operating system, just a blank hard drive. Since it isn't a very powerful computer, a lightweight operating system should be used. Damn Small Linux would be an excellent choice. I used Fedora because I'm insane....

Actually, I used Fedora because I wanted to learn about stripping it down and perhaps provide something useful that could be shared with the community. After all, this project was partly for fun and so I didn't want it to be too easy.

Whatever operating system you use, it must be installed from an external device. Since I don't have an external optical drive (CD-ROM or DVD-ROM) that connects via USB, I used one of my USB flash drives (a.k.a. thumb drive, pen drive, memory stick). The decTOP is capable of booting from a USB flash drive, although not all drives will boot on all computers so your milage may vary. You will need a 1 GB capacity drive or larger.

I plugged the flash drive into my normal desktop computer. Then I unmounted the flash drive so I could re-format it. Formatting is not supposed to be necessary, but it can help with flash drives that have funky partitions or master boot records. And it doesn't hurt.

As root, and replacing /dev/sdc1 with the device representing the partition on your flash drive, issue the following commands:

umount /dev/sdc1
mkfs.vfat /dev/sdc1

Then download the Fedora Live image and install it on the flash drive using the livecd tools.

livecd-iso-to-disk Fedora-9-i686-Live.iso /dev/sdc1

You don't need to mount the drive for the above operation.

Plug the flash drive into the decTOP and turn it on. When the blue "GRUB" screen appears, quickly press any key to interrupt the default boot sequence which is graphical and would be too much for this little machine to handle. Pressing the [Tab] key allows one to change the boot options. Add the number "3" to the end of the line containing the boot parameters. This represents runlevel 3 on a Linux/UNIX system and will cause the system to start in multi-user text mode instead of graphical mode.

When the login prompt appears, login as "fedora" with no password. At the prompt that appears next, type "liveinst" and ignore the scary "FATAL" messages. You will eventually be presented with the installer which will let you set things up however you choose. I'd recommend a swap of 1 GB to ensure you don't run out of memory. When the installer asks for any kernel boot options, type in "3" so that the system installed on the decTOP's hard drive will also come up in text mode for now.

Once the installation is done, agree to reboot. It will actually just exit the installer. Then type halt to power off the decTOP. Once the system says it is halted, press the power button to turn the decTOP off and remove the flash drive.

You should now have a working console-mode system. Remember Alt+F1 through Alt+F6 are your friends.

Overall Design and Requirements

By far and away the easiest way to display the information would be to simply load up a tabbed web browser with various web pages pre-loaded. The biggest problem with this is that a stock decTOP with only 128MB just isn't going to gracefully handle that large an application with all of its requisite data and libraries. We need a solution with fewer resource requirements. We also want something that is more versatile and robust in the face of non-technical people.

The solution was to retrieve and customize the information using command-line programs and generate static image files which could be displayed using a simple image viewer. In this case, qiv (Quick Image Viewer) was used.

This will require that the display be set to a graphics mode. There are various lightweight solutions for this, such as SVGA or the framebuffer. However, none of these are as well supported or as flexible as the good old X Window System. With fair justification, X has often been considered a large and unruly beast but it is modular and we can dispense with most of the overhead. We don't need a desktop environment, session manager, or even a window manager. We are just going to load up an image viewing program and run it directly on the root background.

The scripts to gather the data and prepare the images were done in python, so you will need a basic python installation as well as the Python Imaging Library (PIL).

With a Fedora Live installation you should only need to run the following as root:

yum install python-imaging qiv
Configuring a User Account

Time to boot up the decTOP. All of the commands in this section will need to be run as root.

Configure the firewall to allow ssh, using the system-config-firewall-tui command if necessary.

You should take the time to change the default runlevel in /etc/inittab rather than rely on the boot parameters.

Change:

id:5:initdefault:

to

id:3:initdefault:

Now setup a user account. Let's call it gather:

useradd gather
passwd gather

You'll want to be able to access the system remotely so you don't have a keyboard dangling out of your TV cabinet. We'll only be using a mouse for local control. Setup the secure shell as follows:

chkconfig --levels 35 sshd on
service sshd start

You will need a cryptographic key in order to access the system. If you don't already have one, generate one on your regular workstation with gpg --gen-key using all the defaults.

This will place a file called id_dsa.pub in your home directory under .ssh. This is your public key.

Copy your public key from $HOME/.ssh on your regular workstation to the same directory on your decTOP using a flash drive. Then name it authorized_keys, and set its permissions properly.

chown -R gather:gather /home/gather/.ssh
chmod 600 /home/gather/.ssh/authorized_keys
chmod 700 /home/gather/.ssh

Finally, verify that you can login from your desktop machine.

Say that your decTOP is assigned an IP address of 192.168.1.10:

ssh -l gather 192.168.1.10
and you should be in.

Graphics on a Television

The X server identified 1280x1024 as the highest resolution that the decTOP would support and started up in that mode. However, my television didn't accept that resolution. The highest video mode that both the decTOP and the television will support is 1024x768. Loading up an entire graphical desktop environment to set the display mode is at least 15 minutes worth of pain on this system (assuming your swap is large enough). As root, create the file /etc/X11/xorg.conf and place the following contents in it:

Section "Screen"
        Identifier "Screen0"
        Device     "Videocard0"
        DefaultDepth     24
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes    "1024x768" "800x600" "640x400"
        EndSubSection
EndSection

Adjust according to your particular television's intolerances.

The Gathering Scripts

Everything has been done in python to reduce the number of requirements. I've already created three scripts called "news", "stocks", and "weather". These call two additional helper classes. "Markup" allows you to retrieve any HTML or XML from a given URL (web address) and extract bits of interest. "TextLayout" provides for pasting text and images into a given image file in various layouts.

All the files are provided here.

Running the Scripts

Yup, this is a task for cron.

As root, create /etc/cron.allow and place the name of your user account in it.

Then run crontab -e and put in something similar to the following, adjusted to your preferences:

# Minute, Hour, Day, Month, Weekday

5        0,6,12,18   *        *        *                     ./weather
3        10-17       *        *        mon,tue,wed,thu,fri   ./stocks 
0        5           *        *        *                     ./news
Viewing the Results

In your home directory create a file named .xinitrc containing:

exec qiv -fiT /home/gather/output_weather.png /home/gather/output_stocks.png /home/gather/output_news_world.png /home/gather/output_news_canada.png /home/gather/output_news_business.png

This will run the Quick Image Viewer, displaying the images output by the gather scripts. You could simply use /home/gather/*.png, but I wanted them displayed in a particular order.

qiv -f invokes full-screen mode
qiv -i supresses an information status bar
qiv -T monitors and re-loads the image when the underlying file changes

Place the following line at the end of /etc/rc.local

su -c "startx" gather

This runs startx as user gather. Specifying a user prevents the image viewer from running as root, which is a security risk. startx is a user-friendly means of starting X without a desktop environment and running the contents of .xinitrc.

The image viewer will flip through the images forwards and backwards by pressing the left and right mouse buttons respectively. This allows you to just leave a mouse tucked away near the television and dispense with the keyboard.

Screenshot of gather weather data
Click to Enlarge