3. fax

As well as Internet, you need to send and receive FAX's. Here's how you send high resolution faxes. You can do this even if you don't (yet) have an Internet account.

Your modem has to act as a receptionist for incoming calls. DATA gets the login prompt, FAX gets the FAX_machine software. VOICE makes it more complicated. The receptionist must also allow outgoing calls!

This is the job of 'getty', a program that converts serial lines to usable login tty lines. You don't need mgetty, efax is OK. mgetty is a better all round solution, but it takes a bit more thought and configuration. efax works almost immediately.

Most remote fax machines run at 9600. PC FAX modems run at twice that (14400), but no-one seems to have them.

You will also need a viewer such as xloadimage, xv or viewfax, as well as an image renderer (ghostscript) to generate faxes. efax has a simple plain-text to fax image renderer builtin, and the letters look good on a hi-res fax, just a bit plain. Ghostscript and xv are usually installed by default on slackware machines.

Later I thought I'd go for mgetty. It does audio?

3.1 efax-07a
3.2 /dev/something
3.3 edit /usr/bin/fax
3.4 Test the fax
3.5 Setup for incoming
3.6 fax view
3.7 URGENT! 50 page postscript document to send NOW!
3.8 hi-res lo-res



This is a tiny system at 82K, mgetty weighs 444K (uncompiled).

It builds and installs out of the box. You have to customise ONE file - to set your station-id and other parameters.

You have to



Have a look at the main section on getting your modem working, the most basic thing is to know which serial port UART it is connected to, and which IRQ it uses. Once the hardware is working you can move on to the software. The efax and mgetty programs know about different modem capabilities, from different manufacturers.

Run the fax test command to check, and remember that Unix is a modular system, if the hardware isn't configured properly the application software (fax) can't use it.

You also have to have permission to use the phone (modem device), so either login as root, or create a phone group with yourself as a member.


edit /usr/bin/fax

vi /usr/bin/fax and make at least these changes ...

The VIEWCMD you use, depends on which fax viewer you prefer. Remember that FAX images are HUGE, and you need one that scrolls nicely. xloadimage is a nice simple (direct) viewer. viewfax has multiple zoom levels, and can 'page' several files. They should be on your CDROM and on sunsite.


Test the fax

The fax test command, will look at your modem, to see that all is OK. It's how you know that the correct device is being used, that it's switched on, and it is a valid FAX modem.

When sending FAXES (and when typing them in your letters) Avoid spaces in the phone number, use dashes! It's confusing with shell. HINT: Help others use CUT+PASTE by using dashes in your EMAIL's and WEB pages. It's so much easier :-)

At first glance, the fonts used in faxes seem quite horrific. This is a problem with the viewer scaling down the image to the display. You will see the difference.


Setup for incoming

It's mostly all done, you just need to print the faxes, or email a message to someone (the files remain in /var/spool). Delete files when ??

Basically you have three choices: you configure efax to act as a getty (or mgetty) -or- you set efax running when you expect a call -or- you get efax to answer a ringing call.

When efax receives a fax, it puts it in /var/spool/fax, you can customise your system to do something intelligent, like send you an email, or print it out.


fax view

The fax view FileName commamd firstly converts the text or the postscript file to g3 pixel images called FileName.001, then it calls efix to convert the g3 files so that xv or xloadimage can view them.

When you have a pixel image, either ready for sending, or just received, you want to look at it, to see that it is OK. If you have a 'real' fax machine (as in real slow, they're all 9600 not 14400), simply send it and look.

The answer is to use xloadimage or viewfax (or something else) but before I found the best, I had to do some experimenting to see. Here are a few things you can try, just for the sake of something to do ;-)

See alse viewfax, and the utilities with mgetty.

efix -o pbm -n fax_out.pbm fax_out.001

efax(1) comes with efix(1), a convertor tool. There are others in the netpbm distribution, and also in the mgetty+sendfax compendium of add-ons. It can convert to different formats, which may or may not please you.

Do these experiments in the /tmp directory, and delete them later. You should have your own fax_out.001 from the above commands.

efix -o pbm -n fax_out.pbm fax_out.001

This converted the 20k g3 file, to a 500k pbm. If you don't want to collect lots of .pbm files, you can use the .pbm file format, but don't store it on disk, just pipe it to your preferred viewer's stdin.

