]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 545: add Mainpine Class 2 and Class 2.1 support
authorLee Howard <faxguy@howardsilvan.com>
Sat, 22 May 2004 02:12:35 +0000 (02:12 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Sat, 22 May 2004 02:12:35 +0000 (02:12 +0000)
         add Class2HexNSF config option
 support comma-separated NSF values

config/Makefile.in
config/agere-mp-2 [new file with mode: 0644]
config/agere-mp-21 [new file with mode: 0644]
distrules
faxd/Class2Send.c++
faxd/ModemConfig.c++
faxd/ModemConfig.h
faxd/NSF.c++
faxd/NSF.h
man/hylafax-config.4f
pkg/sproto.stub.in

index a33eb52282c7288a86740189ccbb2a588204696b..d18ac7b796c772e5970401a8129cabef988eb9c7 100644 (file)
@@ -49,6 +49,8 @@ CONFIGFILES=class1 \
        class2.1 \
        skel \
        \
+       agere-mp-2 \
+       agere-mp-21 \
        att-dataport-2 \
        att-dataport-2.0 \
        att-dataport \
diff --git a/config/agere-mp-2 b/config/agere-mp-2
new file mode 100644 (file)
index 0000000..00b9100
--- /dev/null
@@ -0,0 +1,36 @@
+# $Id$
+#
+# prototype config file for Mainpine Ltd. RockForceDUO+
+#
+
+#
+# CONFIG: CLASS2:"Mainpine Venus V.92"*-"Mainpine Venus V.92"*-*
+#
+# BEGIN-SERVER
+# END-SERVER
+#
+
+ModemType:             Class2
+ModemRate:             19200
+ModemFlowControl:      rtscts
+ModemNoFlowCmd:                AT&K0
+ModemSoftFlowCmd:      AT&K4
+ModemHardFlowCmd:      AT&K3
+
+Class2APQueryCmd:      none            # not available
+Class2BUGCmd:          AT+FBUG=0       # buggy in early firmwares
+Class2NFLOCmd:         AT+FLO=0
+Class2SFLOCmd:         AT+FLO=1
+Class2HFLOCmd:         AT+FLO=2
+Class2HexNSF:          false
+
+# Early firmwares reported ECM capability but then disabled it internally,
+# thus causing us to possibly attempt to send MMR data without ECM.
+# This disables ECM and MMR by replacing the +FDCC response.
+Class2DCCQueryCmd:     "!(0-1),(0-5),(0-2),(0-2),(0-1),(0),(0),(0-7)"
+
+# If your line supports Caller-ID, you may want to uncomment this...
+# QualifyCID:          etc/cid         # you must create this file
+# ModemResetCmds:      AT+VCID=1
+# CIDNumber:           "NMBR="
+# CIDName:             "NAME="
diff --git a/config/agere-mp-21 b/config/agere-mp-21
new file mode 100644 (file)
index 0000000..6a79673
--- /dev/null
@@ -0,0 +1,36 @@
+# $Id$
+#
+# prototype config file for Mainpine Ltd. RockForceDUO+
+#
+
+#
+# CONFIG: CLASS2.1:"Agere Systems"-"Mainpine Venus V.92"*-*
+#
+# BEGIN-SERVER
+# END-SERVER
+#
+
+ModemType:             Class2.1
+ModemRate:             57600           # for V.34 faxing
+ModemNoFlowCmd:                AT&K0
+ModemSoftFlowCmd:      AT&K4
+ModemHardFlowCmd:      AT&K3
+ModemRecvFillOrder:    MSB2LSB
+
+Class2APCmd:           AT+FAP=1,1,1
+Class2BUGCmd:          AT+FBU=0        # early firmware is buggy
+Class2SendRTC:         yes
+Class2UseHex:          yes
+
+# unfortunately, HylaFAX can't currently send or receive in color
+ModemAnswerCmd:                AT+FCC=,,,,,,,,0;A
+ModemDialCmd:          AT+FCC=,,,,,,,,0;DT%s
+
+# You may want to do something like this to enable CTC in ECM
+# Class2Cmd:           AT+FCLASS=2.1;+FRY=4
+
+# If your line supports Caller-ID, you may want to uncomment this...
+# QualifyCID:          etc/cid         # you must create this file
+# ModemResetCmds:      AT+VCID=1
+# CIDNumber:           "NMBR="
+# CIDName:             "NAME="
index 7c233fcb0ca7977ae98bd108972b8e25c992e95e..4e7e11e9308a04767821d9a646704f8b9da26adf 100644 (file)
--- a/distrules
+++ b/distrules
@@ -185,6 +185,8 @@ HYLAFAXSRC=\
     dist/newalpha                              \
     dist/newversion                            \
     config/Makefile.in                         \
+       config/agere-mp-2                       \
+       config/agere-mp-21                      \
        config/att-dataport                     \
        config/att-dataport-2                   \
        config/att-dataport-2.0                 \
index 9642f029fd6a4a9d39cda540a643288fff118b90..7f184673e6823bda2570c613f138a73153090c58 100644 (file)
@@ -144,7 +144,7 @@ Class2Modem::getPrologue(Class2Params& dis, bool& hasDoc, fxStr& emsg, u_int& ba
                gotParams = parseClass2Capabilities(skipStatus(rbuf), dis);
                break;
            case AT_FNSF:
-               recvNSF(NSF(skipStatus(rbuf)));
+               recvNSF(NSF(skipStatus(rbuf), conf.class2HexNSF));
                break;
            case AT_FCSI:
                recvCSI(stripQuotes(skipStatus(rbuf)));
index 6cb9a4dc8f7f836f29027b86ab2faf5faeef4c18..c68003aa6ce0c89e694b169d7db2dc1e30cea8ac 100644 (file)
@@ -234,6 +234,7 @@ ModemConfig::setupConfig()
     class2SendRTC      = false;                // default per Class 2 spec
     class2RTFCC                = false;                // real-time fax comp. conv.
     class2UseHex       = false;                // historical behavior
+    class2HexNSF       = true;                 // most modems report NSF in hexadecimal
     class2UseLineCount = false;                // don't trust firmware decoders
     class1ECMSupport   = true;                 // support for ECM
     class1ExtendedRes  = true;                 // support for extended resolutions
@@ -599,6 +600,8 @@ ModemConfig::setConfigItem(const char* tag, const char* value)
        class2ECMType = getECMType(value);
     else if (streq(tag, "class2usehex"))
        class2UseHex = getBoolean(value);
+    else if (streq(tag, "class2hexnsf"))
+       class2HexNSF = getBoolean(value);
     else if (streq(tag, "class2uselinecount"))
        class2UseLineCount = getBoolean(value);
     else if (streq(tag, "class2rtfcc"))
index 1f7a1fabd87aec40043e40005d962c6eaad77595..762f66c85d48ce653ef3abdb50552967dcfa6e1c 100644 (file)
@@ -184,6 +184,7 @@ public:
     fxStr      class2PACmd;            // cmd to set selective polling address
     fxStr      class2PWCmd;            // cmd to set password for transmit/poll
     bool       class2UseHex;           // parse capabilities strings as hex
+    bool       class2HexNSF;           // parse nsf strings as hex
     bool       class2UseLineCount;     // use the firmware decoder's line count
 
     FlowControl        flowControl;            // DTE-DCE flow control method
index 88e0b4cbeb5930e4b80f323f5b6a94ce4bd38e7a..813e551ce9e483cba636020b3d158f901b32f07a 100644 (file)
@@ -311,10 +311,10 @@ NSF::NSF()
 }
 
 
-NSF::NSF( const char* hexNSF )
+NSF::NSF( const char* hexNSF, bool useHex )
 {
     clear();
-    loadHexData( hexNSF );
+    loadHexData( hexNSF, useHex );
     decode();
 }
 
@@ -336,16 +336,17 @@ void NSF::clear()
     stationIdDecoded = false;
 }
 
