Hylafax Mailing List Archives

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

RE: [hylafax-devel] Re: atz




i would do it this way:


from faxd/ClassModem.c++----
-----------------------------------------------
/*
 * Hayes-style modem manipulation support.
 */
bool
ClassModem::reset(long ms)
{
    setDTR(false);
    pause(conf.resetDelay);		// pause so modem can do reset
(1) if(strlen($ModemResetCmds$)>0)
(1)    atCmd($ModemResetCmds$, AT_NOTHING, conf.resetDelay);
    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();
(2) status1=atCmd(conf.softResetCmd, AT_OK, conf.resetDelay)
(3) status2=atCmd(resetCmd, AT_OK, conf.resetDelay)
(4) return(status1 && status2)
}

--------.-.-.-.-.

    resetCmds = "AT"
(5)	      | 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)
--------------


this is the way i expect the software to work from reading the manpage
and the mails today:

(1) $ModemResetCmds$ should be the value read from the config file.
    i do not know where the actual value is stored.

    send it as a separate command to the modem an do not expect any answer
    from the modem.

    if your modem is in such an odd state that you have to use this command
    then it would be easiest to just send it to the modem and let your
    personal reset string work for you.

    everyone who has to can do AT&F, AT&W and other nonstandard stuff here.

    99.9%(?) will not have to use it

    it is completely optional

    give the modem time to process the command. Must be also configurable
    as this depends on the particular envirnemnt

    maybe one should separte this delay from the standard delay currently
used
    to wait for DTR-dropped-processing?


(2) send ATZ (or whatever is configured in config.*, if there is anything at
all)
    as a separate command to the modem (some modems ignore anything after
ATZ)

    give the modem time to handle this, maybe another new parameter?

(3) do all of the hylafax specific setup apart from ModemResetCmds,
softreset(ATZ)

    give the modem time to handle this, maybe again a new parameter?

(4) Dmitry, i am not sure about this, i am not familiar with C++ specs
    (and i never would rely on compiler buildes that their work
     is according to the specs!):
    can you predict the order of execution for the bot atCmd()s?

    return atCmd(conf.softResetCmd, AT_OK, conf.resetDelay) &&
           atCmd(resetCmds, AT_OK, ms);

    -> i would separate them in 2 commands!

(5) see (3)


adding this many delay parameters may help in optimizing the lengthy reset
sequence.

BTW: from a very quick look at the code:
     i am not sure if AT_NOTHING is handled correctly by ::atCmd().



what do you think about this??


Hope to hear from YOU soon,  :-)
Bernd




> -----Original Message-----
> From: hylafax-devel-bounce@hylafax.org
> [mailto:hylafax-devel-bounce@hylafax.org]On Behalf Of Dmitry Bely
> Sent: Saturday, April 15, 2000 1:55 PM
> To: news@proissl.de
> Cc: hylafax-devel@hylafax.org; Dmitry Bely; Hylafax Mailing List;
> steve@genie96.com
> Subject: [hylafax-devel] 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
>
>
>
> ____________________ HylaFAX(tm) Developers Mailing List
> ____________________
>  To unsub: mail -s unsubscribe hylafax-devel-request@hylafax.org
> < /dev/null
>



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services