Page MenuHomeFreeBSD

D45835.id140470.diff
No OneTemporary

D45835.id140470.diff

diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -301,10 +301,10 @@
dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
{
struct dsp_cdevpriv *priv;
- struct pcm_channel *rdch, *wrch;
+ struct pcm_channel *rdch, *wrch, *ch;
struct snddev_info *d;
uint32_t fmt, spd;
- int error, rderror, wrerror;
+ int error, rderror, wrerror, dir;
/* Kind of impossible.. */
if (i_dev == NULL || td == NULL)
@@ -333,6 +333,21 @@
error = 0;
DSP_FIXUP_ERROR();
+ if (priv->simplex) {
+ /* We cannot request both directions at the same time. */
+ if (DSP_F_DUPLEX(flags))
+ error = ENOTSUP;
+ else {
+ /* Make sure we don't open in the opposite direction. */
+ dir = DSP_F_READ(flags) ? PCMDIR_PLAY : PCMDIR_REC;
+ CHN_FOREACH(ch, d, channels.pcm.opened) {
+ if (ch->direction == dir)
+ break;
+ }
+ if (ch != NULL)
+ error = ENOTSUP;
+ }
+ }
if (error != 0) {
PCM_UNLOCK(d);
PCM_GIANT_EXIT(d);

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 25, 8:03 PM (15 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27965095
Default Alt Text
D45835.id140470.diff (1 KB)

Event Timeline