-void NSF::loadHexData( const char* hexNSF )
+void NSF::loadHexData( const char* hexNSF, bool useHex )
 {
     hexNsf.append( hexNSF );
     const char *p = hexNSF;
     char *pNext = NULL;
     for( ;; ){
-        int val = strtol( p, &pNext, 16 );
+        int val = strtol( p, &pNext, (useHex ? 16 : 10) );
         if( pNext == p )
             break;
         p = pNext;
+       if (p[0] != '\0') p++;          // skip delimiter
         nsf.append( (unsigned char)val );
     }
 }
index 7c6d4668fd5a9a9453cf9b4d8a7736a97f12a7fe..eebec8c65aea576bc81037ccf18aeb21defcd73b 100644 (file)
@@ -43,7 +43,7 @@ class NSF {
     bool  stationIdDecoded;
 public:
     NSF();
-    NSF( const char* hexNSF );
+    NSF( const char* hexNSF, bool useHex );
     NSF( const u_char* rawData, int size, const u_char* revTab );
     /*
      * We are happy with default copy constructor and copy assignment,
@@ -58,7 +58,7 @@ public:
     const char* getStationId(){ return (const char*)stationId; }
 private:
     void clear();
-    void loadHexData( const char* hexNSF );
+    void loadHexData( const char* hexNSF, bool useHex );
     void loadRawData( const u_char* rawData, int size, const u_char* revTab );
     void findStationId( bool reverseOrder, bool reverseBitOrder );
     void decode();
index 58b852af17cd59baef128d312217ddd86fc991f0..04a3472f9a7d060ce7644bd5503081e5dd608a6d 100644 (file)
@@ -305,6 +305,7 @@ Class2DCCQueryCmd   string  \s-1AT+FDCC=?\s+1       Class 2: command to query modem capab
 Class2DISCmd   string  \s-1AT+FDIS\s+1 Class 2: command to set session parameters
 Class2DDISCmd  string  \-      Class 2: command to set session parameters before dialing
 Class2ECMType  string  \s-1``2''\s+1   Class 2: ECM specification type to follow
+Class2HexNSF   boolean \s-1Yes\s+1     Class 2: parse NSF strings as hex values
 Class2HFLOCmd  string  \-      Class 2: command to set hardware flow control
 Class2LIDCmd   string  \s-1AT+FLID\s+1 Class 2: command to set local identifier string
 Class2MINSPCmd string  \s-1AT+FMINSP\s+1       Class 2: command to set minimum transmit speed
@@ -338,6 +339,7 @@ Class2DCCCmd        string  \s-1AT+FCC\s+1  Class 2.0: command to set modem capabilities
 Class2DCCQueryCmd      string  \s-1AT+FCC=?\s+1        Class 2.0: command to query modem capabilities
 Class2DISCmd   string  \s-1AT+FIS\s+1  Class 2.0: command to set session parameters
 Class2ECMType  string  \s-1``2.0''\s+1 Class 2.0: ECM specification type to follow
+Class2HexNSF   boolean \s-1Yes\s+1     Class 2.0: parse NSF strings as hex values
 Class2HFLOCmd  string  \s-1AT+FLO=2\s+1        Class 2.0: command to set hardware flow control
 Class2LIDCmd   string  \s-1AT+FLI\s+1  Class 2.0: command to set local identifier string
 Class2MINSPCmd string  \s-1AT+FMS\s+1  Class 2.0: command to set minimum transmit speed
@@ -2360,6 +2362,10 @@ between the Class 2, ``2'', and Class 2.0, ``2.0'', specifications.  This
 configuration parameter allows the administrator to specify which type to
 use.  The corresponding specification type is used by default.
 .TP
+.B Class2HexNSF
+Whether or not to parse the NSF strings reported by the modem 
+using hexadecimal values.  By default, they are parsed as hexadecimal values.
+.TP
 .B Class2HFLOCmd
 The command to setup hardware (\s-1RTS/CTS\s+1)
 flow control between
index 07279ce2345daf583cbcdc851c885fdb9b59c5af..83967b5a61857dce0a877a21de186e310d1c4bd6 100644 (file)
@@ -142,6 +142,8 @@ f none @SPOOL@/config/class2=../@SRCDIR@/config/class2 0444 @SYSUID@ @SYSGID@
 f none @SPOOL@/config/class2.0=../@SRCDIR@/config/class2.0 0444 @SYSUID@ @SYSGID@
 f none @SPOOL@/config/class2.1=../@SRCDIR@/config/class2.1 0444 @SYSUID@ @SYSGID@
 f none @SPOOL@/config/skel=../@SRCDIR@/config/skel 0444 @SYSUID@ @SYSGID@
+f none @SPOOL@/config/agere-mp-2=../@SRCDIR@/config/agere-mp-2 0444 @SYSUID@ @SYSGID@
+f none @SPOOL@/config/agere-mp-21=../@SRCDIR@/config/agere-mp-21 0444 @SYSUID@ @SYSGID@
 f none @SPOOL@/config/att-dataport-2=../@SRCDIR@/config/att-dataport-2 0444 @SYSUID@ @SYSGID@
 f none @SPOOL@/config/att-dataport-2.0=../@SRCDIR@/config/att-dataport-2.0 0444 @SYSUID@ @SYSGID@
 f none @SPOOL@/config/att-dataport=../@SRCDIR@/config/att-dataport 0444 @SYSUID@ @SYSGID@