From 67fc2c25d727888cb45a847971771f34674b68ff Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Sun, 3 Jun 2018 19:16:32 +0200 Subject: Handle hal status using card presence and mixer init Test audio card presence at hal startup using alsacore call. Handling a new state of hal. Move alsacore link files into 4a-hal-controllers. Check state of hal before mixer initialization call. Actualize hal state if mixer initlialization ends well. Add a sndCardId filed to 'SpecificHalData' structure which will contain audio card if (from alsa). Change-Id: I2e82a14ee6ba6e63f06fe2b498587783941b7b98 Signed-off-by: Jonathan Aillet --- 4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c') diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c index 972cc53..6656ddc 100644 --- a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c +++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c @@ -29,6 +29,7 @@ #include "../4a-hal-utilities/4a-hal-utilities-verbs-loader.h" #include "4a-hal-controllers-api-loader.h" +#include "4a-hal-controllers-alsacore-link.h" #include "4a-hal-controllers-cb.h" // Default api to print log when apihandle not available @@ -90,7 +91,6 @@ static int HalCtlsInitOneApi(afb_dynapi *apiHandle) // Fill SpecificHalDatadata structure currentCtlHalData->internal = (unsigned int) true; - currentCtlHalData->status = HAL_STATUS_UNAVAILABLE; currentCtlHalData->apiName = (char *) ctrlConfig->api; currentCtlHalData->sndCard = (char *) ctrlConfig->uid; @@ -105,8 +105,11 @@ static int HalCtlsInitOneApi(afb_dynapi *apiHandle) currentCtlHalData->ctlHalSpecificData->ctlHalStreamsData.count = 0; - // TODO JAI: Search for hw sndCard - // TODO JAI: Update alsa command of HalCtl to use alsa-softmixer/alsa-core data + if(HalCtlsGetCardIdByCardPath(apiHandle, currentCtlHalData)) + currentCtlHalData->status = HAL_STATUS_AVAILABLE; + else + currentCtlHalData->status = HAL_STATUS_UNAVAILABLE; + // TODO JAI: handle refresh of hal status using /dev/snd/byId (or /dev/snd/byId) return CtlConfigExec(apiHandle, ctrlConfig); -- cgit 1.2.3-korg