diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-01-25 18:52:14 +0100 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-01-25 18:52:14 +0100 |
commit | b04cb5ea8b26d8256f972d1404182f6cfa47c3f1 (patch) | |
tree | eef4d7e6507cf24491c1796d950addde9299608c /alsa-binding | |
parent | 056aa12f69614263ce10328b9ef0742d73c650b4 (diff) |
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 <jonathan.aillet@iot.bzh>
Diffstat (limited to 'alsa-binding')
-rw-r--r-- | alsa-binding/Alsa-SetGet.c | 11 |
1 files 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; } |