Re: Fw: PATCH: creating devices for multiple sound cards

Chris Rankin (rankinc@pacbell.net)
Thu, 02 Aug 2001 18:11:32 -0700 (PDT)


Hi,

Here is the updated version of this patch,

Cheers,
Chris

--- drivers/sound/sound_core.c.orig Tue Jul 31 18:26:12 2001
+++ drivers/sound/sound_core.c Tue Jul 31 18:41:45 2001
@@ -17,7 +17,7 @@
* plug into this. The fact they dont all go via OSS doesn't mean
* they don't have to implement the OSS API. There is a lot of logic
* to keeping much of the OSS weight out of the code in a compatibility
- * module, but its up to the driver to rember to load it...
+ * module, but its up to the driver to remember to load it...
*
* The code provides a set of functions for registration of devices
* by type. This is done rather than providing a single call so that
@@ -173,10 +173,10 @@
return r;
}

- if (r == low)
+ if ( r < SOUND_STEP )
sprintf (name_buf, "%s", name);
else
- sprintf (name_buf, "%s%d", name, (r - low) / SOUND_STEP);
+ sprintf (name_buf, "%s%d", name, (r / SOUND_STEP));
s->de = devfs_register (devfs_handle, name_buf,
DEVFS_FL_NONE, SOUND_MAJOR, s->unit_minor,
S_IFCHR | mode, fops, NULL);
@@ -231,9 +231,10 @@

int register_sound_special(struct file_operations *fops, int unit)
{
- char *name;
+ const int chain = (unit & 0x0F);
+ const char *name;

- switch (unit) {
+ switch (chain) {
case 0:
name = "mixer";
break;
@@ -241,7 +242,7 @@
name = "sequencer";
break;
case 2:
- name = "midi00";
+ name = "midi";
break;
case 3:
name = "dsp";
@@ -259,7 +260,7 @@
name = "unknown7";
break;
case 8:
- name = "sequencer2";
+ name = "music";
break;
case 9:
name = "dmmidi";
@@ -283,7 +284,7 @@
name = "unknown";
break;
}
- return sound_insert_unit(&chains[unit&15], fops, -1, unit, unit+1,
+ return sound_insert_unit(&chains[chain], fops, -1, unit, chain+128,
name, S_IRUSR | S_IWUSR);
}

> Why this patch was not applied (I checked 2.4.7)?
>
> ------ Forwarded message ------
> From: Chris Rankin <rankinc@pacbell.net>
> Date: Sat, 14 Apr 2001 09:44:35 +0200
> Subject: PATCH: creating devices for multiple sound cards
> To: linux-sound@vger.kernel.org
>
> Hi,
> I have just installed a new sound card in my machine, and have left
> the built-in sound chip enabled despite the motherboard manufacturer's
> warning of Bad Things. The result is that I now have two sound devices
> in my machine - an ICH (i810_audio) and a Soundblaster Live! The Live!
> is device 0, of course. Anyway, I am using the ALSA drivers because
> the native i810_audio module caused a kernel panic (NULL pointer
> reference in an interrupt handler, I believe), and I have noticed that
> the ALSA drivers have difficulty creating OSS device nodes for both
> cards. I have traced the problem to the register_sound_special()
> function within Linux's soundcore.o module. Basically, ALSA uses this
> function to create OSS devices, but this function was never written
> with more than one sound device in mind. Until now.
>
> A few points about this patch:
>
> 1. I have renamed "sequencer2" to "music" because of a potential naming
> conflict between devices 14,8 ("music" on card 0) and 14,33 ("sequencer"
> on card 2).
>
> 2. I have renamed device "midi00" to "midi". "midi01" now becomes "midi1"
> as well, although I would also point out that this is now consistent with
> the behaviour of the register_sound_midi() function.
>
> Having applied this patch, ALSA gives me two mixer devices in /dev/sound,
> and I no longer get messages like these in my logs:
>
> Apr 12 01:36:54 (none) kernel: devfs: devfs_register(): device already registered: "unknown"
>
> Apr 12 01:40:04 (none) kernel: devfs: devfs_register(): device already registered: "mixer"
> Apr 12 01:40:04 (none) kernel: devfs: devfs_register(): device already registered: "dsp"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/