diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-06-09 17:59:18 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:52:51 +0200 |
commit | bf9611f54cc183d6a7d61d0e4754de963c154d3a (patch) | |
tree | c457168b51d9827886cbf2d02196fc853c9c51f8 /4a-hal | |
parent | fc6a9c748dab532faa2fbc2d27eeca169dd7e1ef (diff) |
Add a function to search for hal using its dev-id
Add a function that allows to search for an already ready hal
using its device id.
This function will be useful at mixer attach of hal to check if the alsa
device id is not already attach by another hal.
Change-Id: I2f46dca19a98310064ed1af772425bd9186e0a75
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal')
-rw-r--r-- | 4a-hal/4a-hal-utilities/4a-hal-utilities-data.c | 19 | ||||
-rw-r--r-- | 4a-hal/4a-hal-utilities/4a-hal-utilities-data.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c index d585f5d..b2c4b25 100644 --- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c +++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c @@ -187,6 +187,25 @@ struct SpecificHalData *HalUtlSearchHalDataByApiName(struct SpecificHalData **fi return NULL; } + +struct SpecificHalData *HalUtlSearchReadyHalDataByCarId(struct SpecificHalData **firstHalData, int cardId) +{ + struct SpecificHalData *currentApi; + + if(! firstHalData) + return NULL; + + currentApi = *firstHalData; + while(currentApi) { + if(currentApi->status == HAL_STATUS_READY && currentApi->sndCardId == cardId) + return currentApi; + + currentApi = currentApi->next; + } + + return NULL; +} + /******************************************************************************* * Hal Manager data handling functions * ******************************************************************************/ diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h index 16befde..a79a7f1 100644 --- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h +++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h @@ -96,6 +96,7 @@ uint8_t HalUtlRemoveSelectedHalFromList(struct SpecificHalData **firstHalData, s uint64_t HalUtlRemoveAllHalFromList(struct SpecificHalData **firstHalData); uint64_t HalUtlGetNumberOfHalInList(struct SpecificHalData **firstHalData); struct SpecificHalData *HalUtlSearchHalDataByApiName(struct SpecificHalData **firstHalData, char *apiName); +struct SpecificHalData *HalUtlSearchReadyHalDataByCarId(struct SpecificHalData **firstHalData, int cardId); // Exported verbs for 'struct HalMgrData' handling uint8_t HalUtlInitializeHalMgrData(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info); |