]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/patches/zaptel.patch
HinzugefĆ¼gt:
[ipfire-2.x.git] / src / patches / zaptel.patch
index c0d85877f0eb93cb27d6eeb192c51348b2f1178c..c6be661c989799407404337cfd94bc2b11487feb 100644 (file)
@@ -1,8 +1,38 @@
-Only in zaptel-1.2.5: version.h
-Only in zaptel-1.2.5: zaptel
-diff -ur zaptel-1.2.5.orig/zaptel.c zaptel-1.2.5/zaptel.c
---- zaptel-1.2.5.orig/zaptel.c 2005-12-17 03:04:05.000000000 +0100
-+++ zaptel-1.2.5/zaptel.c      2006-04-10 10:39:37.000000000 +0200
+diff -urN zaptel-1.2.6.orig/Makefile zaptel-1.2.6/Makefile
+--- zaptel-1.2.6.orig/Makefile 2006-05-23 01:11:36.000000000 +0200
++++ zaptel-1.2.6/Makefile      2006-06-06 14:54:33.000000000 +0200
+@@ -124,7 +124,7 @@
+ ifneq (,$(wildcard /usr/include/newt.h))
+ ZTTOOL:=zttool
+ endif
+-BINS=ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) zttest fxotune
++BINS=ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) zttest fxotune ztpty
+ all: $(BUILDVER) $(LIBTONEZONE_SO)
+@@ -209,6 +209,9 @@
+ ztmonitor.o: ztmonitor.c zaptel.h
++ztpty.o: ztpty.c
++      $(CC) -o $@ -c $^
++
+ ztspeed.o: ztspeed.c
+       $(CC) -o $@ -c $^
+@@ -221,6 +224,9 @@
+ ztspeed: ztspeed.o
+       $(CC) -o $@ $^
++ztpty: ztpty.o
++      $(CC) -o $@ $^
++
+ sethdlc-new: sethdlc-new.o
+       $(CC) -o $@ $^
+diff -urN zaptel-1.2.6.orig/zaptel.c zaptel-1.2.6/zaptel.c
+--- zaptel-1.2.6.orig/zaptel.c 2005-12-17 03:04:05.000000000 +0100
++++ zaptel-1.2.6/zaptel.c      2006-06-06 14:54:33.000000000 +0200
 @@ -4913,11 +4913,40 @@
                                        *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc);
                                }
