[alsa-devel] Have multiple opens removed on one device?

Scott Jiang scott.jiang.linux at gmail.com
Mon Aug 29 12:11:15 CEST 2011

2011/8/22 Mark Brown <broonie at opensource.wolfsonmicro.com>:
> On Mon, Aug 22, 2011 at 12:15:58PM +0200, Takashi Iwai wrote:
>> Scott Jiang wrote:
>> > In kernel 2.6.34 I can use aplay to play audio at the same time, alsa
>> > will mix the audio.
>> No, kernel part doesn't do such a thing.  If it's mixed, it must be
>> in the user-space (either dmix or a daemon like pulseaudio), unless
>> you hardware can do mixing by itself.
> There *are* some cards (mostly older ones like emu10k) that support
> multiple streams transparently but this has never been supported in
> ASoC due a lack of hardware that can do it.

Hi Mark,

Indeed we use dmix. But now we can't open the same device twice.
Our alsa lib and utils version is 1.0.18.
The test command: aplay 1.wav &; aplay 1.wav
In 2.6.34, strace
open("/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK) = 4
open("/dev/snd/pcmC0D0p", O_RDWR|O_APPEND|O_NONBLOCK) = 4

In 3.0, strace
open("/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK) = 4
open("/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK) = -1 EBUSY (Device or
resource busy)

The O_APPEND flag missed in new kernel. But we use the same lib and
utils. It's strange.
And I found the prefer subdevice changes from 0 to -1. These two
changes cause kernel return device busy.

Mark, can you do this simple test on your board? I appreciate your
help. Thank you very much.


More information about the Alsa-devel mailing list