HylaFAX The world's most advanced open source fax server

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

Re: [hylafax-devel] Re: atz



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

Excuse me, but I am already tired of all this. Again, I think the correct
init sequence is

Config parameter         default
===================================
<Drop DTR>
ModemSoftResetCmd        ATZ
ModemResetCmds           ""    (not executed if empty)
ModemReSetechoOffCmd     ATE0       \
ModemReVerboseResultsCmd ATV1        \ everything Hylafax needs
ModemResultCodesCmd      ATQ0        / (merged into one command string)
ModemNoAutoAnswerCmd     ATS0=0     /
...                                /

Your sequence is

Config parameter         default
===================================
<Drop DTR>
ModemResetCmds           ""
ModemSoftResetCmd        ATZ
ModemResetCmds           ""
ModemResetechoOffCmd     ATE0       \
ModemReVerboseResultsCmd ATV1        \ everything Hylafax needs
ModemResultCodesCmd      ATQ0        / (merged into one command string)
ModemNoAutoAnswerCmd     ATS0=0     /
...                                /

I don't like it. First ModemResetCmds is useless and its settings will
be overwritten by ATZ (ModemSoftResetCmd). If you need something really
non-standard, place

ModemSoftResetCmd        "really odd stuff"       or
ModemSoftResetCmd        "ATZ\nreally odd stuff"  (will wait for intermediate OK)
                                                  or even
ModemSoftResetCmd        "really odd stuff\nATZ\nreally odd stuff"

in your config.<device>

Remember, you can specify ANY values for ModemResetCmds and
ModemSoftResetCmd in your config.<defice>, if you are really looking for
trouble!

> (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)

atCmd(conf.softResetCmd, AT_OK, conf.resetDelay)
does exactly that.

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

man config for ModemResetDelay.

>
> (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?

delault 30 sec is always used:

class ClassModem {
...
bool	atCmd(const fxStr& cmd, ATResponse = AT_OK, long ms = 30*1000);

It's enough for ALL modems.

> (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!

Oh my God! I have to explain even ELEMENTARY things :-(

A quote from C++ standard:

[---cut---]
5.14 - Logical AND operator [expr.log.and]
logical-and-expression:
	inclusive-or-expression
	logical-and-expression && inclusive-or-expression

-1- The && operator groups left-to-right. The operands are both implicitly
converted to type bool (clause conv). The result is true if both operands
are true and false otherwise. Unlike &, && guarantees left-to-right
evaluation: the second operand is not evaluated if the first operand is
false.

-2- The result is a bool. All side effects of the first expression except
for destruction of temporaries (class.temporary) happen before the second
expression is evaluated.
[---cut---]

(a && b) is evaluated this way in C/C++ since the very begining (K&R era) !!!

> (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().

It's handled correctly, you just incorrectly use it. :-)

> what do you think about this??

I think that we should stop the discussion. I will NOT implement any other
init-related parameters, delays, etc. There are many other real problems in 
Hylafax that should be addressed.

Hope to hear from you soon,
Dmitry




Project hosted by iFAX Solutions