unstrip-downed Class 2 error messages table
[efax.git] / efax.1
1 .TH EFAX 1 "February 1999" ""  ""
2 .UC 1
3 .SH NAME
4 efax \- send/receive faxes with Class 1, 2 or 2.0 fax modem
5
6 .ce 1
7 (Please read the \fBfax\fP man page first.)
8 .SH SYNOPSIS
9
10 .B efax
11 [
12 \fIoptions\fP
13 ]
14 [
15 \fB-t\fP \fInum\fP [ \fIfile\fP... ]
16 ]
17
18 .SH OPTIONS
19 Where \fIoptions\fP are:
20
21 .TP 9
22 .B -a \fIcmd\fP
23 use the command \fBATcmd\fP when answering the phone.  The
24 default is "A".
25
26 .TP 9
27 .B -c \fIcaps\fP
28 set the local modem capabilities.  See the section on
29 capabilities below for the format and meaning of \fIcaps\fP.  For
30 Class 1 the default is 1,n,0,2,0,0,0,0 where n is the highest
31 speed supported by the modem.  For Class 2 the default is
32 determined by the modem.
33
34 .TP 9 
35 .B -d \fIdev\fP 
36 use the fax modem connected to device \fIdev\fP.  The default is
37 \fB/dev/modem\fP.  
38
39 .TP 9
40 .B -f \fIfnt\fP
41 use font file \fIfnt\fP for generating the header.  The default
42 is a built-in 8x16 font.  See the efix(1) -f option for the font
43 file format.
44
45 .TP 9
46 .B -g \fIcmd\fP
47 if a \fBCONNECT\fP (or \fBDATA\fP) response indicates a data
48 call, the shell \fB/bin/sh\fP is exec(2)'ed with \fIcmd\fP as its
49 command.  \fIcmd\fP is a printf(3) format that may contain up to
50 6 %d escapes which are replaced by the baud rate following the
51 most recent \fBCONNECT\fP message. \fIcmd\fP typically exec's
52 getty(8).
53
54 .TP 9
55 .B -h \fIhdr\fP
56 put string `hdr' at the top of each page.  The first %d in `hdr'
57 is replaced by the page number and the second, if any, is
58 replaced by the number of pages being sent.
59
60 .TP 9
61 .B -i \fIstr\fP
62 .TP 9
63 .B -j \fIstr\fP
64 .TP 9
65 .B -k \fIstr\fP
66 send the command \fBAT\fP\fIstr\fP to the modem to initialize it.
67 -i commands are sent before the modem is put into fax mode, -j
68 commands after the modem is in fax mode, and -k commands just
69 before efax exits.  The only default is a hang-up (ATH) command
70 that is sent before exiting only if no other -k options are
71 given.  Multiple options may be used.
72
73 .TP 9
74 .B -l \fIid\fP
75 set the local identification string to \fIid\fP.  \fIid\fP should
76 be the local telephone number in international format (for
77 example "+1 800 555 1212").  This is passed to the remote fax
78 machine.  Some fax machines may not accept characters other than
79 numbers, space, and '+'.  
80
81 .TP 9 
82 .B -o \fIopt\fP 
83 use option \fIopt\fP to accommodate a non-standard fax modem
84 protocol.  See the MODEM REQUIREMENTS section below for more
85 details.  The \fIopt\fPions are:
86
87 .TP 9
88 .B 
89     0
90 Force use of Class 2.0 fax modem commands.  The modem must
91 support Class 2.0.
92
93 .TP 9
94 .B 
95     2
96 Force use of Class 2 fax modem commands.  The modem must support
97 Class 2.
98
99 .TP 9
100 .B 
101     1 
102 Force use of Class 1 fax modem commands. The modem must support
103 Class 1.  By default efax queries the modem and uses the first of
104 the three above classes which is supported by the modem.
105
106 .TP 9
107 .B 
108     a
109 use software adaptive answer method.  If the first attempt to
110 answer the call does not result in a data connection within 8
111 seconds the phone is hung up temporarily and answered again in
112 fax mode (see "Accepting both fax and data calls" below).
113
114 .TP 9
115 .B 
116     e 
117 ignore errors in modem initialization commands.
118
119 .TP 9
120 .B 
121     f
122 use "virtual flow control".  efax tries to estimate the number of
123 bytes in the modem's transmit buffer and pauses as necessary to
124 avoid filling it.  The modem's buffer is assumed to hold at least
125 96 bytes.  This feature does not work properly with Class 2
126 modems that add redundant padding to scan lines.  Use this option
127 only if you have problems configuring flow control.
128
129 .TP 9
130 .B 
131     h 
132 use hardware (RTS/CTS) in addition to software (XON/XOFF) flow
133 control.  Many modems will stop responding if this option is
134 used.  See the section `Resolving Problems' before using this
135 option.
136
137 .TP 9
138 .B 
139     l
140 halve the time between testing lock files when waiting for other
141 programs to complete.  By default this is 8 seconds. For example
142 -olll sets the interval to 1 second.
143
144 .TP 9
145 .B 
146     n
147 ignore requests for pages to be retransmitted. Use this option if
148 you don't care about the quality of the received fax or if the
149 receiving machine is too fussy.  Otherwise each page may be
150 retransmitted up to 3 times.
151
152 .TP 9
153 .B 
154     r
155 do not reverse bit order during data reception for Class 2
156 modems.  Only Multitech modems require this option. Not normally
157 required since efax detects these modems.
158
159 .TP 9
160 .B 
161     x
162 send XON (DC1) instead of DC2 to start data reception.  Applies
163 to a very few Class 2 modems only.
164
165 .TP 9
166 .B 
167     z
168 delay an additional 100 milliseconds before each modem
169 initialization or reset command.  The initial delay is 100
170 ms. For example, -ozzz produces a 400 ms delay.  Use with modems
171 that get confused when commands arrive too quickly.
172
173
174 .TP 9
175 .B -q \fIn\fP
176 ask for retransmission of pages received with more than \fIn\fP
177 errors.  Default is 10.
178
179 .TP 9
180 .B -r \fIpat\fP
181 each received fax page is stored in a separate file.  The file
182 name is created using \fIpat\fP as a strftime(3) format string.
183 A page number of the form .001, .002, ...  is appended to the
184 file name.  If \fIpat\fP is blank ("") or no -r option is given a
185 default string of "%m%d%H%M%S" is used.
186
187 .\" If a file already exists, efax terminates with an error.
188
189 .TP 9
190 .B -s
191 remove lock file(s) after initializing the modem.  This allows
192 outgoing calls to proceed when efax is waiting for an incoming
193 call.  If efax detects modem activity it will attempt to re-lock
194 the device.  If the modem has been locked by the other program
195 efax will exit and return 1 (``busy'').  Normally a new efax
196 process is then started by init(8). The new efax process will
197 then check periodically until the lock file disappears and
198 then re-initialize the modem.
199
200 .TP 9 
201 .B -t \fInum [file\fP...]  
202 dial telephone number \fInum\fP and send the fax image files
203 \fIfile\fP....  If used, this must be the last argument on the
204 command line.  The telephone number \fInum\fP is a string that
205 may contain any dial modifiers that the modem supports such as a
206 T prefix for tone dialing or commas for delays.  If no file names
207 are given the remote fax machine will be polled. If no -t
208 argument is given efax will answer the phone and attempt to
209 receive a fax.
210
211 .TP 9
212 .B -v \fIstrng\fP
213 select types of messages to be printed.  Each \fIlower-case\fP
214 letter in \fIstrng\fP enables one type of message:
215
216 .RS 12
217 .B
218 e - 
219 errors
220 .br
221 .B
222 w - 
223 warnings
224 .br
225 .B
226 i - 
227 session progress information
228 .br
229 .B
230 n - 
231 capability negotiation information
232 .br
233 .B
234 c - 
235 modem (AT) commands and responses
236 .br
237 .B
238 h - 
239 HDLC frame data (Class 1 only)
240 .br
241 .B
242 m - 
243 modem output
244 .br
245 .B
246 a - 
247 program arguments
248 .br
249 .B
250 r -
251 reception error details
252 .br
253 .B
254 t -
255 transmission details
256 .br
257 .B
258 f -
259 image file details 
260 .br
261 .B
262 x -
263 lock file processing
264
265 .RE
266 .RS 9
267 Up to two -v options may be used.  The first is for messages
268 printed to the standard error and the second is for messages to
269 the standard output. The default is "ewin" to the standard error
270 only.
271 .RE
272
273 .TP 9
274 .B -w
275 wait for an OK or CONNECT prompt instead of issuing an answer
276 (\fBATA\fP) command to receive a fax.  Use this option when the
277 modem is set to auto-answer (using S0=\fIn\fP) or if another
278 program has already answered the call.
279
280 .TP 9
281 .B -x \fIlkf\fP
282 use a UUCP-style lock file \fIlkf\fP to lock the modem device
283 before opening it.  If the device is locked, efax checks every 15
284 seconds until it is free.  Up to 16 -x options may be used if
285 there are several names for the same device.  A `#' prefix on the
286 file name creates an binary rather than text (HDB-style) lock
287 file.  This is the reverse of what was used by previous efax
288 versions.
289
290 .SH FAX FILE FORMATS
291
292 efax can read the same types of files as \fBefix(1)\fP including
293 text, T.4 (Group 3), PBM, single- and multi-page TIFF (G3 and
294 uncompressed).  efax automatically determines the type of file
295 from its contents.  TIFF files are recommended as they contain
296 information about the image size and resolution.
297
298 Each page to be sent should be converted to a separate TIFF
299 format file with Group 3 (G3) compression.  Received files are
300 also stored in this format.  The EXAMPLES section below shows how
301 efix and other programs can be used to create, view and print
302 these files.
303
304 .SH OPERATING SYSTEM REQUIREMENTS
305
306 The operating system must provide short response times to avoid
307 protocol timeouts.  For Class 2 and 2.0 modems the delay should
308 not exceed 1 or 2 seconds.
309
310 When using Class 1 modems the program must respond to certain
311 events within 55 milliseconds.  Longer delays may cause the fax
312 protocol to fail in certain places (between DCS and TCF or
313 between RTC and MPS).  Class 1 modems should therefore not be
314 used on systems that cannot guarantee that the program will
315 respond to incoming data in less than 55 milliseconds.  In
316 particular, some intelligent serial cards and terminal servers
317 may introduce enough delay to cause problems with Class 1
318 operation.
319
320 The operating system must also provide sufficient low-level
321 buffering to allow uninterrupted transfer of data between the
322 modem and a disk file at the selected baud rate, typically 9600
323 bps.  Since the fax protocol does not provide end-to-end flow
324 control the effectiveness of flow control while receiving is
325 limited by the size of the modem's buffer. This can be less than
326 100 bytes.  Efax does not use flow control during reception.
327
328 .SH MODEM REQUIREMENTS
329
330 The "Group" is the protocol used to send faxes between fax
331 machines.  Efax supports the Group 3 protocol used over the
332 public telephone network.
333
334 The "Class" is the protocol used by computers to control fax
335 modems.  Efax supports Class 1, 2 and 2.0 fax modems.
336
337 Most fax modems use XON/XOFF flow control when in fax mode.  This
338 type of flow control adds very little overhead for fax use. Many
339 modems have unreliable hardware (RTS/CTS) flow control in fax
340 mode.  By default efax enables only XON/XOFF flow control and the
341 -oh option must be used to add hardware flow control.
342
343 While some modems have serial buffers of about 1k bytes, many
344 inexpensive modems have buffers of about one hundred bytes and
345 are thus more likely to suffer overruns when sending faxes.
346
347 A few older modems may need a delay between commands of more than
348 the default value used by efax (100 milliseconds).  If the delay
349 is too short, commands may not echo properly, may time out, or
350 may give inconsistent responses.  Use one or more \fB-oz\fP
351 options to increase the delay between modem initialization
352 commands and use the E0 modem initialization command to disable
353 echoing of modem commands.
354
355 By default efax sends DC2 to start the data flow from the modem
356 when receiving faxes from Class 2 modems.  A few older modems
357 require XON instead.  Use of DC2 would cause the modem to give an
358 error message and/or the program to time out.  The \fB-ox\fP
359 option should be used in this case.
360
361 A few older Class 2 modems (e.g. some Intel models) don't send
362 DC2 or XON to start the data flow to the modem when sending
363 faxes.  After waiting 2 seconds efax will print a warning and
364 start sending anyways.
365
366 A very few Class 2 modems do not reverse the bit order (MSB to
367 LSB) by default on receive.  This might cause errors when trying
368 to display or print the received files.  The \fB-or\fP option can
369 be used in this case.
370
371 Some inexpensive "9600 bps" fax modems only \fItransmit\fP at
372 9600 bps and reception is limited to 4800 bps.
373
374 The following Class 1 modems have been reported to work with efax:
375 AT&T DataPort,
376 .\" Andrea Gozzi <work@forum.sublink.org>, v0.6, SCO 3.2.0, (Class 1)
377 Cardinal Digital Fax Modem (14400),
378 .\" awk0%navajo@gte.com, v0.6, linux 1.0, downloading fax144c.car
379 Digicom Scout+,
380 .\" umlin000@CC.UManitoba.CA, v 0.6, Linux 1.1.12
381 Motorola Lifestyle 28.8,
382 .\" mortbay@ozemail.com.au
383 Motorola Power 28.8,
384 .\" danz@wv.mentorg.com, Linux 1.2.10
385 QuickComm Spirit II,
386 .\" umlin000@CC.UManitoba.CA, v 0.6, Linux 1.1.12
387 .\" gsmith@softsmiths.oz.au, v 0.7a, add "*F1" for Xon/Xoff
388 Smartlink 9614AV-Modem,
389 .\" gt@sky.gun.de, v0.6, Linux 1.1.15
390 Supra Faxmodem 144LC,
391 .\" john@johncon.johncon.com, v0.6, Consensys (ie., Unixware) 4.2
392 USR Courier V.32bis Terbo,
393 .\" meyer@geomatic.no, v0.6, SunOS 4.1.3
394 USR Sportster (V.32 and V.34),
395 .\" satyr!kayvan@apple.com (Kayvan Sylvan), v0.6, Linux (?)
396 Zoom AFC 2.400,
397 .\" hausutzu@pse.panic.bln.sub.org (Utz-Uwe Haus), v0.6, Linux
398 Zoom VFX14.4V.
399 .\" edc@ee.ubc.ca (me!), v0.6, Linux
400
401 The following Class 2 modems have been reported to work with efax:
402 14k4 Amigo Communion fax/modem,
403 .\" bekker@tn.utwente.nl, efax0.5
404 Adtech Micro Systems 14.4 Fax/modem,
405 .\" gmaughan@grape.fcit.monash.edu.au, Linux 1.2.10, efax 07a
406 askey modem type 1414VQE,
407 .\" thowi@chiba.escape.de, efax06?, Linux?
408 AT&T DataPort,
409 .\" ingber@alumni.caltech.edu (Class 2)
410 ATT/Paradyne,
411 .\" john@johncon.johncon.com
412 AT&T Paradyne PCMCIA,
413 .\" jh@datanet.tele.fi (Juha Heinanen)
414 Boca modem,
415 .\" ?
416 BOCA M1440E, 
417 .\" v0.6a, SunOS 4.1.1, Linux 1.0.9
418 .\" hsw1@papa.attmail.com
419 Crosslink 9614FH faxmodem,
420 .\" ?
421 FuryCard DNE 5005,
422 .\" a PCMCIA Class 3 faxmodem
423 .\" ron@draconia.hacktic.nl
424 GVC 14.4k internal,
425 .\" jchen@ee.mcgill.ca, 0.6a w/ stty fax patch, Linux kernel 1.1.59
426 Intel 14.4 fax modem,
427 .\" (matloff@cs.ucdavis.edu)
428 Megahertz 14.4,
429 ,\" norman@bellcore.com
430 Microcom DeskPorte FAST ES 28.8,
431 .\" Skip Montanaro (skip@automatrix.com), 0.6a, Linux
432 Motorola UDS FasTalk II,
433 .\" Raj Mathur (root@darbari.ncst.ernet.in), 0.6a, Linux 1.1.48
434 MultiTech 1432MU,
435 .\"reb@pdsf.ssc.gov
436 Practical Peripherals PM14400FXMT,
437 .\" (DEC Alpha AXP 3000/500 running OSF/1 V1.3)
438 Supra V32bis,
439 .\" john@johncon.johncon.com, v0.5b, SysV R4.2
440 .\" tbucks!timothy@csn.org
441 .\" (ROCKWELL)
442 .\" Alec.Muffett@UK.Sun.COM (Alec Muffett), Linux 1.1.51, 
443 .\"  Supra FAXModem v.32bis
444 Telebit Worldblazer,
445 .\" blurfl!jhood@Dartmouth.EDU
446 .\" Telebit Worldblazer with ROM version LA7.02. (requires -or)
447 .\" (my configuration required hardware flow control)
448 .\" Dario_Ballabio@milano.europe.dg.com, v 0.6, Version LA7.05C.  
449 TKR DM-24VF+,
450 .\" rainer.dorsch@student.uni-ulm.de
451 Twincom 144/DFi,
452 .\" (ROCKWELL, V.32AC, V1.270 TR14-Jxxx-001)
453 ViVa 14.4/Fax modem,
454 .\" Robert.Sprockeels@csc.be, v0.6a, Linux
455 Vobis Fax-Modem (BZT-approved),
456 .\" klein@pc-klein.zxa.basf-ag.de (Peter Klein), Linux, kernel 0.99.14
457 .\" beck@irs.inf.tu-dresden.de (Andre Beck), v 0.6, Ultrix 4.3, gcc V2.5.8:
458 .\" gcc -ansi -D_XOPEN_SOURCE -O2 efax.c -o efax -lcP
459 Zoom VFX14.4V,
460 .\" edc@ee.ubc.ca (me!), v0.6, Linux
461 ZyXEL U-1496E[+], 
462 .\" plph@umcc.umich.edu, v0.3 & faxmodem ROM version 5.05M)
463 .\" requires -or
464 .\" Marc@Synergytics.Com, v0.5a & ZyXEL 1496E Plus, ROM Version 6.11a)
465 .\" -or -i '+FCLASS=2;+FCR=1' -c '+FDCC=1,5,2,2,0,0,0,0'
466 ZyXEL Elite 2864I.
467 .\" schlatt@dial.eunet.ch, v0.7a, using -Xn (n<4)
468
469 .SH MODEM INITIALIZATION OPTIONS
470
471 The required modem initialization commands are generated by efax.
472 Additional commands may be supplied as command-line arguments.
473 The modem must be set up to issue verbose(text) result codes.
474 The following command does this and is sent by efax before trying
475 to initialize the modem.
476
477 .TP 9
478 .BR Q0V1
479 respond to commands with verbose result codes
480
481 .PP
482 The following commands may be useful for special purposes:
483
484 .TP 9 
485 .BR X3 
486 don't wait for dial tone before dialing.  This may be used to
487 send a fax when the call has already been dialed manually.  In
488 this case use an empty string ("") as the first argument to the
489 \fB-t\fP command.  Use \fBX4\fP (usual default) to enable all
490 result codes.
491
492 .TP 9 
493 .BR M2
494 leave the monitor speaker turned on for the duration of the call
495 (use \fBM0\fP to leave it off).
496
497 .TP 9 
498 .BR L0
499 turn monitor speaker volume to minimum (use \fBL3\fP for maximum).
500
501 .TP 9 
502 .BR E0 
503 disable echoing of modem commands.  See the Resolving Problems
504 section below.
505
506 .TP 9 
507 .BR &D2
508 returns the modem to command mode when DTR is dropped.  The
509 program drops DTR at the start and end of the call if it can't
510 get a response to a modem command.  You can use \fB&D3\fP to
511 reset the modem when DTR is dropped.
512
513 .TP 9
514 .BR S7=120
515 wait up to two minutes (120 seconds) for carrier.  This may be
516 useful if the answering fax machine takes a long time to start
517 the handshaking operation (e.g. a combined fax/answering machine
518 with a long announcement).
519
520 .SH CAPABILITIES
521
522 The capabilities of the local hardware and software can be set
523 using a string of 8 digits separated by commas:
524
525 .BR  \fIvr\fP,\fIbr\fP,\fIwd\fP,\fIln\fP,\fIdf\fP,\fIec\fP,\fIbf\fP,\fIst\fP
526
527 where:
528
529 .TP 9
530 .I vr \fP (vertical resolution) =
531 0 for 98 lines per inch
532 .br
533 1 for 196 lpi
534
535 .TP 9
536 .I br \fP (bit rate) =
537 0 for 2400 bps
538 .br
539 1 for 4800
540 .br
541 2 for 7200
542 .br
543 3 for 9600
544 .br
545 4 for 12000 (V.17)
546 .br
547 5 for 14400 (V.17)
548
549 .TP 9
550 .I wd \fP (width) =
551 0 for 8.5" (21.5 cm) page width
552 .br
553 1 for 10" (25.5 cm)
554 .br
555 2 for 12" (30.3 cm)
556
557 .TP 9
558 .I ln  \fP (length) =
559 0 for 11" (A4: 29.7 cm) page length
560 .br
561 1 for 14" (B4: 36.4 cm)
562 .br
563 2 for unlimited page length
564
565 .TP 9
566 .I df \fP (data format) =
567 0 for 1-D coding
568 .br
569 1 for 2-D coding (not supported)
570
571 .TP 9
572 .I ec  \fP (error correction) =
573 0 for no error correction
574 .\" .br
575 .\" 1 for EC mode with 64 byte frames (not supported)
576 .\" .br
577 .\" 2 for EC mode with 256 byte frames (not supported)
578
579 .TP 9
580 .I bf \fP (binary file) =
581 0 for no binary file transfer
582
583 .TP 9
584 .I st  \fP (minimum scan time) =
585 0 for zero delay per line
586 .br
587 1 for 5 ms per line
588 .br
589 3 for 10 ms per line
590 .br
591 5 for 20 ms per line
592 .br
593 7 for 40 ms per line
594
595 .PP
596
597 When \fIreceiving\fP a fax the \fIvr\fP, \fIwd\fP, and \fIln\fP
598 fields of the capability string should be set to the maximum
599 values that your display software supports.  The default is 196
600 lpi, standard (8.5"/21.5cm) width and unlimited length.
601
602 When \fIsending\fP a fax efax will determine \fIvr\fP and
603 \fIln\fP from the image file and set \fIwd\fP to the default.
604
605 If the receiving fax machine does not support high resolution
606 (\fIvr\fP=1) mode, efax will reduce the resolution by combining
607 pairs of scan lines.  If the receiving fax machine does not
608 support the image's width then efax will truncate or pad as
609 required. Most fax machines can receive \fIln\fP up to 2.  Few
610 machines support values of \fIwd\fP other than 0.
611
612
613 .SH HEADERS
614
615 efax adds blank scan lines at the top of each image when it is
616 sent.  This allows room for the page header but increases the
617 length of the image (by default about 0.1" or 2.5mm of blank
618 space is added).
619
620 The header placed in this area typically includes the date and
621 time, identifies the, and shows the page number and total pages.
622 Headers cannot be disabled but the header string can be set to a
623 blank line.
624
625 The default font for generating the headers is the built-in 8x16
626 pixel font scaled to 12x24 pixels (about 9 point size).
627
628 Note that both efax and efix have -f options to specify the font.
629 efIx uses the font to generate text when doing text-to-fax
630 conversions (during "fax make") while efAx uses the font to
631 generate the header (during "fax send").
632
633 .SH SESSION LOG
634
635 A session log is written to the standard error stream.  This log
636 gives status and error messages from the program as selected by
637 the \fB-v\fP option. A time stamp showing the full time or just
638 minutes and seconds is printed before each message.  Times
639 printed along with modem responses also show milliseconds.
640
641 .SH RETURN VALUES
642
643 The program returns an error code as follows:
644
645 .TP 9
646 0
647 The fax was successfully sent or received.
648
649 .TP 9
650 1
651 The dialed number was busy or the modem device was in use.  Try
652 again later.
653
654 .TP 9
655 2
656 Something failed (e.g. file not found or disk full). Don't retry.
657 Check the session log for more details.
658
659 .TP 9
660
661 Modem protocol error.  The program did not receive the expected
662 response from the modem.  The modem may not have been properly
663 initialized, the correct \fB-o\fP options were not used, or a bug
664 report may be in order.  Check the session log for more details.
665
666 .TP 9
667 4
668 The modem is not responding.  Operator attention is required.
669 Check that the modem is turned on and connected to the correct
670 port.
671
672 .TP 9
673 5
674 The program was terminated by a signal.
675
676 .SH EXAMPLES
677
678 .B Creating fax (G3) files
679
680 The efix program can be used to convert text files to TIFF-G3
681 format.  For example, the following command will convert the text
682 file \fBletter\fP to the files \fBletter.001\fP,
683 \fBletter.002\fP, etc,:
684
685 .IP
686 .nf
687 .ft CW
688 efix -nletter.%03d letter
689 .ft P
690 .fi
691 .LP
692
693 Ghostscript's \fBtiffg3\fP driver can generate fax files in
694 TIFF-G3 format from postscript files.  For example, the command:
695
696 .IP
697 .nf
698 \f(CW gs -q -sDEVICE=tiffg3 -dNOPAUSE \\
699         -sOutputFile=letter.%03d letter.ps </dev/null\fP
700 .fi
701 .LP
702
703 will convert the Postscript file
704 .BR letter.ps
705 into high-resolution
706 (\fIvr\fP=1) G3 fax image files \fBletter.001, letter.002,\fP ...
707
708 The images should have margins of at least 1/2 inch (1 cm) since
709 the fax standard only requires that fax machines print a central
710 portion of the image 196.6mm (7.7 inches) wide by 281.5mm (11.1
711 inches) high.
712
713 The efix program can also insert bitmaps in images to create
714 letterhead, signatures, etc.
715
716 .B Printing fax files
717
718 You can use the efix program to print faxes on Postscript or
719 HP-PCL (LaserJet) printers.  For example, to print the received
720 fax file \fBreply.001\fP on a Postscript printer use the command:
721
722 .IP
723 .nf
724 .ft CW
725 efix -ops reply.001 | lpr
726 .ft P
727 .fi
728 .LP
729
730 .B Sending fax files
731
732 The following command will dial the number 222-2222 using tone
733 dialing and send a two-page fax from the TIFF-G3 files letter.001
734 and letter.002 using the fax modem connected to device /dev/cua1.
735
736 .IP
737 .nf
738 .ft CW
739 efax -d /dev/cua1 \\
740      -t T222-2222 letter.001 letter.002
741 .ft P
742 .fi
743 .LP
744
745 .B Manual answer
746
747 You can use efax to answer the phone immediately and start fax
748 reception.  Use this mode if you need to answer calls manually to
749 see if they are fax or voice.
750
751 For example, the following command will make the fax modem on
752 device \fB/dev/ttyS1\fP answer the phone and attempt to receive a
753 fax.  The received fax will be stored in the files
754 \fBreply.001\fP, \fBreply.002\fP, and so on.  The modem will
755 identify itself as "555 1212" and receive faxes at high or low
756 resolution (\fIvr\fP=1), at up to 14.4 kbps (\fIbr\fP=5).
757
758 .IP
759 .nf
760 .ft CW
761 efax -d /dev/ttyS1 -l "555 1212" \\
762    -c 1,5 -r reply
763 .ft P
764 .fi
765 .LP
766
767 .B Automatic answer
768
769 The \fB-w\fP option makes efax wait for characters to become
770 available from the modem (indicating an incoming call) before
771 starting fax reception.  Use the \fB-w\fP option and a
772 \fB-i\fPS0=\fIn\fP option to answer the phone after \fIn\fP
773 rings.  The example below will make the modem answer incoming
774 calls in fax mode on the fourth ring and save the received faxes
775 using files names corresponding to the reception date and time.
776
777 .IP
778 .nf
779 .ft CW
780 efax -d /dev/ttyb -w -iS0=4 2>&1 >> fax.log
781 .ft P
782 .fi
783 .LP
784
785 .B Sharing the modem with outgoing calls
786
787 The modem device can be shared by programs that use the UUCP
788 device locking protocol.  This includes pppd, chat, minicom,
789 kermit, uucico, efax, cu, and many others others.  However,
790 locking will only work if all programs use the same lock file.
791
792 efax will lock the modem device before opening it if one or more
793 UUCP lock file names are given with \fB-x\fP options.  Most
794 programs place their lock files in the \fR/usr/spool/uucp\fP or
795 \fR/var/lock\fP directories and use the name \fRLCK..\fP\fIdev\fP
796 where \fIdev\fP is the name of the device file in the /dev
797 directory that is to be locked.
798
799 If the \fB-s\fP (share) option is used, the lock file is removed
800 while waiting for incoming calls so other programs can use the
801 same device.
802
803 If efax detects another program using the modem while it is
804 waiting to receive a fax, efax exits with a termination code of
805 1.  A subsequent efax process using this device will wait until
806 the other program is finished before re-initializing the modem
807 and starting to wait for incoming calls again.
808
809 Programs that try to lock the modem device by using device
810 locking facilities other than UUCP lock files not be able to use
811 this arbitration mechanism because the device will still be open
812 to the efax process.  In this case you will need to kill the efax
813 process (e.g. "fax stop") before starting the other program.
814
815 When efax is waiting for a fax it leaves the modem ready to
816 receive in fax mode but removes the lock file.  When a slip or
817 PPP program takes over the modem port by setting up its own lock
818 file efax cannot send any more commands to the modem -- not even
819 to reset it.  Therefore the other program has to set the modem
820 back to data mode when it starts up.  To do this add a modem
821 reset command (send ATZ expect OK) to the beginning of your slip
822 or PPP chat script.
823
824 .B Accepting both fax and data calls
825
826 Many modems have an adaptive data/fax answer mode that can be
827 enabled using the \fB-j+FAE=1\fP (for Class 1) or \fB-jFAA=1\fP
828 (for Class 2[.0]) initialization string.  The type of call (data
829 or fax) can then be deduced from the modem's responses.
830
831 Some modems have limited adaptive answer features (e.g. only
832 working properly at certain baud rates or only in Class 2) or
833 none at all.  In this case use the initialization string
834 \fB-i+FCLASS=0\fP to answer in data mode first and the \fB-oa\fP
835 option to then hang up and try again in fax mode if the first
836 answer attempt was not successful.  This method only works if
837 your telephone system waits a few seconds after you hang up
838 before disconnecting incoming calls.
839
840 If the \fB-g\fP option is used then the option's argument will be
841 run as a shell command when an incoming data call is detected.
842 Typically this command will exec \fBgetty\fP(8).  This program
843 should expect to find the modem already off-hook and a lock file
844 present so it should not try to hang up the line or create a lock
845 file.  Note that the modem should be set up to report the DCE-DTE
846 (modem-computer, e.g. CONNECT 38400) speed, not the DCE-DCE
847 (modem-modem, e.g. CONNECT 14400) speed.  For many modems the
848 initialization option -iW0 will set this.
849
850 The following command will make efax answer incoming calls on
851 \fB/dev/cua1\fP on the second ring.  This device will be locked
852 using two different lock files but these lock files will be
853 removed while waiting for incoming calls (\fB-s\fP).  If a data
854 call is detected, the \fBgetty\fP program will be run to
855 initialize the terminal driver and start a \fBlogin\fP(1)
856 process.  Received fax files will be stored using names like
857 \fBDec02-12.32.33.001\fP, in the \fB/usr/spool/fax/incoming\fP
858 directory and the log file will be appended to
859 \fB/usr/spool/fax/faxlog.cua1\fP.
860
861 .IP
862 .nf
863 .ft CW
864 efax -d /dev/cua1  -j '+FAA=1' \\
865    -x /usr/spool/uucp/LCK..cua1 \\
866    -x /usr/spool/uucp/LCK..ttyS1 \\
867    -g "exec /sbin/getty -h /dev/cua1 %d" \\
868    -iS0=2 -w -s \\
869    -r "/usr/spool/fax/incoming/%b%d-%H.%I.%S" \\
870    >> /usr/spool/fax/faxlog.cua1 2>&1
871 .ft P
872 .fi
873 .LP
874
875 Note that adaptive answer of either type will not work for all
876 callers.  For some data calls the duration of the initial
877 data-mode answer may be too short for data handshaking to
878 complete.  In other cases this duration may be so long that
879 incoming fax calls will time out before efax switches to fax
880 mode.  In addition, some calling fax modems mistake data-mode
881 answering tones for fax signaling tones and initiate fax
882 negotiation too soon.  If you use software adaptive answer you
883 can reduce the value of the initial data-mode answer (set by
884 TO_DATAF in efax.c) to get more reliable fax handshaking or
885 increase it for more reliable data handshaking.  However, if you
886 need to provide reliable fax and data service to all callers you
887 should use separate phone numbers for the two types of calls.
888
889 When a call is answered the modem goes on-line with the
890 computer-to-modem baud rate fixed at the speed used for the most
891 recent AT command.  When efax is waiting for a fax or data call
892 it sets the interface speed to 19200 bps since this is the speed
893 required for fax operation.  This prevents full use of 28.8kbps
894 modem capabilities.
895
896
897 .SH USING INIT TO RUN EFAX
898
899 efax can answer all incoming calls if you place an entry for efax
900 in \fB/etc/inittab\fP (for SysV-like systems) or
901 \fB/etc/ttytab\fP (for BSD-like systems). The \fBinit\fP(8)
902 process will run a new copy of efax when the system boots up and
903 whenever the previous efax process terminates.  The inittab or
904 ttytab entry should invoke efax by running the \fBfax\fP script
905 with an \fBanswer\fP argument.
906
907 For example, placing the following line in \fB/etc/inittab\fP
908 (and running "kill -1 1") will make init run the \fBfax\fP script
909 with the argument \fBanswer\fP every time previous process
910 terminates and \fBinit\fP is in runlevel 4 or 5.
911
912 .IP
913 .nf
914 .ft CW
915 s1:45:respawn:/bin/sh /usr/bin/fax answer
916 .ft P
917 .fi
918 .LP
919
920 For BSD-like systems (e.g. SunOS), a line such as the following
921 in \fB/etc/ttytab\fP will have the same effect:
922
923 .IP
924 .nf
925 .ft CW
926 ttya "/usr/local/bin/fax answer" unknown on
927 .ft P
928 .fi
929 .LP
930
931 You should protect the fax script and configuration files against
932 tampering since init will execute them as a privileged (root)
933 process.  If you will be allowing data calls via getty and login
934 you should ensure that your system is reasonably secure
935 (e.g. that all user id's have secure passwords).
936
937 If efax exec()'s getty properly but you get a garbled login
938 prompt then there is probably a baud rate mismatch between the
939 modem and the computer.  First, check the efax log file to make
940 sure the modem's CONNECT response reported the serial port speed
941 (e.g. 19200), \fBnot\fP the modem-modem speed (e.g. 14400).
942 Next, check the getty options and/or configuration files
943 (e.g. /etc/gettydefs) for that particular baud rate.  Then run
944 getty manually with the same arguments and verify the port
945 settings using ``stty </dev/XXX''.  Note that you'll probably
946 want to enable hardware flow control for data connections (-h for
947 agetty, CRTSCTS for getty_ps).
948
949 A few programs won't work properly when efax is set up to answer
950 calls because they don't create lock files.  You can put the
951 shell script ``wrapper'' below around such programs to make them
952 work properly.  Change BIN and LOCKF to suit.
953
954 .IP
955 .nf
956 .ft CW
957 #!/bin/sh
958 BIN=/bin/badprogram
959 LOCKF=/var/spool/uucp/LCK..cua1
960 if [ -f $LOCKF ]
961 then
962         echo lock file $LOCKF exists
963         exit 1
964 else
965         printf "%10d\n" $$ >$LOCKF
966         $BIN $*
967         rm $LOCKF
968 fi
969 .ft P
970 .fi
971 .LP
972
973
974 .SH DELIVERING RECEIVED FAXES BY E-MAIL
975
976 The "fax answer" script described above can be configured to
977 e-mail the fax files received by the previous fax answer process
978 to a "fax manager" who can then forward the fax to the correct
979 recipient.  The received fax files are send as MIME attachments,
980 one file per page, using the ``base64'' text encoding and the
981 ``image/tiff'' file format.
982
983 To view the fax images directly from your e-mail reader you will
984 have to configure it with an application that can display files
985 of type image/tiff.  Typically this is specified in a ``mailcap''
986 file.  For example, placing the following line in /etc/mailcap
987 will cause the fax file attachments to be displayed using the
988 ``fax view'' command.
989
990 .ft CW
991 image/tiff; fax view %s
992 .ft P
993
994 .SH SENDING FAXES USING THE PRINT SPOOLER
995
996 You can configure a "fax" printer into the lpr print spooler that
997 will fax a document out using efax instead of printing it.  This
998 allows a network server running efax to send faxes on behalf of
999 other machines, including non-Unix clients.  In the following
1000 steps use the directories specified in the fax script if they are
1001 different than /usr/bin and /var/spool/fax (FAXDIR).  To set up a
1002 fax printer do the following as root:
1003
1004 (1) Create a link to the fax script called ``faxlpr'' so the fax
1005 script can determine when it is being invoked from the print
1006 spooler:
1007
1008 .ft CW
1009 ln /usr/bin/fax /usr/bin/faxlpr
1010 .ft P
1011
1012
1013 (2) Edit /etc/printcap and add an entry such as:
1014
1015 .IP
1016 .nf
1017 .ft CW
1018 fax:lp=/dev/null:sd=/var/spool/fax:if=/usr/bin/faxlpr:
1019 .ft P
1020 .fi
1021 .LP
1022
1023 to define a printer called "fax".  Print files will be spooled to
1024 the /var/spool/fax (sd=) directory and then piped to the
1025 /usr/bin/faxlpr filter (if=).
1026
1027 (3) Create and/or set the permissions to allow anyone to read and
1028 write in the fax spool directory.  For example:
1029
1030 .IP
1031 .nf
1032 .ft CW
1033 mkdir /var/spool/fax
1034 chmod 777 /var/spool/fax
1035 .ft P
1036 .fi
1037 .LP
1038
1039 (4) Create a printer daemon lock file that is readable by anyone:
1040
1041 .IP
1042 .nf
1043 .ft CW
1044 touch /var/spool/fax/lock
1045 chmod 644 /var/spool/fax/lock
1046 .ft P
1047 .fi
1048 .LP
1049
1050 You should now be able to send a fax using the lpr interface by
1051 using a command such as:
1052
1053 .IP
1054 .nf
1055 .ft CW
1056 lpr -P fax -J "555 1212" file.ps
1057 .ft P
1058 .fi
1059 .LP
1060
1061 where the -J option is used to specify the phone number or alias
1062 to be dialed.
1063
1064 Note that if more than one file is given on the command line they
1065 will be concatenated before being passed to "fax send".  TIFF-G3,
1066 Postscript or PBM files must therefore be sent one file at a time
1067 although TIFF and Postscript files may contain multiple pages.
1068 Only multiple \fItext\fP files can be sent in one command.  Page
1069 breaks in text files can be marked with form-feed characters.
1070 Files will be converted and sent at the default (high)
1071 resolution.
1072
1073 You can use lpq(1) to check the fax queue, lprm(1) to remove fax
1074 jobs and lpc(8) to control the spooler.  In each case use the
1075 -Pfax option to specify the fax ``printer.'' A log file will be
1076 mailed to the user when the fax is sent.
1077
1078 You should also be able to send a fax from any networked computer
1079 that has lpr-compatible remote printing software and that allows
1080 you to set the job name (-J option) to an arbitrary string.  Such
1081 software is available for most computers.
1082
1083 See the lpd(8) and printcap(5) man pages for information on the
1084 print spooler and for restricting access by host name
1085 (/etc/host.lpd) or by user group (the `rg' printcap entry).
1086
1087 .SH RESOLVING PROBLEMS
1088
1089 Double check the configuration setup in the first part of the fax
1090 script, particularly the modem device name and the lock file
1091 names.
1092
1093 If efax hangs when trying to open the modem device (typically
1094 /dev/ttyX), the device is either already in use by another
1095 process (e.g. pppd) or it requires the carrier detect line to be
1096 true before it can be opened.  Many systems define an alternate
1097 device name for the same physical device (typically cuaX) that
1098 can be opened even if carrier is not present or other programs
1099 are already using it.
1100
1101 If responses to modem initialization commands are being lost or
1102 generated at random, another processes (e.g. getty or an efax
1103 auto-answer process) may be trying to use the modem at the same
1104 time.  Try running efax while this other program is running.  If
1105 efax does not report "/dev/ttyX locked or busy. waiting."  then
1106 the lock files names are not specified correctly.
1107
1108 Attempt to send a fax. Check that the modem starts making the
1109 calling signal (CNG, a 0.5 second beep every 3 seconds) as soon
1110 as it's finished dialing.  This shows the modem is in fax mode.
1111 You may need to set the SPKR variable to -iM2L3 to monitor the
1112 phone line to do this.
1113
1114 Listen for the answering fax machine and check that it sends the
1115 answer signal (CED, a 3 second beep) followed by "warbling"
1116 sounds (DIS frames) every 3 seconds.  If you hear a continuous
1117 sound (tones or noise) instead, then you've connected to a data
1118 modem instead.
1119
1120 Your modem should send back its own warble (DCS frame) in
1121 response to DIS immediately followed by 1.5 seconds of noise (a
1122 channel check).  If everything is OK, the receiving end will send
1123 another warble (CFR frame) and your modem will start to send
1124 data.  If you have an external modem, check its LEDs.  If flow
1125 control is working properly the modem's send data (SD) LED will
1126 turn off periodically while the fax data is sent.
1127
1128 Check the message showing the line count and the average bit rate
1129 when the page transmission is done.  Low line counts (under 1000
1130 for a letter size image) or the warning "fax output buffer
1131 overflow" while sending indicate that the image data format is
1132 incorrect. Check the file being sent using the "fax view"
1133 command.
1134
1135 If you get the error message ``flow control did not work'' then
1136 flow control was not active.  This usually results in a garbled
1137 transmission and the receiving machine may reject the page, abort
1138 the call, print a distorted or blank image and/or hang up.
1139
1140 The warning "characters received while sending" or an <XOFF>
1141 character appearing after the transmission means that the
1142 operating system ignored the modem's XOFF flow control character.
1143 Ensure that you are not running other programs such as getty or
1144 pppd at the same time as efax since they will turn off xon/xoff
1145 flow control.
1146
1147 If you cannot get flow control to work properly then enable
1148 ``virtual flow control'' with the \fB-of\fP option or hardware
1149 flow control with the \fB-oh\fP option.
1150
1151 Check that the remote machine confirms reception with a +FPTS:1
1152 response (Class 2) or an MCF frame (Class 1).
1153
1154 For Class 2 modems, the error message "abnormal call termination
1155 (code \fInn\fP)" indicates that the modem detected an error and
1156 hung up.
1157
1158 Many companies advertise services that will fax back information
1159 on their products.  These can be useful for testing fax
1160 reception.
1161
1162 The message "run length buffer overflow" when receiving indicates
1163 an error with the image data format.  You may need to use the
1164 \fB-or\fP option with certain Class 2 modems.
1165
1166 If efax displays the message "can't happen (<details>)" please
1167 send a bug report to the author.
1168
1169 Finally, don't play "option bingo," if you can't resolve the
1170 problem send a verbose log of the failed session (the output from
1171 \fBfax -v ...\fP) to the address below.
1172
1173 .SH WEB PAGE
1174
1175 A Web Page with pointers to the latest version, known bugs and
1176 patches is available at:
1177 .IP
1178 .ft CW
1179 http://casas.ee.ubc.ca/efax/
1180 .ft P
1181 .LP
1182
1183 .SH RELATED SOFTWARE
1184
1185 For Linux Systems
1186
1187 Independent packages provide more user-friendly interfaces to
1188 efax (xfax, tefax) and provide an e-mail-to-fax (Qfax) gateway
1189 using efax. All are available by anonymous FTP from
1190 metalab.unc.edu in /pub/Linux/apps/serialcomm/fax/.
1191
1192 For Amiga Systems
1193
1194 A port of an early version of efax for the Amiga is available as
1195 a component of a shareware voice mail package, AVM, distributed
1196 by Al Villarica (rvillari@cat.syr.edu).
1197
1198 Other Ports
1199
1200 efax is relatively easy to port.  All system-dependent code is in
1201 \fBefaxos.c\fP.  An early version of efax was ported to VMS.
1202 Version 0.8a was ported to Win32 by Luigi Capriotti.  Contact the
1203 author if you would like to integrate the Win32 code into the
1204 current version.
1205
1206 .SH AUTHOR
1207
1208 Efax was written by Ed Casas.  Please send comments or bug
1209 reports to edc@cce.com.
1210
1211 .SH BUG REPORTS
1212
1213 Bug reports should include the operating system, the type of the
1214 modem and a copy of a verbose session log that demonstrates the
1215 problem.  It's usually impossible to help without a verbose log.
1216 Please do \fBnot\fP send fax image files.
1217
1218 .SH COPYRIGHT
1219
1220 efax is copyright 1993 -- 1999 Ed Casas.  It may be used, copied
1221 and modified under the terms of the GNU Public License.
1222
1223 .SH DISCLAIMER
1224
1225 Although \fBefax\fP has been tested it may have errors that will
1226 prevent it from working correctly on your system.  Some of these
1227 errors may cause serious problems including loss of data and
1228 interruptions to telephone service.
1229
1230 .SH REFERENCES
1231
1232 CCITT Recommendation T.30, "Procedures for Document Facsimile
1233 Transmission in the General Switched Telephone Network". 1988
1234
1235 CCITT Recommendation T.4, "Standardization of Group 3 Facsimile
1236 Apparatus for Document Transmission". 1988.
1237
1238 For documentation on Class 1 and Class 2 fax commands as
1239 implemented by Connexant (formerly Rockwell) modems see
1240 http://www.conexant.com/techinfo.
1241
1242 For the TIFF specification see
1243 http://partners.adobe.com/supportservice/devrelations/PDFS/TN/TIFF6.pdf
1244 or RFC 2301 (ftp://ftp.isi.edu/in-notes/rfc2301.txt).
1245
1246 For information on Ghostscript see
1247 http://www.cs.wisc.edu/~ghost/.
1248
1249 The pbm utilities can be obtained by ftp from wuarchive.wustl.edu
1250 in /graphics/graphics/packages/NetPBM/netpbm-1mar1994.tar.gz.
1251
1252 PCX and many other file formats are described in: Gunter Born,
1253 The File Formats Handbook, International Thomson Computer Press,
1254 1995.
1255
1256 The "Fax Modem Source Book" by Andrew Margolis, published by John
1257 Wiley & Sons in 1994 (ISBN 0471950726), is a book on writing fax
1258 applications which includes source code.
1259
1260 Dennis Bodson et. al., "FAX: Digital Facsimile Technology and
1261 Applications", Second Edition. Artech House, Boston. 1992.
1262
1263 .SH SEE ALSO
1264
1265 .BR fax(1),
1266 .BR efix(1),
1267 .BR gs(1),
1268 .BR init(8), 
1269 .BR inittab(5), 
1270 .BR ttytab(5), 
1271 .BR printcap(5),
1272 .BR lpd(8),
1273 .BR printf(3),
1274 .BR strftime(3).
1275
1276 .SH  BUGS
1277
1278 Can't read TIFF files with more than 1 strip
1279
1280 Class 1 operation may fail if the program can't respond to
1281 certain data received from the modem within 55 milliseconds.
1282
1283 May fail if multitasking delays cause the received data to
1284 overflow the computer's serial device buffer or if an under-run
1285 of transmit data exceeds 5 seconds.
1286
1287 Polling does not work.
1288
1289 Does not support 2-D coding, ECM, or BFT.