xv fax_out.pbm

xv displays the 1728 x 2287 pbm in a 'lossy' way, the g3 file is OK, the pmb file is OK, the xv display is fuzzy. XV refuses to display huge images at full size, (to scroll them), so it shrinks them.

xloadimage fax_out.pbm

This shows that the fonts are crystal clear, which may be too high a resolution for the viewer. Unfortunately I couldn't get xloadimage to read the fax_out.001 file directly, it said the format was not recognised. ie the efix program is needed to convert the file formats. (That's what happens when you call /usr/bin/fax view, and it calls xloadimage)

The same effect happens when efix outputs a .pgm. Its because everbody's library code decimates by 4 (half width, half height) and in the process it doesn't know whether to preserve '0's or '1's and the library code drops pixels and lines somewhere.

efix -o pbm fax_out.001 | xloadimage stdin

This is the hottest FAX viewer in town!

Actually, it isn't, the viewfax utility is much more convenient, as it can move between more than one page, and zoom in and out using the mouse, however it is a custom tool, whereas efix and xloadimage are raw tools. Look in the mgetty collection of support utilities for other options.

efix -o pgm -n fax_out.pgm fax_out.001

This file is a mere 250 K, and the display is worse, it is probaby due to the resolution having taken groups of 4 pixels into grey scales.

/usr/bin/fax view uses pgm as default, this saves switching screen res, but pbm is more readable, albeit bigger than the screen. To avoid creating lots of big .pbm files, I edit /usr/bin/fax to use xloadimage, with the .pbm data travelling through a unix pipe, but not getting stored on the disk.


URGENT! 50 page postscript document to send NOW!

First you have to create your file, probably using a wordprocessor and postscript output to disk. I used Raven-Issue-One.dvi. You can use netscape to convert .html to .ps, or ghostview, or whatever.

dvips ssr01.dvi

Converted ssr01.dvi to ssr01.ps. And much quicker than I expected.

ghostview ssr01.ps &

With X11 running, this confirmed that the file is a valid postscript file, and preview it for formatting problems.

fax make ssr01.ps

created ssr01.ps.052 ie one page per file in g3 format. Typically 50K each.

efix -o pbm fax_out.001 | loadimage stdin

This is a high res fax viewer.

fax send 0123-456-7689 ssr01.ps

Hopefully that worked.

resend pages

If it broke half way, simply delete (mv) the pages that worked ok, and use the fax_out.ps.0?? wildcard to select those that remain. Note that the shell expands the wildcard into multiple names on the command line, so you could just name the file-pages you want, the fax command looks at each parameter word and sends it, but the page-9-of-50 will be all wrong (presumably your document has it's own page numbers, the transmission page number is just an extra).


hi-res lo-res

FAX has two different vertical reolutions (horizontal is a fixed 204 dpi, vertical can be doubled, and page length depends on the machine and paper).

HI-RES	204 x 196  1728 x 2100 # page length arbitrary
LO-RES	204 x  96  1728 x 1000 # eg A4, legal, other

fax make -l ssr01.ps

According to the /usr/bin/fax script, HI-RES is the default. Just to prove a point try adding the -l after fax make, then view as above.

Switching to .pbm for fax view

If you also find that the default .pgm files are unacceptable for detail/readability, you can make .pbm your default viewer, by editing the /usr/bin/fax script.

Of course when the xxx2pgm library is fixed, you may wish to change it back.

Viewing postscript pictures

Whilst playing, look in /usr/lib/ghostscript/examples for pages to convert, view or even send. fax make converts plain text itself (useful for a new-built system) but for postscript files, it calls ghostscript to do the conversion. This shows how colour pictures get converted, and how pgm is OK for graphics, but not for text.

Normally you use ghostview to view postscript files. Using faxview instead is just an experimental toy, to show you how ghostscript gets used automatically.


This untars to it's own relative dir. It's got it's own license. All the docs are in (or start at) ./doc/mgetty.texti-in, including documentation for packages such as voice support.

Basically you have many options to configure, either in /etc/inittab, or pre-compiled into the binary.

mgetty is probably better for incoming calls, especially for 24-hour sites with caller-id or even a voice-modem, but it can generate a lot of log-files, and be a bit much to configure in a hurry. efax if nice for light use at home.