[alsa-devel] Why my linux OS has only 8 sound cards ? How can I modify it ?

Takashi Iwai tiwai at suse.de
Tue Nov 8 18:42:06 CET 2011


At Tue, 08 Nov 2011 18:37:53 +0100,
Clemens Ladisch wrote:
> 
> Takashi Iwai wrote:
> > Linus Torvalds wrote:
> > > Takashi, any idea? Do we have some 8-sound-card limit somewhere?
> > > 
> > > I do see that we have that odd
> > > 
> > >         if (card && card->number >= 8)
> > >                 return 0; /* ignore silently */
> > > 
> > > in sound/core/sound_oss.c: snd_register_oss_device(), but it has no
> > > comments. The thing goes back to 2005 with the commit log entry of
> > > "[ALSA] dynamic minors (6/6): increase maximum number of sound cards",
> > > but the value '8'isn't explained.
> > 
> > ALSA itself can support 32 cards when CONFIG_SND_DYNAMIC_MINORS is
> > set ...
> > The above code is, however, about OSS-emulation.  And I guess it's
> > just a left-over of the old static limitation.
> 
> Yes; I didn't change the limit in the OSS emulation because the minor
> number layout doesn't have space for all 32 cards, and extending the
> limit to 16 did not seem worth the effort for a 'legacy' interface.
> 
> > Actually OSS could support up to 16 cards (in theory).
> > 
> > Below is an untested fix patch.  Does it work?
> 
> Not without increasing SNDRV_OSS_MINORS, too:

Ah, good catch.  Below is the revised patch.


Takashi

---
From: Takashi Iwai <tiwai at suse.de>
Subject: [PATCH] ALSA: Fix the card number limit of OSS-emulation

There are left-over codes from the ancient days with the static device
number limitation of 8.  Actaully OSS can support up to 16 cards.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
v2: fix SNDRV_OSS_MINORS, too

 sound/core/sound_oss.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index c700920..e952833 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -35,7 +35,7 @@
 #include <linux/sound.h>
 #include <linux/mutex.h>
 
-#define SNDRV_OSS_MINORS 128
+#define SNDRV_OSS_MINORS 256
 
 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
 static DEFINE_MUTEX(sound_oss_mutex);
@@ -111,7 +111,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
 	int register1 = -1, register2 = -1;
 	struct device *carddev = snd_card_get_device_link(card);
 
-	if (card && card->number >= 8)
+	if (card && card->number >= SNDRV_MINOR_OSS_DEVICES)
 		return 0; /* ignore silently */
 	if (minor < 0)
 		return minor;
@@ -170,7 +170,7 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
 	int track2 = -1;
 	struct snd_minor *mptr;
 
-	if (card && card->number >= 8)
+	if (card && card->number >= SNDRV_MINOR_OSS_DEVICES)
 		return 0;
 	if (minor < 0)
 		return minor;
-- 
1.7.7



More information about the Alsa-devel mailing list