diff options
-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; } |