diff options
-rw-r--r-- | src/avirt-config.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/avirt-config.c b/src/avirt-config.c index 491249e..7a993ad 100644 --- a/src/avirt-config.c +++ b/src/avirt-config.c @@ -1,6 +1,6 @@ /* * Application interface library for the AVIRT driver - * + * * avirt-config.c - Main AVIRT configuration via configfs * * Copyright (C) 2018 Fiberdyne Systems Pty Ltd @@ -128,7 +128,7 @@ static int mount_configfs() // Check whether /config dir exists, if not, create it if (stat("/config", &st) == -1) mkdir("/config", S_IRWXU | S_IRWXG | S_IRWXO); - + err = mount("none", "/config", "configfs", 0, NULL); if (!err) { @@ -369,8 +369,6 @@ int snd_avirt_stream_new(const char *name, unsigned int channels, int direction, int snd_avirt_card_seal() { - int open_dev, err = 0; - snd_ctl_card_info_t *card_info; char path_sealed[AVIRT_CONFIGFS_PATH_MAXLEN]; // Check if card is already sealed @@ -389,31 +387,13 @@ int snd_avirt_card_seal() AVIRT_DEBUG("Card sealed!"); card_sealed = true; - usleep(20000); // Need to wait for the snd card to be registered - - // Get card index for AVIRT, now that it is registered - open_dev = open(AVIRT_DEVICE_PATH, O_RDONLY); - if (open_dev < 0) - { - AVIRT_ERROR_V("Could not open device with path: %s", AVIRT_DEVICE_PATH); - err = -ENODEV; - goto exit_dev; - } + if (card_index < 0) + card_index = snd_avirt_card_index_get(0); + if (card_index < 0) + return card_index; - snd_ctl_card_info_alloca(&card_info); - err = ioctl(open_dev, - SNDRV_CTL_IOCTL_CARD_INFO(snd_ctl_card_info_sizeof()), - card_info); - if (err < 0) - { - AVIRT_ERROR("Could not ioctl card info for AVIRT"); - goto exit_dev; - } - card_index = snd_ctl_card_info_get_card(card_info); -exit_dev: - close(open_dev); - return err; + return 0; } |