Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Mar 1998 23:26:15 +0100
From:      Eivind Eklund <eivind@yes.no>
To:        Vladimir Kushnir <kushn@mail.kar.net>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: DEVFS awareness for VoxWare?
Message-ID:  <19980323232615.54104@follo.net>
In-Reply-To: <Pine.BSF.3.96.980323225104.8534A-100000@kushnir.kiev.ua>; from Vladimir Kushnir on Mon, Mar 23, 1998 at 11:49:34PM %2B0200
References:  <Pine.BSF.3.96.980323225104.8534A-100000@kushnir.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 23, 1998 at 11:49:34PM +0200, Vladimir Kushnir wrote:
> Hello,
> Sorry if this does not belong here or just plain stupid.

It is usually better to submit patches through send-pr, in case nobody
take care of it immediately.  However, we're not picky - anybody
sending in enhancements deserve praise, not flames.

> Yes, I know fairly well this is not one of the urgent things (especially
> now), but since new sound driver does not yet support midi port, would not
> it make some sence to update a bit the old one? In particular, I mean
> adding DEVFS awareness to it. It doesn't seem to be too difficult (see
> patch below). It works (as it should to - after all, there's nothing new
> there). Unfortunately, I'm too ignorant as a programmer and can't suggest
> nothing better, but perhaps somebody would take a pain to improve it (to
> avoid silly code duplication with all unneeded if's) and add other
> supported cards (I've got only  Yamaha SA2 card with MSS and SB
> simulations and OPL3 FM)?   

Can you test if the following patch work for you?  This should cover
all cases (except trixmidi, which for some reason is removed from the
driver list, and which I thus can't test for.)

Index: soundcard.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/sound/soundcard.c,v
retrieving revision 1.63
diff -u -r1.63 soundcard.c
--- soundcard.c	1998/02/10 21:51:00	1.63
+++ soundcard.c	1998/03/23 22:21:30
@@ -26,8 +26,12 @@
  * SUCH DAMAGE.
  * 
  */
+#include "opt_devfs.h"
 
 #include <i386/isa/sound/sound_config.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /* DEVFS */
 
 #if NSND > 0	/* from "snd.h" */
 #include <vm/vm.h>
@@ -449,8 +453,34 @@
 	dev = makedev(CDEV_MAJOR, 0);
 	cdevsw_add(&dev, &snd_cdevsw, NULL);
     }
-
-
+#ifdef DEVFS
+    if (dev->id_driver == &opldriver)
+	devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_SEQ,
+			 DV_CHR, UID_ROOT, GID_WHEEL, 0666,
+			 "sequencer%n", dev->id_unit);
+    else if (dev->id_driver == &mpudriver || dev->id_driver == &sbmididriver ||
+	     dev->id_driver == &uartdriver)
+	devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_MIDIN,
+			 DV_CHR, UID_ROOT, GID_WHEEL, 0666,
+			 "midi%n", dev->id_unit);
+    else {
+	devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP,
+			 DV_CHR, UID_ROOT, GID_WHEEL, 0666,
+			 "dsp%n", dev->id_unit);
+	devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP16,
+			 DV_CHR, UID_ROOT, GID_WHEEL, 0666,
+			 "dspW%n", dev->id_unit);
+	devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_AUDIO,
+			 DV_CHR, UID_ROOT, GID_WHEEL, 0666,
+			 "audio%n", dev->id_unit);
+	devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_CTL,
+			 DV_CHR, UID_ROOT, GID_WHEEL, 0666,
+			 "mixer%n", dev->id_unit);
+	devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_STATUS,
+			 DV_CHR, UID_ROOT, GID_WHEEL, 0666,
+			 "sndstat%n", dev->id_unit);
+    }
+#endif /* DEVFS */
     return TRUE;
 }
 
If this works, I'll commit it.  (I've done a few style changes, which
you probably notice.)

Eivind.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980323232615.54104>