Re: Modular sound and kerneld

David Woodhouse (Dave@imladris.demon.co.uk)
Thu, 15 Jan 1998 18:11:53 +0000


bryan@Terran.ORG said:
> I've looked through the kernel source for any comments or suggestions
> on how to configure /etc/modules.conf so that all the appropriate
> modules are loaded properly and automatically when I try to use my
> soundcard. But I can't find any documentation. I got it working
> looking at the MODULE_PARM exports for sb_card.c, by loading all the
> modules by hand. Does anyone have an example modules.conf I can look
> at?

Try this patch.

conf.modules then looks like:

alias audio0 sb
alias midi0 sb
alias mixer0 sb
alias synth awe_wave

--- linux/drivers/sound/audio.c.orig Fri Jan 9 03:16:55 1998
+++ linux/drivers/sound/audio.c Fri Jan 9 03:24:05 1998
@@ -16,6 +16,10 @@
*/

#include <linux/config.h>
+#ifdef CONFIG_KERNELD
+#include <linux/string.h>
+#include <linux/kerneld.h>
+#endif

#include "sound_config.h"

@@ -79,8 +83,18 @@
else
bits = 8;

- if (dev < 0 || dev >= num_audiodevs)
+ if (dev < 0)
return -ENXIO;
+
+ if (dev >= num_audiodevs) {
+#ifdef CONFIG_KERNELD
+ char name[10];
+ sprintf(name,"audio%d",dev);
+ request_module(name);
+ if (dev >= num_audiodevs)
+#endif
+ return -ENXIO;
+ }

if ((ret = DMAbuf_open(dev, mode)) < 0)
return ret;
--- linux/drivers/sound/soundcard.c.orig Fri Jan 9 03:07:27 1998
+++ linux/drivers/sound/soundcard.c Fri Jan 9 03:16:02 1998
@@ -16,7 +16,10 @@
* which should disappear in the near future)
*/
#include <linux/config.h>
-
+#ifdef CONFIG_KERNELD
+#include <linux/string.h>
+#include <linux/kerneld.h>
+#endif

#include "sound_config.h"
#include <linux/types.h>
@@ -445,8 +448,15 @@
break;

case SND_DEV_CTL:
- if ((dev & 0xf0) && ((dev & 0xf0) >> 4) >= num_mixers)
- return -ENXIO;
+ if ((unsigned)((dev & 0xf0) >> 4) >= num_mixers) {
+#ifdef CONFIG_KERNELD
+ char name[10];
+ sprintf(name,"mixer%d",((dev & 0xf0) >> 4));
+ request_module(name);
+ if (((dev & 0xf0) >> 4) >= num_mixers)
+#endif
+ return -ENXIO;
+ }
break;

#ifdef CONFIG_SEQUENCER

-- 
----                              ----                              ----
David Woodhouse, Robinson College, CB3 9AN, England.   (+44) 0976 658355
    Dave@imladris.demon.co.uk        http://dwmw2.robinson.cam.ac.uk
	    finger pgp@dwmw2.robinson.cam.ac.uk for PGP key.