diff options
author | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-12-30 19:44:34 +0000 |
---|---|---|
committer | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-12-30 19:44:34 +0000 |
commit | 1048c6846c5f49fa5b032cbf962fed6bad947179 (patch) | |
tree | 60b230ce84f764dd8d8e549f3d3f0089a09920a8 /fxotune.c | |
parent | b642e8ea1c42b82302b624947a12456a46e82dfb (diff) |
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
Diffstat (limited to 'fxotune.c')
-rwxr-xr-x | fxotune.c | 46 |
1 files changed, 46 insertions, 0 deletions
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); +} |