From ae63af1c2a2512719f2d31a9ac87518edab6ca4d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 5 Jul 2011 11:58:19 +0000 Subject: [PATCH] eet opening fifo directly rather then --- dart/eet.c | 18 ++++++++++-------- dart/start-dart.sh | 3 +-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dart/eet.c b/dart/eet.c index af33b70..aaab7dd 100644 --- a/dart/eet.c +++ b/dart/eet.c @@ -3,7 +3,7 @@ * * * Copyright (C) 2011 Christian Pointner - * + * * This file is part of eet. * * eet is free software: you can redistribute it and/or modify @@ -21,8 +21,10 @@ */ #include +#include +#include +#include #include - #include int write_buf(char* buf, int len) @@ -32,7 +34,7 @@ int write_buf(char* buf, int len) int w = write(1, &(buf[i]), len - i); if(w < 0) return w; - + i+=w; } return 0; @@ -41,12 +43,12 @@ int write_buf(char* buf, int len) int main(int argc, char* argv[]) { if(argc < 2) { - fprintf(stderr, "Please specify fd number\n"); + fprintf(stderr, "Please specify a path to the fifo\n"); return 1; } - int fd = atoi(argv[1]); - if(fd < 3) { - fprintf(stderr, "the specified fd is not valid (must be higher than 2\n"); + int fd = open(argv[1], O_RDONLY); + if(fd < 0) { + perror("open()"); return 2; } @@ -75,7 +77,7 @@ int main(int argc, char* argv[]) ret = write_buf(buf, r); if(ret) return ret; } - } + } } } diff --git a/dart/start-dart.sh b/dart/start-dart.sh index e55117f..357ba9d 100755 --- a/dart/start-dart.sh +++ b/dart/start-dart.sh @@ -15,8 +15,7 @@ stty -echo ssh dart stty -F /dev/ttyDart 57600 ssh dart cat /dev/ttyDart >$FIFO & -exec 42<$FIFO -./eet 42 | ./dart-$mode.pl $* | ./dart-soundonly.pl | ../dart-sounds/src/dart-sounds ../dart-sounds/media > /dev/null +./eet $FIFO | ./dart-$mode.pl $* | ./dart-soundonly.pl | ../dart-sounds/src/dart-sounds ../dart-sounds/media > /dev/null rm -f $FIFO exit 0 -- 1.7.10.4