]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Use DLE+DTX to help reseting when stuck in transmit (13 Mar 2007)
authorAidan Van Dyk <aidan@ifax.com>
Wed, 14 Mar 2007 18:33:27 +0000 (18:33 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Wed, 14 Mar 2007 18:33:27 +0000 (18:33 +0000)
From a combination of Lee's work:
| commit 77e9b7a53716acae93a6d8205d10b0f6d706c574
| Author: Lee Howard <faxguy@howardsilvan.com>
| Date:   Wed Sep 13 00:27:03 2006 +0000
|
|    This was noticed to be useful with SmartLink (soft) modems that could get
|    stuck after AT+VTX... but it may be useful for other wedged situations.

and
| commit d158d795f56be80498f21b542789e85ffb8893f0
| Author: Lee Howard <faxguy@howardsilvan.com>
| Date:   Wed Jan 3 03:20:22 2007 +0000

Where sending DLE+DTX is troublesome on some modems.

This use makes us only do it when a reset is having trouble.

CHANGES
faxd/ModemServer.c++
faxd/ModemServer.h

diff --git a/CHANGES b/CHANGES
index c7146a5faaf6695ef4f94e460f87b7b618b33761..af903f9c4b2f184762cf792fa092f4e4eecad55c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog since HylaFAX 4.3.3
 
+* Use DLE+DTX to help reseting when stuck in transmit (13 Mar 2007)
 * Add DTMF handling during call (12 Mar 2007)
 * Logging instances where a sender transmits PPS again after our fourth PPR
   signal (12 Mar 2007)
index 4bfb4df8d3ac5bbed8f028948d89ad9b06e68c62..18089c4114aad9f110c40cd5837b8c4b439ada8d 100644 (file)
@@ -476,13 +476,34 @@ ModemServer::setupModem(bool isSend)
                | modem->getModel() | "/"
                | modem->getRevision());
        }
-    } else
+    } else {
        /*
         * Reset the modem in case some other program
         * went in and messed with the configuration.
+        *
+        * Sometimes a modem may get interrupted while in a
+        * "transmit" state such as AT+VTX (voice mode) or
+        * AT+FTM=146 (fax mode) or similar.  Now, the modem
+        * should be smart enough to return to command-mode
+        * after a short period of inactivity, but it's
+        * conceivable that some don't (and we've seen some
+        * that are this way).  Furthermore, it is likely
+        * possible to configure a modem in such a way so as
+        * to never provide for that short period of inactivity.
+        * Further complicating matters, some modems are not
+        * sensitive to DTR.
+        *
+        * So if our first reset attempt fails we send DLE+ETX 
+        * to the modem just in case we happen to have a modem 
+        * in this kind of state, waiting for DLE+ETX before 
+        * returning to command mode.  Then we retry the reset.
         */
-        if( !(modem->reset() || modem->reset()) )      // try twice
-            return (false);
+        if (!(modem->reset())) {
+           sendDLEETX();
+           if (!(modem->reset()))
+               return (false);
+       }
+    }
     /*
      * Most modem-related parameters are dealt with
      * in the modem driver.  The speaker volume is
@@ -1381,6 +1402,15 @@ ModemServer::stopTimeout(const char* whichdir)
        traceModemOp("TIMEOUT: %s", whichdir);
 }
 
+void
+ModemServer::sendDLEETX()
+{
+    u_char buf[2];
+    buf[0] = DLE;
+    buf[1] = ETX;
+    (void) putModem(buf, 2);
+}
+
 int
 ModemServer::getModemLine(char rbuf[], u_int bufSize, long ms)
 {
index ca06b490f066aee437d9a7963fac63cb2a43f921..d67efa53f37bf4af5e56f8de2364b87da622dcdd 100644 (file)
@@ -137,6 +137,7 @@ protected:
     virtual fxStr getModemCapabilities() const;
 // modem i/o support
     void       timerExpired(long, long);
+    void       sendDLEETX();
     int                getModemLine(char buf[], u_int bufSize, long ms = 0);
     int                getModemChar(long ms = 0);
     int                getModemBit(long ms = 0);