From 1048c6846c5f49fa5b032cbf962fed6bad947179 Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 30 Dec 2004 19:44:34 +0000 Subject: Small test program to set the echo cancellation mode on the FXO module git-svn-id: http://svn.digium.com/svn/zaptel/trunk@527 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- fxotune.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 fxotune.c (limited to 'fxotune.c') 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 +#include +#include +#include +#include +#include +#include +#include +#include +#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); +} -- cgit v1.2.3