diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-10-11 11:45:48 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-10-17 11:29:21 +0200 |
commit | dd706b1a0d0897130e749bcb5dcfc4fa954697b5 (patch) | |
tree | 4922f0042019c1c9abba27e6f98533b2ca1b4a6a /src/4a-internals-hal/4a-internals-hal-cb.c | |
parent | aab7f562b05bc8383b61ce40d8e198c85ea35786 (diff) |
Rework mixer calls to handle dependencies
Rework 'attach' mixer calls to handle dependencies individually.
That means that an attach call will be performed for each dependency.
To avoid errors when calling mixer, complete list of dependencies
should be send to it, but we can specify which dependency
we want to be processed using 'handled' key.
BUG-AGL: SPEC-2887
Change-Id: I9db7391fe7a44ba045fd82d94221a1442b7c2198
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'src/4a-internals-hal/4a-internals-hal-cb.c')
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-cb.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/4a-internals-hal/4a-internals-hal-cb.c b/src/4a-internals-hal/4a-internals-hal-cb.c index c5f19a2..1e872bb 100644 --- a/src/4a-internals-hal/4a-internals-hal-cb.c +++ b/src/4a-internals-hal/4a-internals-hal-cb.c @@ -725,6 +725,7 @@ int InternalHalHalMixerConfig(afb_api_t apiHandle, CtlSectionT *section, json_ob CtlConfigT *ctrlConfig; struct HalData *currentHalData; + struct InternalHalProbedDevice *currentProbedDevice; if(! apiHandle || ! section) return -1; @@ -752,17 +753,31 @@ int InternalHalHalMixerConfig(afb_api_t apiHandle, CtlSectionT *section, json_ob return -6; if(prefix) { - currentHalData->internalHalData->prefix = strdup(prefix); + currentHalData->internalHalData->prefix = strdup(prefix); if(! currentHalData->internalHalData->prefix) return -7; } } else if(currentHalData->status == HAL_STATUS_AVAILABLE) { - err = InternalHalAttachToMixer(apiHandle); - if(err) { - AFB_API_ERROR(apiHandle, "Error %i while attaching to mixer", err); - return -8; + cds_list_for_each_entry(currentProbedDevice, ¤tHalData->internalHalData->probedDevicesListHead, node) { + if(! currentProbedDevice->deviceData) { + currentProbedDevice->mixerLinkStatus = DEPENDENCY_MIXER_LINK_USELESS; + continue; + } + + if(currentProbedDevice->mixerLinkStatus == DEPENDENCY_MIXER_ATTACH_SUCCEED) { + AFB_API_WARNING(apiHandle, "Mixer status is already initialized, moving to next one"); + continue; + } + + err = InternalHalAttachDependencyToMixer(apiHandle, currentProbedDevice); + if(err) { + AFB_API_ERROR(apiHandle, "Error %i while attaching to mixer", err); + return -8; + } } + + currentHalData->status = HAL_STATUS_READY; } return 0; |