On Tue, 9 Oct 2001, Kai Vehmanen wrote:

> You have /dev/dsp opened for playback. Then:
>
>               int enable_bits = ~PCM_ENABLE_OUTPUT; /* disables playback */
>         ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &enable_bits) == -1)
>
> ... next you start writing data to the device, but forget to ever issue
> the actual trigger call (ie.
>
>       int enable_bits = PCM_ENABLE_OUTPUT;
>       ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &enable_bits);
>
> ). Now this causes a more-or-less complete system-freeze (SMP, user
> priviledges). The latest ecasound development version (2.1dev0) failed to
> ever start the audio device and thus triggered this bug. It took quite a
> while to trace down the problem. Finally S.Massy was able to pinpoint the
> problem to oss-emulation, and problem was resolved.
>
> Of course, this is really an application side problem (fixed in ecasound
> 2.1dev1 btw), but it might make sense to add a safety-bealt to the
> oss-emulation. OSS/comm drivers survived the buggy ecasound. Also ALSA's
> native pcm-interface survived (SND_PCM_START_EXPLICIT set, after buffer
> became full without an snd_pcm_start(), snd_pcm_writei() returned an
> error).

Thanks for this bug report. The following patch (already applied to CVS)
should fix this problem:

Index: pcm_oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/kernel/oss/pcm_oss.c,v
retrieving revision 1.101
diff -u -r1.101 pcm_oss.c
--- pcm_oss.c   2001/10/09 14:47:28     1.101
+++ pcm_oss.c   2001/10/09 16:11:13
@@ -506,6 +506,10 @@
                        snd_leave_user(fs);
                if (ret != -EPIPE && ret != -ESTRPIPE)
                        break;
+               /* test, if we can't store new data, because the stream */
+               /* has not been started */
+               if (runtime->status->state == SNDRV_PCM_STATE_PREPARED)
+                       return -EAGAIN;
        }
        return ret;
 }
@@ -556,6 +560,10 @@
                        snd_leave_user(fs);
                if (ret != -EPIPE && ret != -ESTRPIPE)
                        break;
+               /* test, if we can't store new data, because the stream */
+               /* has not been started */
+               if (runtime->status->state == SNDRV_PCM_STATE_PREPARED)
+                       return -EAGAIN;
        }
        return ret;
 }


                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
SuSE Linux    http://www.suse.com
ALSA project  http://www.alsa-project.org


_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to