summaryrefslogtreecommitdiffstats
path: root/plugins/alsa
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-11-08 13:59:50 +0100
committerThierry Bultel <thierry.bultel@iot.bzh>2018-11-08 13:59:50 +0100
commita17d5239d2e72daa25a07a761fcece345701c7ff (patch)
tree363ea7f8934b3e2c1ceb1b8a7f3c4a66c49f450f /plugins/alsa
parent92e0380860dbc556ef2a1f9fbc0cd7eb99edad69 (diff)
Fix the error string of attach actions
Fixes the "syntax-error" to something more explicit (SPEC-1906) Change-Id: I9d4c81ee1d62dcfb99799480c6dc910e2019a791 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa')
-rw-r--r--plugins/alsa/alsa-api-loop.c14
-rw-r--r--plugins/alsa/alsa-api-ramp.c4
-rw-r--r--plugins/alsa/alsa-api-sink.c4
-rw-r--r--plugins/alsa/alsa-api-source.c6
-rw-r--r--plugins/alsa/alsa-api-streams.c6
-rw-r--r--plugins/alsa/alsa-api-zones.c4
6 files changed, 21 insertions, 17 deletions
diff --git a/plugins/alsa/alsa-api-loop.c b/plugins/alsa/alsa-api-loop.c
index e2d789e..61bdc99 100644
--- a/plugins/alsa/alsa-api-loop.c
+++ b/plugins/alsa/alsa-api-loop.c
@@ -100,14 +100,16 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
, "subdevs", &subdevsJ
);
if (error || !loop->uid || !subdevsJ || (!loop->sndcard->cid.devpath && !loop->sndcard->cid.cardid)) {
- AFB_ApiNotice(mixer->api, "AttachOneLoop mixer=%s hal=%s missing 'uid|path|cardid|devices|subdevs' error=%s args=%s", mixer->uid, uid, wrap_json_get_error_string(error),json_object_get_string(argsJ));
+ AFB_ApiNotice(mixer->api, "%s mixer=%s hal=%s missing 'uid|path|cardid|devices|subdevs' error=%s args=%s",
+ __func__, mixer->uid, uid, wrap_json_get_error_string(error),json_object_get_string(argsJ));
goto OnErrorExit;
}
// try to open sound card control interface
loop->sndcard->ctl = AlsaByPathOpenCtl(mixer, loop->uid, loop->sndcard);
if (!loop->sndcard->ctl) {
- AFB_ApiError(mixer->api, "AttachOneLoop mixer=%s hal=%s Fail open sndcard loop=%s devpath=%s cardid=%s (please check 'modprobe snd_aloop')", mixer->uid, uid, loop->uid, loop->sndcard->cid.devpath, loop->sndcard->cid.cardid);
+ AFB_ApiError(mixer->api, "%s mixer=%s hal=%s Fail open sndcard loop=%s devpath=%s cardid=%s (please check 'modprobe snd_aloop')",
+ __func__, mixer->uid, uid, loop->uid, loop->sndcard->cid.devpath, loop->sndcard->cid.cardid);
goto OnErrorExit;
}
@@ -118,7 +120,8 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
} else {
error = wrap_json_unpack(devicesJ, "{si,si !}", "capture", &loop->capture, "playback", &loop->playback);
if (error) {
- AFB_ApiNotice(mixer->api, "AttachOneLoop mixer=%s hal=%s Loop=%s missing 'capture|playback' error=%s devices=%s", mixer->uid, uid, loop->uid, wrap_json_get_error_string(error),json_object_get_string(devicesJ));
+ AFB_ApiNotice(mixer->api, "%s mixer=%s hal=%s Loop=%s missing 'capture|playback' error=%s devices=%s",
+ __func__, mixer->uid, uid, loop->uid, wrap_json_get_error_string(error),json_object_get_string(devicesJ));
goto OnErrorExit;
}
}
@@ -140,7 +143,8 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
}
break;
default:
- AFB_ApiError(mixer->api, "AttachOneLoop mixer=%s hal=%s Loop=%s invalid subdevs= %s", mixer->uid, uid, loop->uid, json_object_get_string(subdevsJ));
+ AFB_ApiError(mixer->api, "%s mixer=%s hal=%s Loop=%s invalid subdevs= %s",
+ __func__, mixer->uid, uid, loop->uid, json_object_get_string(subdevsJ));
goto OnErrorExit;
}
@@ -193,7 +197,7 @@ PUBLIC int ApiLoopAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
}
break;
default:
- AFB_IfReqFailF(mixer, request, "invalid-syntax", "mixer=%s hal=%s loops invalid argsJ= %s", mixer->uid, uid, json_object_get_string(argsJ));
+ AFB_IfReqFailF(mixer, request, "bad-loop", "mixer=%s hal=%s loops invalid argsJ= %s", mixer->uid, uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
diff --git a/plugins/alsa/alsa-api-ramp.c b/plugins/alsa/alsa-api-ramp.c
index 0b034e4..21ec165 100644
--- a/plugins/alsa/alsa-api-ramp.c
+++ b/plugins/alsa/alsa-api-ramp.c
@@ -81,7 +81,7 @@ PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
case json_type_object:
mixer->ramps[index] = AttachOneRamp(mixer, uid, argsJ);
if (!mixer->ramps[index]) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s hal=%s invalid ramp= %s", mixer->uid, uid, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "bad-ramp", "mixer=%s hal=%s invalid ramp= %s", mixer->uid, uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
break;
@@ -98,7 +98,7 @@ PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
json_object *streamAudioJ = json_object_array_get_idx(argsJ, idx);
mixer->ramps[index + idx] = AttachOneRamp(mixer, uid, streamAudioJ);
if (!mixer->ramps[index + idx]) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s hal=%s invalid ramp= %s", mixer->uid, uid, json_object_get_string(streamAudioJ));
+ AFB_ReqFailF(request, "bad-ramp", "mixer=%s hal=%s invalid ramp= %s", mixer->uid, uid, json_object_get_string(streamAudioJ));
goto OnErrorExit;
}
}
diff --git a/plugins/alsa/alsa-api-sink.c b/plugins/alsa/alsa-api-sink.c
index c8ad727..96437f5 100644
--- a/plugins/alsa/alsa-api-sink.c
+++ b/plugins/alsa/alsa-api-sink.c
@@ -74,7 +74,7 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
case json_type_object:
mixer->sinks[index] = ApiPcmAttachOne(mixer, uid, SND_PCM_STREAM_PLAYBACK, argsJ);
if (!mixer->sinks[index]) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "bad-pcm", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
@@ -101,7 +101,7 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
json_object *sinkJ = json_object_array_get_idx(argsJ, idx);
AlsaSndPcmT * pcm = ApiPcmAttachOne(mixer, uid, SND_PCM_STREAM_PLAYBACK, sinkJ);
if (!pcm) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(sinkJ));
+ AFB_ReqFailF(request, "bad-pcm", "mixer=%s invalid sink= %s", mixer->uid, json_object_get_string(sinkJ));
goto OnErrorExit;
}
// move from hardware to DMIX attach to sndcard
diff --git a/plugins/alsa/alsa-api-source.c b/plugins/alsa/alsa-api-source.c
index b6e1390..4f356b2 100644
--- a/plugins/alsa/alsa-api-source.c
+++ b/plugins/alsa/alsa-api-source.c
@@ -50,7 +50,7 @@ PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
case json_type_object:
mixer->sources[index] = ApiPcmAttachOne(mixer, uid, SND_PCM_STREAM_CAPTURE, argsJ);
if (!mixer->sources[index]) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid source= %s", mixer->uid, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "bad-pcm", "mixer=%s invalid source= %s", mixer->uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
break;
@@ -67,7 +67,7 @@ PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
json_object *sourceJ = json_object_array_get_idx(argsJ, idx);
mixer->sources[index + idx] = ApiPcmAttachOne(mixer, uid, SND_PCM_STREAM_CAPTURE, sourceJ);
if (!mixer->sources[index + idx]) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid source= %s", mixer->uid, json_object_get_string(sourceJ));
+ AFB_ReqFailF(request, "bad-pcm", "mixer=%s invalid source= %s", mixer->uid, json_object_get_string(sourceJ));
goto OnErrorExit;
}
}
@@ -81,4 +81,4 @@ PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
OnErrorExit:
return -1;
-} \ No newline at end of file
+}
diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c
index 07d86d1..9a5c5c2 100644
--- a/plugins/alsa/alsa-api-streams.c
+++ b/plugins/alsa/alsa-api-streams.c
@@ -546,7 +546,7 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
case json_type_object:
mixer->streams[index] = AttachOneStream(mixer, uid, prefix, argsJ);
if (!mixer->streams[index]) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid stream= %s", mixer->uid, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "bad-stream", "mixer=%s invalid stream= %s", mixer->uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
break;
@@ -566,7 +566,7 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
mixer->streams[index + idx] = AttachOneStream(mixer, uid, prefix, streamJ);
if (!mixer->streams[index + idx]) {
AFB_ReqFailF(request,
- "invalid-syntax",
+ "bad-stream",
"%s: mixer=%s invalid stream= %s",
__func__, mixer->uid, json_object_get_string(streamJ));
goto OnErrorExit;
@@ -583,6 +583,6 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
return 0;
OnErrorExit:
- printf("%s FAILED\n", __func__);
+ AFB_ApiError(mixer->api, "%s FAILED\n", __func__);
return -1;
}
diff --git a/plugins/alsa/alsa-api-zones.c b/plugins/alsa/alsa-api-zones.c
index 4ae3402..c8ab107 100644
--- a/plugins/alsa/alsa-api-zones.c
+++ b/plugins/alsa/alsa-api-zones.c
@@ -146,7 +146,7 @@ PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
case json_type_object: {
AlsaSndZoneT * zone = AttacheOneZone(mixer, uid, argsJ);
if (!zone) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid zone= %s", mixer->uid, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "bad-zone", "mixer=%s invalid zone= %s", mixer->uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
@@ -172,7 +172,7 @@ PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
json_object *zoneJ = json_object_array_get_idx(argsJ, idx);
AlsaSndZoneT * zone = AttacheOneZone(mixer, uid, zoneJ);
if (!zone) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid zone= %s", mixer->uid, json_object_get_string(zoneJ));
+ AFB_ReqFailF(request, "bad-zone", "mixer=%s invalid zone= %s", mixer->uid, json_object_get_string(zoneJ));
goto OnErrorExit;
}