summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-utils-bypath.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-06-22 11:23:33 +0200
committerThierry Bultel <thierry.bultel@iot.bzh>2018-06-22 11:24:59 +0200
commit38f7eb2d7bad24276cd40f0a4766fc1b8d72bfbb (patch)
treeb1a23f884d05860f0b8552f194c5892ff4d82919 /plugins/alsa/alsa-utils-bypath.c
parent844108e91808f658b99259f888122674cc1b9c61 (diff)
alsa-utils-bypath: code & log cleanup
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-utils-bypath.c')
-rw-r--r--plugins/alsa/alsa-utils-bypath.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/plugins/alsa/alsa-utils-bypath.c b/plugins/alsa/alsa-utils-bypath.c
index 2dac0d8..e5a6ced 100644
--- a/plugins/alsa/alsa-utils-bypath.c
+++ b/plugins/alsa/alsa-utils-bypath.c
@@ -79,7 +79,7 @@ PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcm(SoftMixerT *mixer, AlsaDevInfoT *pcmDev, s
pcmDev->cardid = (const char*)cardid;
}
- // inherit CID fropm pcmDev
+ // inherit CID from pcmDev
pcmCtl->cid.cardid = pcmDev->cardid;
pcmCtl->cid.cardidx = pcmDev->cardidx;
pcmCtl->cid.device = pcmDev->device;
@@ -87,9 +87,12 @@ PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcm(SoftMixerT *mixer, AlsaDevInfoT *pcmDev, s
pcmCtl->cid.name=NULL;
pcmCtl->cid.longname=NULL;
- //error = snd_pcm_open(&pcmCtl->handle, pcmCtl->cid.cardid, direction, SND_PCM_NONBLOCK);
+ AFB_ApiInfo(mixer->api,
+ "%s OPEN PCM %s, direction %s\n",
+ __func__, pcmCtl->cid.cardid, direction==SND_PCM_STREAM_PLAYBACK?"playback":"capture");
+
error = snd_pcm_open(&pcmCtl->handle, pcmCtl->cid.cardid, direction, SND_PCM_NONBLOCK);
- if (error) {
+ if (error < 0) {
AFB_ApiError(mixer->api, "AlsaByPathOpenPcm: fail openpcm cardid=%s error=%s", pcmCtl->cid.cardid, snd_strerror(error));
goto OnErrorExit;
}
@@ -115,7 +118,9 @@ PUBLIC snd_ctl_t *AlsaByPathOpenCtl(SoftMixerT *mixer, const char *uid, AlsaSndC
cardInfo = AlsaCtlGetInfo(mixer, dev->cid.cardid);
if (!cardInfo) {
- AFB_ApiError(mixer->api, "AlsaByPathOpenCtl: uid=%s fail to find sndcard by path=%s id=%s", uid, dev->cid.devpath, dev->cid.cardid);
+ AFB_ApiError(mixer->api,
+ "%s: uid=%s fail to find sndcard by path=%s id=%s",
+ __func__, uid, dev->cid.devpath, dev->cid.cardid);
goto OnErrorExit;
}
@@ -130,11 +135,15 @@ PUBLIC snd_ctl_t *AlsaByPathOpenCtl(SoftMixerT *mixer, const char *uid, AlsaSndC
goto OnErrorExit;
if ((err = snd_ctl_open(&handle, dev->cid.cardid, 0)) < 0) {
- AFB_ApiError(mixer->api, "AlsaByPathOpenCtl uid=%s sndcard open fail cardid=%s longname=%s error=%s", uid, dev->cid.cardid, dev->cid.longname, snd_strerror(err));
+ AFB_ApiError(mixer->api,
+ "%s uid=%s sndcard open fail cardid=%s longname=%s error=%s",
+ __func__, uid, dev->cid.cardid, dev->cid.longname, snd_strerror(err));
goto OnErrorExit;
}
- AFB_ApiNotice(mixer->api, "AlsaCtlOpenByPath: uid=%s cardid=%s cardname=%s", uid, dev->cid.cardid, dev->cid.longname);
+ AFB_ApiNotice(mixer->api,
+ "%s: uid=%s cardid=%s cardname=%s",
+ __func__, uid, dev->cid.cardid, dev->cid.longname);
free(cardInfo);
return handle;