diff options
-rwxr-xr-x | patlooptest.c | 16 | ||||
-rwxr-xr-x | zaptel.init | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/patlooptest.c b/patlooptest.c index 605f254..405ccf8 100755 --- a/patlooptest.c +++ b/patlooptest.c @@ -9,6 +9,7 @@ #include <sys/ioctl.h> #include <unistd.h> #include <stdlib.h> +#include <time.h> #define BLOCK_SIZE 2039 @@ -38,8 +39,10 @@ int main(int argc, char *argv[]) int setup=0; int errors=0; int bytes=0; - if (argc < 2) { - fprintf(stderr, "Usage: markhdlctest <zaptel device>\n"); + int timeout=0; + time_t start_time=0; + if (argc < 2 || argc > 3 ) { + fprintf(stderr, "Usage: %s <zaptel device (optional timeout)>\n",argv[0]); exit(1); } fd = open(argv[1], O_RDWR, 0600); @@ -63,6 +66,11 @@ int main(int argc, char *argv[]) perror("tor_flush"); exit(255); } + if(argc==3){ + timeout=atoi(argv[2]); + start_time=time(NULL); + printf("Using Timeout of %d Seconds\n",timeout); + } for(;;) { res = bs; @@ -105,6 +113,10 @@ int main(int argc, char *argv[]) #if 0 printf("(%d) Wrote %d bytes\n", packets++, res); #endif + if(timeout && (time(NULL)-start_time)>timeout){ + printf("Timeout achieved Ending Program\n"); + return errors; + } } } diff --git a/zaptel.init b/zaptel.init index a5f30d1..64b32c7 100755 --- a/zaptel.init +++ b/zaptel.init @@ -41,6 +41,7 @@ case "$1" in # Load drivers rmmod wcusb >& /dev/null rmmod wcfxsusb >& /dev/null + rmmod audio >& /dev/null action "Loading zaptel framework: " modprobe zaptel echo -n "Loading zaptel hardware modules: " for x in $MODULES; do |