[Asterisk-cvs] zaptel fxotune.c,NONE,1.1 Makefile,1.60,1.61

mattf at lists.digium.com mattf at lists.digium.com
Thu Dec 30 14:49:53 CST 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv28032

Modified Files:
	Makefile 
Added Files:
	fxotune.c 
Log Message:
Small test program to set the echo cancellation mode on the FXO module


--- NEW FILE: fxotune.c ---
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/zaptel.h>
#include "wctdm.h"

int main (int argc , char **argv)
{
	char zapdev[80] = "";
	int fd;
	
	if (argc < 4) {
		fprintf(stdout, "Usage:\n");
		fprintf(stdout, "%s [zap device] echocan [0-7]\n", argv[0]);
		exit(1);
	}

	strncpy(zapdev, argv[1], sizeof(zapdev));

	fd = open(zapdev, O_RDWR);
	if (fd < 0) {
		fprintf(stderr, "open: %s\n", strerror(errno));
		exit(1);
	}
	
	if (!strcasecmp(argv[2], "echocan")) {
		int modeno = atoi(argv[3]);

		if (modeno < 0 || modeno > 7) {
			fprintf(stdout, "Echo canceller coefficient settings must be between 0 and 7.\n");
			exit(1);
		}

		if (ioctl(fd, WCTDM_SET_ECHOTUNE, &modeno)) {
			fprintf(stdout, "echotune: %s\n", strerror(errno));
			exit(1);
		}
		exit(0);
	}
	exit(0);
}

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- Makefile	26 Dec 2004 23:12:18 -0000	1.60
+++ Makefile	30 Dec 2004 19:44:34 -0000	1.61
@@ -233,6 +233,9 @@
 fxstest: fxstest.o 
 	$(CC) -o fxstest fxstest.o -ltonezone
 
+fxotune: fxotune.o
+	$(CC) -o fxotune fxotune.o
+
 fxsdump: fxsdump.o
 	$(CC) -o fxsdump fxsdump.o -lm
 




More information about the svn-commits mailing list