diff options
author | julian <julian@FreeBSD.org> | 1998-04-28 00:10:53 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1998-04-28 00:10:53 +0000 |
commit | 7353226d849067a39d3ba63855a0c426201ca5e8 (patch) | |
tree | 55e610fc0e160764f9bbe419dbde3ab2d09056f6 | |
parent | d0f45f30cc7a405fd0139e40548076737cc1cede (diff) | |
download | FreeBSD-src-7353226d849067a39d3ba63855a0c426201ca5e8.zip FreeBSD-src-7353226d849067a39d3ba63855a0c426201ca5e8.tar.gz |
Submitted by: Doug Ambrisko <ambrisko@whistle.com>
make standard links for the first detected sound card.
-rw-r--r-- | sys/i386/isa/snd/sound.c | 48 | ||||
-rw-r--r-- | sys/i386/isa/sound/soundcard.c | 54 | ||||
-rw-r--r-- | sys/sys/devfsext.h | 3 |
3 files changed, 71 insertions, 34 deletions
diff --git a/sys/i386/isa/snd/sound.c b/sys/i386/isa/snd/sound.c index a630ec1..24fa61b 100644 --- a/sys/i386/isa/snd/sound.c +++ b/sys/i386/isa/snd/sound.c @@ -169,6 +169,7 @@ pcmattach(struct isa_device * dev) struct isa_device *dvp; int stat = 0; dev_t isadev; + void *cookie; if ( (dev->id_unit >= NPCM_MAX) || /* too many devs */ (snddev_last_probed == NULL) || /* last probe failed */ @@ -222,25 +223,44 @@ pcmattach(struct isa_device * dev) cdevsw_add(&isadev, &snd_cdevsw, NULL); #ifdef DEVFS +#define GID_SND GID_GAMES +#define UID_SND UID_ROOT +#define PERM_SND 0660 /* * XXX remember to store the returned tokens if you want to * be able to remove the device later + * + * Make links to first successfully probed unit. + * Attempts by later devices to make these links will fail. */ - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP, - DV_CHR, UID_ROOT, GID_WHEEL, 0600, "dsp%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP16, - DV_CHR, UID_ROOT, GID_WHEEL, 0600, "dspW%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_AUDIO, - DV_CHR, UID_ROOT, GID_WHEEL, 0600, "audio%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_CTL, - DV_CHR, UID_ROOT, GID_WHEEL, 0600, "mixer%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_STATUS, - DV_CHR, UID_ROOT, GID_WHEEL, 0600, "sndstat%n", dev->id_unit); + cookie = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP, + DV_CHR, UID_SND, GID_SND, PERM_SND, "dsp%n", dev->id_unit); + if (cookie) devfs_link(cookie, "dsp"); + + cookie = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP16, + DV_CHR, UID_SND, GID_SND, PERM_SND, "dspW%n", dev->id_unit); + if (cookie) devfs_link(cookie, "dspW"); + + cookie = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_AUDIO, + DV_CHR, UID_SND, GID_SND, PERM_SND, "audio%n", dev->id_unit); + if (cookie) devfs_link(cookie, "audio"); + + cookie = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_CTL, + DV_CHR, UID_SND, GID_SND, PERM_SND, "mixer%n", dev->id_unit); + if (cookie) devfs_link(cookie, "mixer"); + + cookie = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_STATUS, + DV_CHR, UID_SND, GID_SND, PERM_SND, "sndstat%n", dev->id_unit); + if (cookie) devfs_link(cookie, "sndstat"); + #if 0 /* these two are still unsupported... */ - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_MIDIN, - DV_CHR, UID_ROOT, GID_WHEEL, 0600, "midi%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_SYNTH, - DV_CHR, UID_ROOT, GID_WHEEL, 0600, "sequencer%n", dev->id_unit); + cookie = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_MIDIN, + DV_CHR, UID_SND, GID_SND, PERM_SND, "midi%n", dev->id_unit); + if (cookie) devfs_link(cookie, "midi"); + + cookie = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_SYNTH, + DV_CHR, UID_SND, GID_SND, PERM_SND, "sequencer%n", dev->id_unit); + if (cookie) devfs_link(cookie, "sequencer"); #endif #endif /* DEVFS */ diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c index ffbb8f6..c3cbbc0 100644 --- a/sys/i386/isa/sound/soundcard.c +++ b/sys/i386/isa/sound/soundcard.c @@ -396,7 +396,8 @@ sndattach(struct isa_device * dev) static int midi_initialized = 0; static int seq_initialized = 0; struct address_info hw_config; - + void *tmp; + unit = driver_to_voxunit(dev->id_driver); hw_config.io_base = dev->id_iobase; hw_config.irq = ipri_to_irq(dev->id_irq); @@ -451,31 +452,46 @@ sndattach(struct isa_device * dev) 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, +#define GID_SND GID_GAMES +#define UID_SND UID_ROOT +#define PERM_SND 0660 + /* + * make links to first successfully probed device, don't do it if + * duplicate creation of same node failed (ie. bad cookie returned) + */ + if (dev->id_driver == &opldriver){ + tmp = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_SEQ, + DV_CHR, UID_SND, GID_SND, PERM_SND, "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, + if (tmp) devfs_link(tmp, "sequencer"); + } else if (dev->id_driver == &mpudriver || + dev->id_driver == &sbmididriver || + dev->id_driver == &uartdriver){ + tmp = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_MIDIN, + DV_CHR, UID_SND, GID_SND, PERM_SND, "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, + if (tmp) devfs_link(tmp, "midi"); + } else { + tmp = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP, + DV_CHR, UID_SND, GID_SND, PERM_SND, "dsp%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP16, - DV_CHR, UID_ROOT, GID_WHEEL, 0666, + if (tmp) devfs_link(tmp, "dsp"); + tmp = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP16, + DV_CHR, UID_SND, GID_SND, PERM_SND, "dspW%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_AUDIO, - DV_CHR, UID_ROOT, GID_WHEEL, 0666, + if (tmp) devfs_link(tmp, "dspW"); + tmp = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_AUDIO, + DV_CHR, UID_SND, GID_SND, PERM_SND, "audio%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_CTL, - DV_CHR, UID_ROOT, GID_WHEEL, 0666, + if (tmp) devfs_link(tmp, "audio"); + tmp = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_CTL, + DV_CHR, UID_SND, GID_SND, PERM_SND, "mixer%n", dev->id_unit); - devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_STATUS, - DV_CHR, UID_ROOT, GID_WHEEL, 0666, + if (tmp) devfs_link(tmp, "mixer"); + tmp = devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_STATUS, + DV_CHR, UID_SND, GID_SND, PERM_SND, "sndstat%n", dev->id_unit); + if (tmp) devfs_link(tmp, "sndstat"); } #endif /* DEVFS */ return TRUE; diff --git a/sys/sys/devfsext.h b/sys/sys/devfsext.h index 6213d37..c805240 100644 --- a/sys/sys/devfsext.h +++ b/sys/sys/devfsext.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: devfsext.h,v 1.18 1998/04/20 03:57:38 julian Exp $ + * $Id: devfsext.h,v 1.19 1998/04/20 04:55:17 julian Exp $ */ #ifndef _SYS_DEVFSEXT_H_ @@ -78,6 +78,7 @@ dev_t devfs_vntodev __P((struct vnode *vn)); /* extract dev_t from devfs vn */ #define GID_KMEM 2 #define GID_OPERATOR 5 #define GID_BIN 7 +#define GID_GAMES 13 #define GID_DIALER 68 #endif /* !_SYS_DEVFSEXT_H_ */ |