Submitted by: Doug Ambrisko <ambrisko@whistle.com>

make standard links for the first detected sound card.
This commit is contained in:
julian 1998-04-28 00:10:53 +00:00
parent 8761852d6a
commit c3aa1df517
3 changed files with 71 additions and 34 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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_ */