From owner-freebsd-bugs Wed Mar 14 3:50: 9 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 7451737B71A for ; Wed, 14 Mar 2001 03:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2EBo1X82293; Wed, 14 Mar 2001 03:50:01 -0800 (PST) (envelope-from gnats) Received: from rbn-gw.bgtu.debryansk.ru (rbn-gw.bgtu.debryansk.ru [62.76.89.2]) by hub.freebsd.org (Postfix) with ESMTP id 607BB37B718 for ; Wed, 14 Mar 2001 03:46:44 -0800 (PST) (envelope-from alex@kapran.bitmcnit.bryansk.su) Received: from server.bitmcnit.bryansk.su (root@bitmcnit.bryansk.su [192.168.121.2]) by rbn-gw.bgtu.debryansk.ru (8.11.2/8.11.2) with ESMTP id f2EBjFC03807 for ; Wed, 14 Mar 2001 14:45:18 +0300 Received: (from uucp@localhost) by server.bitmcnit.bryansk.su (8.9.3/8.9.3) with UUCP id OAA30336 for FreeBSD-gnats-submit@freebsd.org; Wed, 14 Mar 2001 14:30:01 +0300 Received: (from alex@localhost) by kapran.bitmcnit.bryansk.su (8.11.3/8.11.3) id f2EBN3n00805; Wed, 14 Mar 2001 14:23:03 +0300 (MSK) (envelope-from alex) Message-Id: <200103141123.f2EBN3n00805@kapran.bitmcnit.bryansk.su> Date: Wed, 14 Mar 2001 14:23:03 +0300 (MSK) From: Alex Kapranoff Reply-To: alex@kapran.bitmcnit.bryansk.su To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/25799: pcm doesn't always autocreate device aliases w/ DEVFS Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 25799 >Category: kern >Synopsis: pcm doesn't always autocreate device aliases w/ DEVFS >Confidential: no >Severity: non-critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Mar 14 03:50:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Alex Kapranoff >Release: FreeBSD 5.0-CURRENT i386 >Organization: Internal Mongolia >Environment: System: FreeBSD kapran.bitmcnit.bryansk.su 5.0-CURRENT FreeBSD 5.0-CURRENT #2: Wed Mar 14 11:06:41 MSK 2001 root@kapran.bitmcnit.bryansk.su:/usr/src/sys/compile/KAPRAN i386 I have an old ISA non-PNP Sound Blaster 16 Vibra. It probes as follows: sbc0: at port 0x220-0x22f irq 5 drq 1 flags 0x15 on isa0 pcm1: on sbc0 using the following /boot/device.hints: hint.pcm.0.at="isa" hint.pcm.0.irq="5" hint.pcm.0.drq="1" hint.pcm.0.flags="0x15" hint.sbc.0.at="isa" hint.sbc.0.port="0x220" hint.sbc.0.irq="5" hint.sbc.0.drq="1" hint.sbc.0.flags="0x15" I use DEVFS. >Description: 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() >How-To-Repeat: >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. --- /sys/dev/sound/pcm/sound.c.orig Wed Mar 14 10:57:40 2001 +++ sound.c Wed Mar 14 13:46:23 2001 @@ -90,7 +90,7 @@ #ifdef USING_DEVFS int snd_unit; -TUNABLE_INT_DECL("hw.snd.unit", 0, snd_unit); +TUNABLE_INT_DECL("hw.snd.unit", -1, snd_unit); #endif SYSCTL_NODE(_hw, OID_AUTO, snd, CTLFLAG_RD, 0, "Sound driver"); @@ -193,8 +193,16 @@ } unit = snd_unit; - if (unit < 0 || unit > devclass_get_maxunit(pcm_devclass)) - return; + if (unit == -1) { + /* find the first unit */ + for(unit = 0; + unit <= devclass_get_maxunit(pcm_devclass); ++unit) + if (devclass_get_softc(pcm_devclass, unit) != NULL) + break; + } else { + if (unit < 0 || unit > devclass_get_maxunit(pcm_devclass)) + return; + } if (devclass_get_softc(pcm_devclass, unit) == NULL) return; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message