summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-24 14:30:39 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-25 11:18:02 +0200
commite62be7bd8ee0ad8fcd0c5a9f7c1f5831d789c5b4 (patch)
treea5e218de69731c76df88c8eab53b67fa66330ce6
parentb04fa40a782d490aae4aefa1315a009051e26db6 (diff)
Avoid unnecessary overwriting of ALSA ctrl data
Avoid overwriting stored ALSA control properties data when only calling to get current ALSA control values. BUG-AGL: SPEC-2329 Change-Id: Iaaef1266aea334c8799ab31fd2e523871be9b3a7 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--src/4a-internals-hal/4a-internals-hal-alsacore-link.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/4a-internals-hal/4a-internals-hal-alsacore-link.c b/src/4a-internals-hal/4a-internals-hal-alsacore-link.c
index 6cfdfba..0243a7b 100644
--- a/src/4a-internals-hal/4a-internals-hal-alsacore-link.c
+++ b/src/4a-internals-hal/4a-internals-hal-alsacore-link.c
@@ -194,7 +194,7 @@ int InternalHalSubscribeToAlsaCardEvent(afb_api_t apiHandle, char *cardId)
int InternalHalGetAlsaCtlInfo(afb_api_t apiHandle, char *cardId, struct InternalHalAlsaCtl *currentAlsaCtl, json_object **returnedDataJ)
{
- int err = 0, wrapRet;
+ int wrapRet;
char *returnedError = NULL, *returnedInfo = NULL;
@@ -219,7 +219,7 @@ int InternalHalGetAlsaCtlInfo(afb_api_t apiHandle, char *cardId, struct Internal
if(currentAlsaCtl->name && currentAlsaCtl->numid > 0) {
AFB_API_DEBUG(apiHandle,
- "Both a control name (%s) and a control uid (%i) are specified, control uid will be used",
+ "Both a control name (%s) and a control id (%i) are specified, control id will be used",
currentAlsaCtl->name,
currentAlsaCtl->numid);
}
@@ -272,20 +272,15 @@ int InternalHalGetAlsaCtlInfo(afb_api_t apiHandle, char *cardId, struct Internal
ALSACORE_API);
return -7;
}
- else if(currentAlsaCtl->name && wrap_json_unpack(responseJ, "{s:i}", "id", &currentAlsaCtl->numid)) {
- AFB_API_ERROR(apiHandle, "Can't find alsa control 'id' from control 'name': '%s' on device '%s'", currentAlsaCtl->name, cardId);
- json_object_put(responseJ);
- return -8;
- }
*returnedDataJ = responseJ;
- return err;
+ return 0;
}
int InternalHalUpdateAlsaCtlProperties(afb_api_t apiHandle, char *cardId, struct InternalHalAlsaCtl *currentAlsaCtl)
{
- int err = 0;
+ int err;
char *name;
@@ -316,8 +311,7 @@ int InternalHalUpdateAlsaCtlProperties(afb_api_t apiHandle, char *cardId, struct
currentAlsaCtl->numid,
cardId,
json_object_get_string(returnedDataJ));
-
- err = -10;
+ err = -9;
}
else {
currentAlsaCtl->name = strdup(name);
@@ -352,7 +346,7 @@ int InternalHalGetAlsaCtlValues(afb_api_t apiHandle, char *cardId, struct Intern
cardId,
json_object_get_string(returnedValuesArrayJ));
- err = -9;
+ err = -8;
}
else if(! json_object_is_type(returnedValuesArrayJ, json_type_array)) {
AFB_API_ERROR(apiHandle,
@@ -361,7 +355,7 @@ int InternalHalGetAlsaCtlValues(afb_api_t apiHandle, char *cardId, struct Intern
cardId,
json_object_get_string(returnedValuesArrayJ));
- err = -10;
+ err = -9;
}
if(! err)