@@ -116,9 +146,9 @@ diff -ur zaptel-1.2.5.orig/zaptel.c zaptel-1.2.5/zaptel.c
                        } else {
                                /* Not HDLC */
                                memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
-diff -ur zaptel-1.2.5.orig/zaptel.h zaptel-1.2.5/zaptel.h
---- zaptel-1.2.5.orig/zaptel.h 2005-12-17 03:04:05.000000000 +0100
-+++ zaptel-1.2.5/zaptel.h      2006-04-10 10:39:37.000000000 +0200
+diff -urN zaptel-1.2.6.orig/zaptel.h zaptel-1.2.6/zaptel.h
+--- zaptel-1.2.6.orig/zaptel.h 2005-12-17 03:04:05.000000000 +0100
++++ zaptel-1.2.6/zaptel.h      2006-06-06 14:54:33.000000000 +0200
 @@ -994,6 +994,13 @@
        int do_ppp_error;
        struct sk_buff_head ppp_rq;
@@ -153,9 +183,9 @@ diff -ur zaptel-1.2.5.orig/zaptel.h zaptel-1.2.5/zaptel.h
  struct zt_span {
        spinlock_t lock;
        void *pvt;                      /* Private stuff */
-diff -ur zaptel-1.2.5.orig/zconfig.h zaptel-1.2.5/zconfig.h
---- zaptel-1.2.5.orig/zconfig.h        2005-11-29 19:42:08.000000000 +0100
-+++ zaptel-1.2.5/zconfig.h     2006-04-10 10:39:37.000000000 +0200
+diff -urN zaptel-1.2.6.orig/zconfig.h zaptel-1.2.6/zconfig.h
+--- zaptel-1.2.6.orig/zconfig.h        2005-11-29 19:42:08.000000000 +0100
++++ zaptel-1.2.6/zconfig.h     2006-06-06 14:54:33.000000000 +0200
 @@ -152,4 +152,10 @@
   */
  /* #define FXSFLASH */
@@ -167,3 +197,119 @@ diff -ur zaptel-1.2.5.orig/zconfig.h zaptel-1.2.5/zconfig.h
 +#define CONFIG_ZAPATA_BRI_DCHANS
 +
  #endif
+diff -urN zaptel-1.2.6.orig/ztpty.c zaptel-1.2.6/ztpty.c
+--- zaptel-1.2.6.orig/ztpty.c  1970-01-01 01:00:00.000000000 +0100
++++ zaptel-1.2.6/ztpty.c       2006-06-06 14:54:33.000000000 +0200
+@@ -0,0 +1,112 @@
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <errno.h>
++#include <string.h>
++#include <fcntl.h>
++#include <sys/time.h>
++#include <sys/signal.h>
++#include <sys/select.h>
++#include <math.h>
++#include "zaptel.h"
++
++#define SIZE 8000
++
++
++
++void doit(int fd, int stdinfd) {
++    fd_set fds;
++    char inbuffer[4096];
++    char outbuffer[4096];
++    int res = 0;
++    int i = 0;
++
++//    fprintf(stderr, "fd %d stdin fd %d\n", fd, stdinfd);
++
++    for (;;) {
++      FD_ZERO(&fds);
++        FD_SET(fd, &fds);
++      FD_SET(stdinfd, &fds);
++        /* Wait for *some* sort of I/O */
++        res = select(stdinfd + 1, &fds, NULL, NULL, NULL);
++        if (res < 0) {
++                fprintf(stderr, "Error in select: %s\n", strerror(errno));
++                return;
++        }
++        if (FD_ISSET(stdinfd, &fds)) {
++            res = read(stdinfd, inbuffer, sizeof(inbuffer));
++          if (res > 0) {
++//            fprintf(stderr, "read %d bytes from stdin\n", res);
++              if (res > 0) {
++                  for (i=0; i < res ; i++) {
++                      if (inbuffer[i] == '\n') {
++                          if ((i > 0) && (inbuffer[i-1] == ' ')) {
++                              inbuffer[i-1] = 0x1a;
++                          }
++                          inbuffer[i] = 0xd;
++                      }
++                  }
++              res = write(fd, inbuffer, res+2);
++//            res = write(STDOUT_FILENO, inbuffer, res);
++//            fprintf(stderr, "wrote %d bytes to stdout\n", res);
++              }
++          }
++        }
++        if (FD_ISSET(fd, &fds)) {
++            res = read(fd, outbuffer, sizeof(outbuffer));
++//        fprintf(stderr, "read %d bytes from fd\n", res);
++          if (res > 0) {
++              res = write(STDOUT_FILENO, outbuffer, res);
++//            fprintf(stderr, "wrote %d bytes to stdout\n", res);
++          }
++        }
++    }
++
++
++}
++
++int main(int argc, char *argv[])
++{
++      int fd;
++      int stdinfd;
++      struct zt_params p;
++      struct zt_bufferinfo bi;
++      int blocksize=0;
++      fd = open(argv[1], O_RDWR | O_NONBLOCK);
++      if (fd < 0) {
++              fprintf(stderr, "Unable to open zap interface: %s\n", strerror(errno));
++              exit(1);
++      }
++      if (ioctl(fd, ZT_GET_PARAMS, &p)) {
++              fprintf(stderr, "Unable to get parameters on '%s': %s\n", argv[1], strerror(errno));
++              exit(1);
++      }
++      if ((p.sigtype != ZT_SIG_HDLCRAW) && (p.sigtype != ZT_SIG_HDLCFCS)) {
++              fprintf(stderr, "%s is in %d signalling, not FCS HDLC or RAW HDLC mode\n", argv[1], p.sigtype);
++              exit(1);
++      }
++
++      if (ioctl(fd, ZT_GET_BLOCKSIZE, &blocksize)) {
++              fprintf(stderr, "Unable to get blocksize on '%s': %s\n", argv[1], strerror(errno));
++              exit(1);
++      } else {
++//            fprintf(stderr, "blocksize %d\n", blocksize);
++      }
++      
++      bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
++        bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
++      bi.numbufs = 16;
++      bi.bufsize = 1024;
++      if (ioctl(fd, ZT_SET_BUFINFO, &bi)) {
++              fprintf(stderr, "Unable to set buffer info on '%s': %s\n", argv[1], strerror(errno));
++              exit(1);
++      }
++
++      stdinfd = open("/dev/stdin", O_RDONLY | O_NONBLOCK);
++
++      
++      doit(fd, stdinfd);
++      close(stdinfd);
++      close(fd);
++      return 0;
++}