Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142937531
D45835.id140470.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45835.id140470.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D45835: sound: Improve simplex handling in dsp_open()
Attached
Detach File
Event Timeline
Log In to Comment