Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 30837 - devfs needs patch to work with multiple sound cards [--> plasmaroo]
Summary: devfs needs patch to work with multiple sound cards [--> plasmaroo]
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: x86-kernel@gentoo.org (DEPRECATED)
URL: http://www.cs.helsinki.fi/linux/linux...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-10 10:00 UTC by iDave
Modified: 2003-11-11 19:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description iDave 2003-10-10 10:00:59 UTC
The 2.4.20-gentoo-r7 kernel has a bug: if you have more than one sound card, for only one of 
them will be created a /dev/dsp entry.

Reproducible: Always
Steps to Reproduce:
1. compile the kernel on a PC with more than a sound card
Actual Results:  
Couldn't find more than one /dev/dsp, and so couldn't use my brand new cmipci card

Expected Results:  
Devfs should have created two /dev/dsp entries

Sorry for my poor english.

If you go to the url above, you can find a patch. I've applied the patch MANUALLY to the gentoo-
sources-2.4.20-r7, and it works. Here you are the patch I've made against the 2.4.20-gentoo-r7 
kernel:
--- linux-2.4.20-gentoo-r7/drivers/sound/sound_core.c.orig      2003-10-
10 17:30:07.000000000 +0000
+++ linux-2.4.20-gentoo-r7/drivers/sound/sound_core.c   2003-10-10 17:33:23.000000000 
+0000
@@ -17,8 +17,9 @@
  *     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 it's up to the driver to rember 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
  *     we can hide any future changes in the internals (eg when we go to
@@ -174,10 +175,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);
@@ -232,17 +233,20 @@
  
 int register_sound_special(struct file_operations *fops, int unit)
 {
-       char *name;
+       const int chain = (unit & 0x0F);
+       int max_unit = chain + 128;
+       const char *name;
 
-       switch (unit) {
+       switch (chain) {
            case 0:
                name = "mixer";
                break;
            case 1:
                name = "sequencer";
+               max_unit = unit + 1;
                break;
            case 2:
-               name = "midi00";
+               name = "midi";
                break;
            case 3:
                name = "dsp";
@@ -261,6 +265,7 @@
                break;
            case 8:
                name = "sequencer2";
+               max_unit = unit + 1;
                break;
            case 9:
                name = "dmmidi";
@@ -281,10 +286,10 @@
                name = "admmidi";
                break;
            default:
-               name = "unknown";
+               name = "unknownX";
                break;
        }
-       return sound_insert_unit(&chains[unit&15], fops, -1, unit, unit+1,
+       return sound_insert_unit(&chains[chain], fops, -1, unit, max_unit,
                                 name, S_IRUSR | S_IWUSR);
 }

I hope this will be included in the next gentoo-sources

Here you are my machine info:
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: /var/tmp/portage/gcc-3.3.1-r4/work/gcc-3.3.1/configure --prefix=/usr --
bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/
3.3.1/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-
data/i686-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --
enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --
enable-languages=c,c++,f77,objc,java --enable-threads=posix --enable-long-long --disable-
checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-
version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/
3.3.1/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-
included-gettext --disable-multilib
Thread model: posix
gcc version 3.3.1 20030916 (Gentoo Linux 3.3.1-r4, propolice)

cdimage / # cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Pentium(R) 4 CPU 2.20GHz
stepping        : 4
cpu MHz         : 2205.045
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 clflush dts 
acpi mmx fxsr sse sse2 ss ht tm
bogomips        : 4404.01

cdimage / #
Comment 1 Tim Yamin (RETIRED) gentoo-dev 2003-10-10 16:18:54 UTC
I'll add this in some time tomorrow...
Comment 2 Tim Yamin (RETIRED) gentoo-dev 2003-10-11 06:40:43 UTC
In CVS.