From physik.uni-kl.de!gmayer Fri Jun 16 17:57:13 1995
Return-Path: <gmayer@physik.uni-kl.de>
Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2)
	id <m0sMdld-0000c5C@greenie.muc.de>; Fri, 16 Jun 95 17:57 MEST
Received: from srv.cip.physik.tu-muenchen.de ([129.187.41.1]) by colin.muc.de with SMTP id <25688-2>; Fri, 16 Jun 1995 17:56:57 +0200
Received:  from uni-kl.de (stepsun.uni-kl.de)
	by srv.cip.physik.tu-muenchen.de with SMTP id AA12242
	for <gdoering@physik.tu-muenchen.de> (5.67a/IDA-1.5/bs04);
	Fri, 16 Jun 1995 17:56:46 +0200
Received: from cinderella.physik.uni-kl.de by stepsun.uni-kl.de id aa16798;
          16 Jun 95 17:56 MET DST
Received: from pamuk.physik.uni-kl.de by cinderella.physik.uni-kl.de id aa16567;
          16 Jun 95 17:56 MET DST
Received: by physik.uni-kl.de  (4.1/BelWue-1.0(subsidiary))
	id AA02601; Fri, 16 Jun 95 17:56:35 +0200
From: Gunther Mayer <gmayer@physik.uni-kl.de>
Message-Id: <9506161556.AA02601@physik.uni-kl.de>
Subject: Patch: Runtime-Config for #define FAX_USRobotics
To: gdoering@Physik.TU-Muenchen.DE
Date: Fri, 16 Jun 1995 17:56:34 +0200
X-Mailer: ELM [version 2.4 PL24 PGP3 *ALPHA*]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 8510      
Status: RO

Hallo Gert,

danke fuer dein wunderbares mgetty:-)

Ich habe einen Patch fuer die Runtime-Konfiguration fuer USRobotics
angehaengt. Da du in deinen faxlib-routinen keine globale Variablen
verwendest, habe ich wenn noetig die neue Variable usrobotics_kludge
uebergeben. Wenn es noch mehr kludges geben sollte, koennte man fuer
jedes ein bit dort reservieren (und die Variable in kludges umbenennen).
BTW. Ich betreibe (an 3 verschiedenen Orten) ein TKR-V34voice, ein
Creatix14.4 und ein US-RoboticsV34Courier und ALLE funktionieren :-)

P.S. Ich wuerde lieber nur den MODEM_INIT_STRING in mgetty.config angeben
anstelle des laenglichen init-chat; kannst du vielleicht den chat aufteilen
in einen pre-chat, init-chat und post-chat (oder ist das fuer die Benutzer zu
kompliziert):)


MfG,	Gunther


diff -u -r mgetty-0.23-Apr20/conf_mg.c mgetty-0.23/conf_mg.c
--- mgetty-0.23-Apr20/conf_mg.c	Tue Apr  4 00:31:01 1995
+++ mgetty-0.23/conf_mg.c	Thu Jun 15 09:20:02 1995
@@ -112,6 +112,11 @@
 	{ "statistics-file", 0, CT_STRING, C_EMPTY },
 	{ "gettydefs", (int)GETTYDEFS_DEFAULT_TAG, CT_STRING, C_PRESET },
 	{ "term", 0, CT_STRING, C_EMPTY },
+#ifdef FAX_USRobotics
+	{ "usrobotics-kludge", 1, CT_BOOL, C_PRESET },
+#else
+	{ "usrobotics-kludge", 0, CT_BOOL, C_EMPTY },
+#endif
 
 	{ NULL, 0, CT_STRING, C_EMPTY }};
 
diff -u -r mgetty-0.23-Apr20/conf_mg.h mgetty-0.23/conf_mg.h
--- mgetty-0.23-Apr20/conf_mg.h	Tue Apr  4 00:30:20 1995
+++ mgetty-0.23/conf_mg.h	Thu Jun 15 09:14:04 1995
@@ -50,6 +50,7 @@
         statistics_file,			/* default: log file */
 	gettydefs_tag,
         termtype,				/* $TERM=... */
+	usrobotics_kludge,
 	end_of_config; } c;
 
 int mgetty_parse_args _PROTO(( int argc, char ** argv ));
diff -u -r mgetty-0.23-Apr20/conf_sf.c mgetty-0.23/conf_sf.c
--- mgetty-0.23-Apr20/conf_sf.c	Sun Mar 26 18:51:54 1995
+++ mgetty-0.23/conf_sf.c	Thu Jun 15 09:11:22 1995
@@ -47,6 +47,11 @@
 	{ "" /* polling */, FALSE, CT_BOOL, C_PRESET },
 	{ "page-header", 0, CT_STRING, C_EMPTY },
 	{ "" /* stdin */, FALSE, CT_BOOL, C_PRESET },
