From b04cb5ea8b26d8256f972d1404182f6cfa47c3f1 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Fri, 25 Jan 2019 18:52:14 +0100 Subject: Improve prints when setting values of control Improve prints when setting values of control by : - Increasing print level of error print - Printing more information when sent values array is not corresponding to the number of values of the control. Change-Id: I1ffe4bce78921e885da9dced21bd3bbb4e1c2aa6 Signed-off-by: Jonathan Aillet --- alsa-binding/Alsa-SetGet.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/alsa-binding/Alsa-SetGet.c b/alsa-binding/Alsa-SetGet.c index b23e8d7..5888b09 100644 --- a/alsa-binding/Alsa-SetGet.c +++ b/alsa-binding/Alsa-SetGet.c @@ -542,11 +542,16 @@ PUBLIC int alsaSetSingleCtl(snd_ctl_t *ctlDev, snd_ctl_elem_id_t *elemId, ctlReq break; } - if (length == 0) { - AFB_NOTICE("Invalid values NUMID='%d' Values='%s' count='%d' wanted='%d'", ctlRequest->numId, json_object_get_string(ctlRequest->valuesJ), length, count); + AFB_ERROR("Invalid values NUMID='%d' Values='%s' count='%d' wanted='%d'", ctlRequest->numId, json_object_get_string(ctlRequest->valuesJ), length, count); goto OnErrorExit; } + else if (valueIsArray && length < count) { + AFB_WARNING("Json Array provided to set values is to short (%i), control has %i values, last array value will be used to set remaining control value(s)", length, count); + } + else if (valueIsArray && length > count) { + AFB_WARNING("Json Array provided to set values is to long (%i), control has %i values, last array value(s) will be dropped", length, count); + } snd_ctl_elem_value_alloca(&elemData); snd_ctl_elem_value_set_id(elemData, elemId); // map ctlInfo to ctlId elemInfo is updated !!! @@ -570,7 +575,7 @@ PUBLIC int alsaSetSingleCtl(snd_ctl_t *ctlDev, snd_ctl_elem_id_t *elemId, ctlReq err = snd_ctl_elem_write(ctlDev, elemData); if (err < 0) { - AFB_NOTICE("Fail to write ALSA NUMID=%d Values='%s' Error=%s", ctlRequest->numId, json_object_get_string(ctlRequest->valuesJ), snd_strerror(err)); + AFB_ERROR("Fail to write ALSA NUMID=%d Values='%s' Error=%s", ctlRequest->numId, json_object_get_string(ctlRequest->valuesJ), snd_strerror(err)); goto OnErrorExit; } -- cgit 1.2.3-korg