Here is a short patch for devfsv11 (2.1.79), which add the audio
devices. If somebody can test it...
Regards,
--
Eric Dumas (dumas@Linux.EU.Org, dumas@freenix.fr)
http://www.freenix.fr/~dumas/
-- Linux -- Linux -- Linux -- Linux -- Linux -- Linux -- Linux -- Linux --
diff -u --recursive linux-old/Documentation/filesystems/devfs/README linux/Documentation/filesystems/devfs/README
--- linux-old/Documentation/filesystems/devfs/README Thu Jan 22 14:01:59 1998
+++ linux/Documentation/filesystems/devfs/README Thu Jan 22 13:07:14 1998
@@ -379,6 +379,7 @@
- Parallel port printers (/dev/lp*)
+- Sound devices (/dev/sound/*)
Naming Scheme <section>
=============
@@ -466,3 +467,7 @@
Floppy discs <subsection>
------------
Floppy discs are placed in the /dev/floppy directory.
+
+Sound devices <subsection>
+-------------
+Sound devices are placed in the /dev/sound directory (audio, sequencer, ...)
+
diff -u --recursive linux-old/Documentation/filesystems/devfs/mk-devlinks linux/Documentation/filesystems/devfs/mk-devlinks
--- linux-old/Documentation/filesystems/devfs/mk-devlinks Thu Jan 22 14:01:59 1998
+++ linux/Documentation/filesystems/devfs/mk-devlinks Thu Jan 22 14:08:23 1998
@@ -107,3 +107,17 @@
rm /dev/$i
ln -s /devfs/$i /dev
end
+
+# Make sound devices links
+if ( ! -d sound ) mkdir sound
+ln -sf /devfs/sound /dev
+foreach i (mixer sequencer midi00 dsp audio sequencer2 mixer1 patmgr0 midi01\
+ dsp1 audio1 patmgr1 midi02 midi03)
+
+ if ( -f /dev/$i ) then
+ rm /dev/$i
+ ln -s /devfs/$i /dev
+ endif
+end
+
+
diff -u --recursive linux-old/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c
--- linux-old/drivers/sound/soundcard.c Tue Dec 30 20:02:39 1997
+++ linux/drivers/sound/soundcard.c Thu Jan 22 13:56:42 1998
@@ -15,6 +15,7 @@
* integrated sound_switch.c and made /proc/sound (equals to /dev/sndstat,
* which should disappear in the near future)
*/
+/* 22/1/98 -- Eric Dumas <dumas@Linux.EU.Org> -- devfs support */
#include <linux/config.h>
@@ -34,6 +35,10 @@
#include <linux/delay.h>
#include <linux/proc_fs.h>
+#ifdef CONFIG_DEVFS_FS
+# include <linux/devfs_fs.h>
+#endif
+
#define SOUND_CORE
#include "soundmodule.h"
@@ -78,7 +83,14 @@
static mixer_vol_table mixer_vols[MAX_MIXER_DEV];
static int num_mixer_volumes = 0;
+#ifdef CONFIG_DEVFS_FS
+static void manage_devfs_entries (int, char);
+static void *devfs_handle = NULL;
+#define MANAGE_DEVFS_REGISTER 1
+#define MANAGE_DEVFS_UNREGISTER 2
+#endif
+
int *load_mixer_volumes(char *name, int *levels, int present)
{
int i, n;
@@ -478,6 +490,12 @@
return -ENXIO;
}
in_use++;
+#ifdef CONFIG_DEVFS_FS
+ if (((dev & 0x0f) != SND_DEV_STATUS) &&
+ ((dev & 0x0f) != SND_DEV_CTL))
+ manage_devfs_entries(dev, MANAGE_DEVFS_REGISTER);
+#endif
+
#ifdef MODULE
SOUND_INC_USE_COUNT;
#endif
@@ -521,6 +539,11 @@
printk(KERN_ERR "Sound error: Releasing unknown device 0x%02x\n", dev);
}
in_use--;
+#ifdef CONFIG_DEVFS_FS
+ if (((dev & 0x0f) != SND_DEV_STATUS) &&
+ ((dev & 0x0f) != SND_DEV_CTL))
+ manage_devfs_entries(dev, MANAGE_DEVFS_UNREGISTER);
+#endif
#ifdef MODULE
SOUND_DEC_USE_COUNT;
#endif
@@ -776,6 +799,40 @@
sound_release
};
+
+#ifdef CONFIG_DEVFS_FS
+/* Register or unregister audio entries */
+static void manage_devfs_entries (int dev_minor, char action)
+{
+ char name[20];
+
+ static char *dev_name[] =
+ {"mixer", "sequencer", "midi00", "dsp",
+ "audio", "\0" /* sndstat */, "sequencer2",
+ "mixer1", "patmgr0", "midi01", "dsp1",
+ "audio1", "patmgr1", "midi02", "midi03",
+ NULL
+ };
+ if (dev_name[dev_minor][0] == '\0')
+ return;
+
+ if ((action != MANAGE_DEVFS_REGISTER) &&
+ (action != MANAGE_DEVFS_UNREGISTER))
+ return;
+
+
+ if (action == MANAGE_DEVFS_REGISTER)
+ {
+ sprintf (name, "sound/%s", dev_name[dev_minor]);
+ devfs_register (name, 0, 0, sound_major, dev_minor,
+ S_IFCHR | S_IRUGO | S_IWUGO, 0, 0,
+ &sound_fops, NULL);
+ }
+ else
+ devfs_unregister (devfs_handle, NULL, 0, sound_major, dev_minor);
+}
+#endif CONFIG_DEVFS_FS
+
#ifdef MODULE
static void
#else
@@ -805,6 +862,9 @@
}
#endif
+#ifdef CONFIG_DEVFS_FS
+ devfs_handle = devfs_mk_dir ("sound", 0);
+#endif
}
@@ -913,7 +973,9 @@
{
vfree(sound_mem_blocks[i]);
}
-
+#ifdef CONFIG_DEVFS_FS
+ unregister_chrdev(sound_major, "sound");
+#endif
}
#endif