+#ifdef FAX_USRobotics
+	{ "usrobotics-kludge", 1, CT_BOOL, C_PRESET },
+#else
+	{ "usrobotics-kludge", 0, CT_BOOL, C_EMPTY },
+#endif
 	{ NULL, 0, CT_STRING, C_EMPTY }};
 
 int sendfax_parse_args _P2( (argc,argv), int argc, char ** argv )
diff -u -r mgetty-0.23-Apr20/conf_sf.h mgetty-0.23/conf_sf.h
--- mgetty-0.23-Apr20/conf_sf.h	Sun Mar 26 18:52:14 1995
+++ mgetty-0.23/conf_sf.h	Thu Jun 15 09:11:39 1995
@@ -24,6 +24,7 @@
 	fax_poll_wanted,	/* cli only (-p) */
 	fax_page_header,
 	use_stdin,		/* cli only (-S) */
+	usrobotics_kludge,
 	end_of_config; } c;
 
 int sendfax_parse_args _PROTO(( int argc, char ** argv ));
Only in mgetty-0.23/doc: mgetty.asc
Only in mgetty-0.23/doc: nohup.out
diff -u -r mgetty-0.23-Apr20/fax_lib.h mgetty-0.23/fax_lib.h
--- mgetty-0.23-Apr20/fax_lib.h	Fri Dec 23 13:01:27 1994
+++ mgetty-0.23/fax_lib.h	Thu Jun 15 09:15:54 1995
@@ -34,7 +34,7 @@
 int fax_read_byte _PROTO(( int fd, char * c ));
 
 int fax_set_l_id _PROTO(( int fd, char * fax_id ));
-int fax_set_fdcc _PROTO(( int fd, int fine, int maxsp, int minsp ));
+int fax_set_fdcc _PROTO(( int fd, int fine, int maxsp, int minsp, int usrobotics_kludge ));
 int fax_set_bor  _PROTO(( int fd, int bit_order ));
 int fax_set_flowcontrol _PROTO(( int fd, int hw_flow ));
 
diff -u -r mgetty-0.23-Apr20/faxlib.c mgetty-0.23/faxlib.c
--- mgetty-0.23-Apr20/faxlib.c	Fri Dec 23 13:01:27 1994
+++ mgetty-0.23/faxlib.c	Thu Jun 15 09:24:26 1995
@@ -351,25 +351,24 @@
 }
 
 /* set resolution, minimum and maximum bit rate */
