X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Falsa%2Falsa.c;h=3bf41605ea22620ac1853171500dcdfc784c6313;hb=b08024a8363c7a019bebc05a25e2689e774326e8;hp=4ec98a9e5a384b8f630b40f7699a4d151e8fe510;hpb=83e9d586385097b957774d150a718ebaa7fcc3c9;p=libsigrok.git diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index 4ec98a9e..3bf41605 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -85,21 +85,21 @@ static int hw_opendev(int device_index) err = snd_pcm_open(&alsa->capture_handle, AUDIO_DEV, SND_PCM_STREAM_CAPTURE, 0); if (err < 0) { - g_warning("cannot open audio device %s (%s)", AUDIO_DEV, + sr_warn("cannot open audio device %s (%s)", AUDIO_DEV, snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params_malloc(&alsa->hw_params); if (err < 0) { - g_warning("cannot allocate hardware parameter structure (%s)", + sr_warn("cannot allocate hardware parameter structure (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params_any(alsa->capture_handle, alsa->hw_params); if (err < 0) { - g_warning("cannot initialize hardware parameter structure (%s)", + sr_warn("cannot initialize hardware parameter structure (%s)", snd_strerror(err)); return SR_ERR; } @@ -219,7 +219,7 @@ static int receive_data(int fd, int revents, void *user_data) count = snd_pcm_readi(alsa->capture_handle, inb, MIN(4096/4, alsa->limit_samples)); if (count < 1) { - g_warning("Failed to read samples"); + sr_warn("Failed to read samples"); return FALSE; } @@ -273,7 +273,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) err = snd_pcm_hw_params_set_access(alsa->capture_handle, alsa->hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - g_warning("cannot set access type (%s)", snd_strerror(err)); + sr_warn("cannot set access type (%s)", snd_strerror(err)); return SR_ERR; } @@ -281,40 +281,40 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) err = snd_pcm_hw_params_set_format(alsa->capture_handle, alsa->hw_params, SND_PCM_FORMAT_S16_LE); if (err < 0) { - g_warning("cannot set sample format (%s)", snd_strerror(err)); + sr_warn("cannot set sample format (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params_set_rate_near(alsa->capture_handle, alsa->hw_params, (unsigned int *) &alsa->cur_rate, 0); if (err < 0) { - g_warning("cannot set sample rate (%s)", snd_strerror(err)); + sr_warn("cannot set sample rate (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params_set_channels(alsa->capture_handle, alsa->hw_params, NUM_PROBES); if (err < 0) { - g_warning("cannot set channel count (%s)", snd_strerror(err)); + sr_warn("cannot set channel count (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params(alsa->capture_handle, alsa->hw_params); if (err < 0) { - g_warning("cannot set parameters (%s)", snd_strerror(err)); + sr_warn("cannot set parameters (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_prepare(alsa->capture_handle); if (err < 0) { - g_warning("cannot prepare audio interface for use (%s)", + sr_warn("cannot prepare audio interface for use (%s)", snd_strerror(err)); return SR_ERR; } count = snd_pcm_poll_descriptors_count(alsa->capture_handle); if (count < 1) { - g_warning("Unable to obtain poll descriptors count"); + sr_warn("Unable to obtain poll descriptors count"); return SR_ERR; } @@ -324,7 +324,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) err = snd_pcm_poll_descriptors(alsa->capture_handle, ufds, count); if (err < 0) { - g_warning("Unable to obtain poll descriptors (%s)", + sr_warn("Unable to obtain poll descriptors (%s)", snd_strerror(err)); free(ufds); return SR_ERR;