Bug 25799

Summary: pcm doesn't always autocreate device aliases w/ DEVFS
Product: Base System Reporter: Alex Kapranoff <alex>
Component: kernAssignee: cg
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Alex Kapranoff 2001-03-14 11:50:01 UTC
I have the following sound-related devices in /dev after boot:

crw-rw-rw-  1 root  wheel      30,  20 14 ÍÁÒ 13:39 /dev/audio1.0
crw-rw-rw-  1 root  wheel      30, 0x00010014 14 ÍÁÒ 13:39 /dev/audio1.1
crw-rw-rw-  1 root  wheel      30,  19 14 ÍÁÒ 13:39 /dev/dsp1.0
crw-rw-rw-  1 root  wheel      30, 0x00010013 14 ÍÁÒ 13:39 /dev/dsp1.1
crw-rw-rw-  1 root  wheel      30,  21 14 ÍÁÒ 13:39 /dev/dspW1.0
crw-rw-rw-  1 root  wheel      30, 0x00010015 14 ÍÁÒ 13:39 /dev/dspW1.1
crw-rw-rw-  1 root  wheel      30,  16 14 ÍÁÒ 13:39 /dev/mixer1
cr--r--r--  1 root  wheel      30,   6 14 ÍÁÒ 13:39 /dev/sndstat

And sysctl hw.snd.unit is (default value):
hw.snd.unit: 0

pcm driver does not create /dev/{audio,dsp,dspW,mixer} aliases because
it tries to use unit 0 (according to hw.snd.unit), whereas my box only
have unit 1. See /sys/dev/sound/pcm/sound.c:pcm_makelinks()

Fix: First, you can set hw.snd.unit to 1 or whatever in your kernel
hints file or in /boot/device.hints.

Next, you can set hw.snd.unit to 1 by appending
'hw.snd.unit=1' to your /etc/rc.sysctl file.

And last. With proposed patch, hw.snd.unit defaults to '-1'
which now means 'autoselect the first existing unit for
making aliases in /dev'. This variant is prefered :)

This PR supercedes my old and rather lame kern/21308 so whoever cares
please close kern/21308 as soon as this one.
Comment 1 Kris Kennaway freebsd_committer freebsd_triage 2001-03-24 05:51:15 UTC
Responsible Changed
From-To: freebsd-bugs->cg

Cameron is the sound guy
Comment 2 gandalf 2001-03-24 17:13:09 UTC
your hints for pcm0 are invalid.  for an sb16, pcm will attach to sbc
automatically.  you are creating a phantom pcm0 device.

on a correctly configured system, the first sound device will always be
pcm0, so this patch is unnecessary.

    -cg
Comment 3 Alex Kapranoff 2001-03-25 06:54:51 UTC
On Sat, Mar 24, 2001 at 05:13:09PM -0000, Cameron Grant wrote:
> your hints for pcm0 are invalid.  for an sb16, pcm will attach to sbc
> automatically.  you are creating a phantom pcm0 device.

  I've just cleared my hints file from old cruft generated by
`gethints.pl' when I first ran it long long time ago. And indeed pcm1
weirdness has gone away. I now have pretty straightforward sbc0 & pcm0
pair. Thanks for your advice, Cameron!

> on a correctly configured system, the first sound device will always be
> pcm0, so this patch is unnecessary.

  Yes, and therefore PR should be closed now.

  Thanks again for the wonderful sound experience I have with FreeBSD :)

-- 
Alex Kapranoff,                              Voice: +7(0832)791845
We've lived 11 weeks in the brand new millenium...
Comment 4 greid freebsd_committer freebsd_triage 2001-04-08 22:28:26 UTC
State Changed
From-To: open->closed

User error; submitter requests closure