-int fax_set_fdcc _P4( (fd, fine, max, min),
-		      int fd, int fine, int max, int min )
+int fax_set_fdcc _P5( (fd, fine, max, min),
+		      int fd, int fine, int max, int min, int usrobotics_kludge)
 {
     char buf[50];
 
-#ifndef FAX_USRobotics
+if (!usrobotics_kludge)
     sprintf( buf, "AT%s=%d,%d,0,2,0,0,0,0",
 	     (modem_type == Mt_class2_0) ? "+FCC" : "+FDCC",
 	     fine, (max/2400) -1 );
-#else /* FAX_USRobotics */
+else
     /* some versions of the USR firmware got this wrong, so don't set speed
      */
     sprintf( buf, "AT+FCC=%d", fine );
-#endif
     
     if ( mdm_command( buf, fd ) == ERROR )
     {
 	if ( max > 9600 )
-	    return fax_set_fdcc( fd, fine, 9600, min );
+	    return fax_set_fdcc( fd, fine, 9600, min ,usrobotics_kludge);
 	else
 	    return ERROR;
     }
diff -u -r mgetty-0.23-Apr20/faxrec.c mgetty-0.23/faxrec.c
--- mgetty-0.23-Apr20/faxrec.c	Fri Apr  7 01:14:23 1995
+++ mgetty-0.23/faxrec.c	Thu Jun 15 09:16:49 1995
@@ -48,9 +48,9 @@
 
 char * faxpoll_server_file = NULL;
 
-void faxrec _P5((spool_in, switchbd, uid, gid, mode),
+void faxrec _P6((spool_in, switchbd, uid, gid, mode),
 		char * spool_in, unsigned int switchbd,
-		int uid, int gid, int mode )
+		int uid, int gid, int mode, int usrobotics_kludge )
 {
 int pagenum = 0;
 TIO tio;
@@ -64,10 +64,9 @@
      * For some modems, it's necessary to switch to 19200 bps.
      */
 
-#ifdef FAX_USRobotics
+if(usrobotics_kludge)
     /* the ultra smart USR modems do it in yet another way... */
     fax_wait_for( "OK", 0 );
-#endif
 
     tio_get( STDIN, &tio );
 
@@ -80,9 +79,8 @@
 
     /* read: +FTSI:, +FDCS, OK */
 
-#ifndef FAX_USRobotics
+if(!usrobotics_kludge)
     fax_wait_for( "OK", 0 );
-#endif
 
     /* *now* set flow control (we could have set it earlier, but on SunOS,
      * enabling CRTSCTS while DCD is low will make the port hang)
Only in mgetty-0.23: login.config
diff -u -r mgetty-0.23-Apr20/mg_m_init.c mgetty-0.23/mg_m_init.c
--- mgetty-0.23-Apr20/mg_m_init.c	Fri Dec 23 13:01:29 1994
+++ mgetty-0.23/mg_m_init.c	Thu Jun 15 09:15:09 1995
@@ -54,8 +54,8 @@
 
 /* initialize fax section */
 
-int mg_init_fax _P3( (fd, mclass, fax_id),
-		      int fd, char * mclass, char * fax_id )
+int mg_init_fax _P4( (fd, mclass, fax_id),
+		      int fd, char * mclass, char * fax_id,int usrobotics_kludge )
 {
     /* find out whether this beast is a fax modem... */
 
@@ -119,7 +119,7 @@
 
     /* capabilities */
 
-    if ( fax_set_fdcc( fd, 1, 14400, 0 ) == FAIL )
+    if ( fax_set_fdcc( fd, 1, 14400, 0,usrobotics_kludge ) == FAIL )
     {
 	lprintf( L_MESG, "huh? Cannot set +FDCC parameters" );
     }
diff -u -r mgetty-0.23-Apr20/mgetty.c mgetty-0.23/mgetty.c
--- mgetty-0.23-Apr20/mgetty.c	Sun Apr 16 23:11:07 1995
+++ mgetty-0.23/mgetty.c	Thu Jun 15 09:17:30 1995
@@ -363,7 +363,8 @@
 	if ( ( ! c_bool(data_only) ) &&
 	     strcmp( c_string(modem_type), "data" ) != 0 && 
 	     mg_init_fax( STDIN, c_string(modem_type),
-			  c_string(station_id) ) == SUCCESS )
+			  c_string(station_id),c_int(usrobotics_kludge) ) 
+				== SUCCESS )
 	{
 	    /* initialize fax polling server (only if faxmodem) */
 	    if ( c_isset(fax_server_file) )
@@ -775,7 +776,7 @@
 	    lprintf( L_MESG, "start fax receiver..." );
 	    get_ugid( &c.fax_owner, &c.fax_group, &uid, &gid );
 	    faxrec( FAX_SPOOL_IN, c_int(switchbd),
-		    uid, gid, c_int(fax_mode) );
+		    uid, gid, c_int(fax_mode),c_int(usrobotics_kludge) );
 	    rmlocks();
 	    exit( 0 );
 	    break;
diff -u -r mgetty-0.23-Apr20/mgetty.h mgetty-0.23/mgetty.h
--- mgetty-0.23-Apr20/mgetty.h	Wed Apr 19 14:23:17 1995
+++ mgetty-0.23/mgetty.h	Thu Jun 15 09:17:58 1995
@@ -146,12 +146,12 @@
   
 /* fax stuff */
 void	faxrec _PROTO(( char * spool_dir, unsigned int switchbd,
-		        int uid, int gid, int mode ));
+		        int uid, int gid, int mode ,int usrobotics_kludge));
 char *	fax_strerror _PROTO(( int fax_hangup_code ));
 
 /* initialization stuff: mg_m_init.c */
-int	mg_init_data  _PROTO(( int fd, char * chat_seq[] ));
-int	mg_init_fax   _PROTO(( int fd, char * mclass, char * fax_id ));
+int	mg_init_data  _PROTO(( int fd, char * chat_seq[]));
+int	mg_init_fax   _PROTO(( int fd, char * mclass, char * fax_id, int usrobotics_kludge ));
 int 	mg_init_voice _PROTO(( int fd ));
 void	faxpoll_server_init _PROTO(( int fd, char * fax_server_file ));
 int	mg_open_device _PROTO(( char * devname, boolean blocking ));
Only in mgetty-0.23-Apr20/: policy.h-
diff -u -r mgetty-0.23-Apr20/sendfax.c mgetty-0.23/sendfax.c
--- mgetty-0.23-Apr20/sendfax.c	Wed Mar 29 00:19:13 1995
+++ mgetty-0.23/sendfax.c	Thu Jun 15 09:06:50 1995
@@ -388,7 +388,7 @@
     /* set desired resolution, maximum and minimum bit rate */
 
     /* FIXME: ask modem if it can do 14400 bps / fine res. at all */
-    fax_set_fdcc( fd, !c_bool(normal_res), 14400, 0 );
+    fax_set_fdcc( fd, !c_bool(normal_res), 14400, 0 ,c_int(usrobotics_kludge) );
 
 #if REVERSE
     fax_set_bor( fd, 0 );

