diff options
Diffstat (limited to 'apps/mixer.c')
-rw-r--r-- | apps/mixer.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/apps/mixer.c b/apps/mixer.c index 418fcb3..4a6d128 100644 --- a/apps/mixer.c +++ b/apps/mixer.c @@ -26,9 +26,39 @@ #include <error.h> #include <poll.h> #include <assert.h> +#include <sys/types.h> +#include <dirent.h> #include "mixer.h" +static int mixer_read_config(mixer_t* m) +{ + char path[1024]; + int ret = snprintf(path, sizeof(path), "%s/%s", ETCDIR, m->name_); + assert(ret < sizeof(path)); + + DIR* d = opendir(path); + if(d == NULL) { + error(0, errno, "MIXER: cannot open config directory '%s'", path); + return -1; + } + + struct dirent* entry = readdir(d); + while(entry) { + if(entry->d_type == DT_REG) { + printf(" > found config file: '%s'\n", entry->d_name); + } + entry = readdir(d); + } + + ret = closedir(d); + if(ret < 0) { + error(0, errno, "MIXER: cannot closeconfig directory '%s'", path); + return -1; + } + + return 0; +} int mixer_init(mixer_t* m, const char* name, const char* device) { @@ -42,7 +72,7 @@ int mixer_init(mixer_t* m, const char* name, const char* device) return ret; } - return 0; + return mixer_read_config(m);; } int mixer_get_poll_fd_count(mixer_t* m) |