Date: Wed, 2 Oct 2024 22:11:57 +0200 From: Alban Hertroys <haramrae@gmail.com> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@freebsd.org> Cc: freebsd-stable@freebsd.org Subject: Re: uaudio device re-attach and persisting dev.pcm.$pcm.bitperfect sysctl Message-ID: <8745F9FB-9CC1-476C-9445-DC0A7A76165F@gmail.com> In-Reply-To: <86ploiwxw8.fsf@ltc.des.dev> References: <F61ECC96-6FCB-4A4E-9EEC-8D6AF31A8A62@gmail.com> <86ploiwxw8.fsf@ltc.des.dev>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 2 Oct 2024, at 13:24, Dag-Erling Sm=C3=B8rgrav <des@freebsd.org> = wrote: >=20 > Alban Hertroys <haramrae@gmail.com> writes: >> I have a number of sysctl=E2=80=99s in /etc/sysctl.conf to tune my = audio output: >>=20 >> hw.snd.default_unit=3D2 >> hw.snd.maxautovchans=3D0 >> dev.pcm.2.play.vchans=3D0 >> dev.pcm.2.bitperfect=3D1 >=20 > This only works by accident because your DSP happens to be switched on > and attached to pcm2 when sysctl.conf is processed during boot. If = you > boot your machine with the DSP switched off or unplugged, you will see > errors during boot because these sysctl nodes do not exist until the = DSP > is turned on and the driver attaches to it. You need to set up devd = to > run the correct sysctl commands (with the correct device unit numbers, > don't assume your DSP is always pcm2!) when your DSP is attached. Those sysctl's happen to be what several posts on the FreeBSD forums = advise for setting up USB DACs. That=E2=80=99s where I got my info when = setting this up a while ago (during 13.1-RELEASE, I=E2=80=99d be a = little hard-pressed to provide URL=E2=80=99s now). Just pointing out the = trap there. Meanwhile, several people here suggested that devd is the way to go = about this. I had actually looked into that a bit, but that seemed to = require a related device node in /dev, and there=E2=80=99s neither one = for pcm nor for uaudio, so I discarded that as not being a viable = option. Perhaps too soon. I=E2=80=99ve been trying a bit, but I=E2=80=99m unfamiliar with = devd.conf, so I got stuck at the point of: notify 100 { match "system" "USB"; match "subsystem" "DEVICE"; match "type" "ATTACH"; match "vendor" "0x152a"; match "product" "0x8750"; action "PCM=3D`sysctl dev.pcm | grep 'Topping D90SE' | cut -d . = -f 3` && sysctl 'hw.snd.default_unit=3D${PCM} = dev.pcm.${PCM}.play.vchans=3D0 dev.pcm.$ }; I can see devd looking to match uaudio0 and pcm2 devices to several = names it knows (probably from other devd confs?), but it doesn=E2=80=99t = seem to match my attempt. Let alone that it got around to attempting to = parse my sh tidbit. Sysctl reports the device as: dev.uaudio.0.%pnpinfo: vendor=3D0x152a product=3D0x8750 devclass=3D0xef = devsubclass=3D0x02 devproto=3D0x01 sernum=3D"" release=3D0x0188 = mode=3Dhost intclass=3D0x01 intsubclass=3D0x01 intprotocol=3D0x20 dev.uaudio.0.%location: bus=3D0 hubaddr=3D5 port=3D4 devaddr=3D6 = interface=3D0 ugen=3Dugen0.6dev.uaudio.0.%driver: uaudio dev.uaudio.0.%desc: Topping D90SE, class 239/2, rev 2.00/1.88, addr 14 dev.uaudio.%parent:=20 Corrections and improvements are welcome. How to use the actual device = name from the event as a variable in grep instead of hard-coding it, for = example. Meanwhile, I have my hopes up for what Christos comes up with. Regards, Alban Hertroys -- Als je de draak wilt steken met iemand, dan helpt het, als die een punthoofd heeft.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8745F9FB-9CC1-476C-9445-DC0A7A76165F>