summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMakefile3
-rwxr-xr-xfxotune.c46
2 files changed, 49 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 6b9c35b..39585f6 100755
--- a/Makefile
+++ b/Makefile
@@ -233,6 +233,9 @@ usbfxstest: usbfxstest.o
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
diff --git a/fxotune.c b/fxotune.c
new file mode 100755
index 0000000..6bdaeba
--- /dev/null
+++ b/fxotune.c
@@ -0,0 +1,46 @@
+#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);
+}