HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: atz



"Bernd Proissl" <news@proissl.de> writes:

> this is from man config:
> --snip--
>        ModemResetCmds
>               A  string  of commands to issue to the modem during
>               initialization.  This string is sent to  the  modem
>               before  the  standard set of configuration commands
>               required by the fax server.  Note that  these  com­
>               mands should not include normal reset commands that
>               are specified through other parameters.  For  exam­
>               ple,  commands to setup flow control, DCD handling,
>               DTR handling, etc. should be specified through  the
>               appropriate   configuration   parameters   and  not
>               through this parameter.  In addition the soft reset
>               command (usually ``ATZ'') should not be included in
>               this string; the servers issue this command explic­
>               itly.

Soft reset command (ModemSoftReset) is *never* used. The text above have
nothing to do with the reality.

>        ModemResetDelay
>               The time, in milliseconds, to pause after resetting
>               a modem either  by  dropping  the  DTR  signal,  or
>               through  a  software reset command.

Also wrong. In fact, affects DTR drop only.

> This parameter
>               should be long enough to permit the modem to do any
>               reset-related processing it requires.
> --snip--
> 
> 
> this is from Dmitry's new patch:
> --snip--
> 8. Default value for ModemResetCmds is now "ATZ". (ModemSoftResetCmd
> parameter was never used :-)) (faxd/ModemConfig.c++, man/config.4f)
> 
> 9. Unused ModemResetCmd parameter has been deleted. (faxd/ModemConfig.c++)
> --snip--
> 
> 
> this is what i think:
> 
> 1. ModemResetCmd  should send ATZ as a default

There is no such parameter. It's just an alias for ModemResetCmds:
(faxd/ModemConfig.c++)

[---cut---]
} atcmds[] = {
...
{ "modemresetcmds",		&ModemConfig::resetCmds },
{ "modemresetcmd",		&ModemConfig::resetCmds },
...
[---cut---]

>    make ATZ a configurable string or not, but ATZ it is necessary
>    to do an internal modem reset (this hopefully brings the modem back to
> life
>    after an internal crash, hangs up the line...)
> 
> 2. for some ATZ is not sufficient (many apps using one modem)
>    then please look at ModemResetCmds
>    this is optional and can send additional reset/config data to the
>    modem before (? i do not know the source) ATZ (or ModemResetCommand) is
> send.
> 
>    here you can send AT&F, AT&W if you have to.

Look, unpatched Hylafax initializes the modem the following way:
(faxd/ClassModem.c++)

[---cut---]
ClassModem::ClassModem(ModemServer& s, const ModemConfig& c)
    : server(s)
    , conf(c)
    , mfrQueryCmd(c.mfrQueryCmd)
    , modelQueryCmd(c.modelQueryCmd)
    , revQueryCmd(c.revQueryCmd)
{
    /*
     * The modem drivers and main server code require:
     *
     * echoOff		command echo disabled
     * verboseResults	verbose command result strings
     * resultCodes	result codes enabled
     * onHook		modem initially on hook (hung up)
     * noAutoAnswer	no auto-answer (we do it manually)
     *
     * In addition the following configuration is included
     * in the reset command set:
     *
     * flowControl	DCE-DTE flow control method
     * setupDTR		DTR management technique
     * setupDCD		DCD management technique
     * pauseTime	time to pause for "," when dialing
     * waitTime		time to wait for carrier when dialing
     *
     * Any other modem-specific configuration that needs to
     * be done at reset time should be implemented by overriding
     * the ClassModem::reset method.
     */
    // XXX: workaround yet another GCC bug (sigh)
    const fxStr& flow = conf.getFlowCmd(conf.flowControl);
    resetCmds = "AT"
	      | stripAT(conf.resetCmds)		// prepend to insure our needs
	      | stripAT(conf.echoOffCmd)
	      | stripAT(conf.verboseResultsCmd)
	      | stripAT(conf.resultCodesCmd)
	      | stripAT(conf.noAutoAnswerCmd)
	      | stripAT(conf.onHookCmd)
	      | "\nAT"
	      | stripAT(conf.pauseTimeCmd)
	      | stripAT(conf.waitTimeCmd)
	      | stripAT(flow)
	      | stripAT(conf.setupDTRCmd)
	      | stripAT(conf.setupDCDCmd)
	      ;
    modemServices = 0;
    rate = BR0;
    flowControl = conf.flowControl;
    iFlow = FLOW_NONE;
    oFlow = FLOW_NONE;
}

...

/* 
 * Hayes-style modem manipulation support.
 */
bool
ClassModem::reset(long ms)
{
    setDTR(false);
    pause(conf.resetDelay);		// pause so modem can do reset
    setDTR(true);
#ifndef CONFIG_NOREOPEN
    /*
     * On some systems lowering and raising DTR is not done
     * properly (DTR is not raised when requested); thus we
     * reopen the device to insure that DTR is reasserted.
     */
    server.reopenDevice();
#endif
    if (!setBaudRate(rate, iFlow, oFlow))
	return (false);
    flushModemInput();
    return atCmd(resetCmds, AT_OK, ms);
}
[---cut---]

> Dmitry,
> if i understood you correctly, then it would be better to undo this patch?

You choose... But if you have some specific ModemResetCmds in you config,
*nothing* will change for you after applying the patch.

> ModemResetCmds is never used because you need it only in rare cases (if you
> run many apps with one modem and one of these apps modifies your modem's NVRAM)

Hmm, I looked into the Hylafax sources again and changed my mind :-)
I think, we should leave current defaults as they are:

ModemResetCms: ""
ModemSoftReset: "ATZ"

revoke my ModemResetCms and ModemSoftReset-related changes in config.4f,
but change the following:

[---cut---]
--- ClassModem.c++.orig	Wed Apr 05 17:31:28 2000
+++ ClassModem.c++	Sat Apr 15 11:32:50 2000
@@ -650,7 +650,8 @@
     if (!setBaudRate(rate, iFlow, oFlow))
 	return (false);
     flushModemInput();
-    return atCmd(resetCmds, AT_OK, ms);
+    return atCmd(conf.softResetCmd, AT_OK, conf.resetDelay) && 
+           atCmd(resetCmds, AT_OK, ms);
 }
 
 bool
[---cut---]

This way even current ModemResetCms and ModemSoftResetCmd description in
config.4f will be correct :-) Should I release version 3.1 of my patch? :-)

> I forwarded this to the hylafax list because this is not developement-only
> and there may be some admins with additiional experience about the topic only on
> the hylafax list

Hope to hear from you soon,
Dmitry





Project hosted by iFAX Solutions