summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/sound
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1998-04-28 00:10:53 +0000
committerjulian <julian@FreeBSD.org>1998-04-28 00:10:53 +0000
commit7353226d849067a39d3ba63855a0c426201ca5e8 (patch)
tree55e610fc0e160764f9bbe419dbde3ab2d09056f6 /sys/i386/isa/sound
parentd0f45f30cc7a405fd0139e40548076737cc1cede (diff)
downloadFreeBSD-src-7353226d849067a39d3ba63855a0c426201ca5e8.zip
FreeBSD-src-7353226d849067a39d3ba63855a0c426201ca5e8.tar.gz
Submitted by: Doug Ambrisko <ambrisko@whistle.com>
make standard links for the first detected sound card.
Diffstat (limited to 'sys/i386/isa/sound')
-rw-r--r--sys/i386/isa/sound/soundcard.c54
1 files changed, 35 insertions, 19 deletions
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;
OpenPOWER on IntegriCloud