vgetty-1.1.20 patch for old ZyXEL U1496

Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
13 Apr 1999 1909:11:04 -0000


Oops, forgot the patch, here it goes.

--- voice/libvoice/detect.c.orig	Fri Nov 20 11:03:00 1998
+++ voice/libvoice/detect.c	Fri Apr  2 14:16:01 1999
@@ -29,6 +29,7 @@
      {ati, "1443",                 NULL,   &Dolphin},
      {ati, "1445",                 NULL,   &US_Robotics},
      {ati, "1496",                 NULL,   &ZyXEL_1496},
+     {ati, "U1496E*",              NULL,   &ZyXEL_1496},
      {ati, "247",                  NULL,   &Multitech_2834ZDXv},
      {ati, "248",                  NULL,   &Sierra},
      {ati, "249",                  NULL,   &Rockwell},
@@ -150,12 +151,19 @@
                 ((*s == ' ') || (*s == '\t'))); s++)
                     ;
 
-               for (i = 0; ((modem_database[i].at_cmnd != NULL) &&
-                (voice_modem == &no_modem)); i++)
+               for (i = 0;
+		    ((modem_database[i].at_cmnd != NULL) &&
+		     (voice_modem == &no_modem));
+		    i++)
                     {
+			size_t len = strlen(modem_database[i].at_answr);
+			int is_wild = len>0 &&
+			    (modem_database[i].at_answr[len-1] == '*');
 
                     if ((strcmp(modem_database[i].at_cmnd, cmnd) == 0) &&
-                     (strcmp(modem_database[i].at_answr, s) == 0))
+			((strcmp(modem_database[i].at_answr, s) == 0) ||
+			 (is_wild &&
+			  strncmp(modem_database[i].at_answr, s, len-1)==0)))
                          {
 
                          if (modem_database[i].next_cmnd != NULL)
--- voice/libvoice/ZyXEL_1496.c.orig	Wed Sep  9 23:07:25 1998
+++ voice/libvoice/ZyXEL_1496.c	Fri Apr  2 17:59:40 1999
@@ -9,6 +9,8 @@
 
 #include "../include/voice.h"
 
+static char ZyXEL_1496_intr_play_cmnd[] = {DLE, DC4, 0x00};
+
 static int ZyXEL_1496_init (void)
      {
      char buffer[VOICE_BUF_LEN];
@@ -18,43 +20,55 @@
      voice_command("ATI1", "");
      voice_read(buffer);
      voice_read(buffer);
-     voice_command("", "OK");
-     rom_release = 100 * (buffer[10] - '0') + 10 *
-      (buffer[12] - '0') + (buffer[13] - '0');
+     if(strlen(buffer) > 13) {
+	 voice_command("", "OK");
+	 rom_release = 100 * (buffer[10] - '0') + 10 *
+	     (buffer[12] - '0') + (buffer[13] - '0');
+     } else
+	 rom_release = 505;
      lprintf(L_MESG, "ROM release %4.2f detected", rom_release / 100.0);
      lprintf(L_MESG, "initializing ZyXEL 1496 voice modem");
 
-     /*
-      * ATS40.3=1 - Enable distincitve ring type 1 (RING)
-      * ATS40.4=1 - Enable distincitve ring type 2 (RING 1)
-      * ATS40.5=1 - Enable distincitve ring type 3 (RING 2)
-      * ATS40.6=1 - Enable distincitve ring type 4 (RING 3)
-      */
-
-     if (voice_command("ATS40.3=1 S40.4=1 S40.5=1 S40.6=1", "OK") !=
-      VMA_USER_1)
-          lprintf(L_WARN, "coudn't initialize distinctive RING");
-
-     /*
-      * ATS39.6=1 - Enable DTMF detection after AT+VLS=2
-      * ATS39.7=0 - Don't include resynchronization information
-      *             in recorded voice data
-      * AT+VIT=60 - Set inactivity timer to 60 seconds
-      */
-
-     if (voice_command("ATS39.6=1 S39.7=0 +VIT=60", "OK") != VMA_USER_1)
-          lprintf(L_WARN, "voice init failed, continuing");
-
-     /*
-      * AT+VDH=x - Set the threshold for DTMF detection (0-32)
-      * AT+VDD=x - Set DTMF tone duration detection
-      */
-
-     sprintf(buffer, "AT+VDH=%d +VDD=%d", cvd.dtmf_threshold.d.i *
-      31 / 100, cvd.dtmf_len.d.i / 5);
-
-     if (voice_command(buffer, "OK") != VMA_USER_1)
-          lprintf(L_WARN, "setting DTMF preferences didn't work");
+     if (rom_release >= 600) {
+	 /*
+	  * ATS40.3=1 - Enable distincitve ring type 1 (RING)
+	  * ATS40.4=1 - Enable distincitve ring type 2 (RING 1)
+	  * ATS40.5=1 - Enable distincitve ring type 3 (RING 2)
+	  * ATS40.6=1 - Enable distincitve ring type 4 (RING 3)
+	  */
+
+	 if (voice_command("ATS40.3=1 S40.4=1 S40.5=1 S40.6=1", "OK") !=
+	     VMA_USER_1)
+	     lprintf(L_WARN, "couldn't initialize distinctive RING");
+
+	 /*
+	  * ATS39.6=1 - Enable DTMF detection after AT+VLS=2
+	  * ATS39.7=0 - Don't include resynchronization information
+	  *             in recorded voice data
+	  * AT+VIT=60 - Set inactivity timer to 60 seconds
+	  */
+
+	 if (voice_command("ATS39.6=1 S39.7=0 +VIT=60", "OK") != VMA_USER_1)
+	     lprintf(L_WARN, "voice init failed, continuing");
+
+	 /*
+	  * AT+VDH=x - Set the threshold for DTMF detection (0-32)
+	  * AT+VDD=x - Set DTMF tone duration detection
+	  */
+
+	 sprintf(buffer, "AT+VDH=%d +VDD=%d", cvd.dtmf_threshold.d.i *
+		 31 / 100, cvd.dtmf_len.d.i / 5);
+
+	 if (voice_command(buffer, "OK") != VMA_USER_1)
+	     lprintf(L_WARN, "setting DTMF preferences didn't work");
+     } else {
+	 /*
+	  * AT+VAT=60 - Set inactivity timer to 60 seconds
+	  */
+	 if (voice_command("AT+VAT=60", "OK") != VMA_USER_1)
+	     lprintf(L_WARN, "voice init failed, continuing");
+	 ZyXEL_1496_intr_play_cmnd[1] = 'p';
+     }
 
      /*
       * AT+VSD=x,y - Set silence threshold and duration.
@@ -66,29 +80,31 @@
      if (voice_command(buffer, "OK") != VMA_USER_1)
           lprintf(L_WARN, "setting recording preferences didn't work");
 
-     /*
-      * AT+VGT - Set the transmit gain for voice samples.
-      */
+     if(rom_release >= 600) {
+	 /*
+	  * AT+VGT - Set the transmit gain for voice samples.
+	  */
 
-     if (cvd.transmit_gain.d.i == -1)
-          cvd.transmit_gain.d.i = 75;
+	 if (cvd.transmit_gain.d.i == -1)
+	     cvd.transmit_gain.d.i = 75;
 
-     sprintf(buffer, "AT+VGT=%d", cvd.transmit_gain.d.i * 255 / 100);
+	 sprintf(buffer, "AT+VGT=%d", cvd.transmit_gain.d.i * 255 / 100);
 
-     if (voice_command(buffer, "OK") != VMA_USER_1)
-          lprintf(L_WARN, "setting transmit gain didn't work");
+	 if (voice_command(buffer, "OK") != VMA_USER_1)
+	     lprintf(L_WARN, "setting transmit gain didn't work");
 
-     /*
-      * AT+VGR - Set receive gain for voice samples.
-      */
+	 /*
+	  * AT+VGR - Set receive gain for voice samples.
+	  */
 
-     if (cvd.receive_gain.d.i == -1)
-          cvd.receive_gain.d.i = 75;
+	 if (cvd.receive_gain.d.i == -1)
+	     cvd.receive_gain.d.i = 75;
 
-     sprintf(buffer, "AT+VGR=%d", cvd.receive_gain.d.i * 255 / 100);
+	 sprintf(buffer, "AT+VGR=%d", cvd.receive_gain.d.i * 255 / 100);
 
-     if (voice_command(buffer, "OK") != VMA_USER_1)
-          lprintf(L_WARN, "setting receive gain didn't work");
+	 if (voice_command(buffer, "OK") != VMA_USER_1)
+	     lprintf(L_WARN, "setting receive gain didn't work");
+     }
 
      /*
       * AT+VNH=1 - Disable autohangup
@@ -197,7 +213,6 @@
 
 static char ZyXEL_1496_pick_phone_answr[] = "VCON";
 #define     ZyXEL_1496_beep_timeunit 100
-static char ZyXEL_1496_intr_play_cmnd[] = {DLE, DC4, 0x00};
 static char ZyXEL_1496_intr_play_answr[] = "VCON";
 static char ZyXEL_1496_stop_play_answr[] = "VCON";
 static char ZyXEL_1496_stop_rec_answr[] = "VCON";