From nobody Wed Oct 2 20:11:57 2024 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XJmDp3p3vz5Y22F for ; Wed, 02 Oct 2024 20:12:10 +0000 (UTC) (envelope-from haramrae@gmail.com) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XJmDp1y4Nz4cxZ; Wed, 2 Oct 2024 20:12:10 +0000 (UTC) (envelope-from haramrae@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a90f263c60fso1620566b.3; Wed, 02 Oct 2024 13:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727899929; x=1728504729; darn=freebsd.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VKr4u9F18rez1MN2qWIpLw5XnlhLm6rRTtmOR4/Ar0o=; b=L3eTXbqC5bIkBPzDYbrEArtZ8BgCSQbndY38cfIYn1ljC3H+MuEmi9kad4wShJHq2f 0exRNPvk9tPXvH75XGUqioDFF+yZsDgsiSHtl4ZYPTK5tbPF5S12ooSQsBmfmcAVo6S8 5XwZdtB+gFaJyiMVewoYR/+jYOQUXC7okzqz++9INGJ/eGuDhK1mnlVIkWKydc7bBtlJ SVnUvBWqHGITrU8nVwSajPCL8H9em7rkCnJ9DWb0jyEoQHEEI9indqKhYncr0ziQ35H0 oIeQRwvHv0n7kAYRW9Woz9HPPyjJVx4OtxaT/ecvj65ZtPqnIfrqIS5guvLjQXiS9Rxg qN+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727899929; x=1728504729; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VKr4u9F18rez1MN2qWIpLw5XnlhLm6rRTtmOR4/Ar0o=; b=Hh2v4GBK40FRivxvr6YRKj7K9tvgue4POl+pRYaF2aN/J/rUMbswRzi7vWXL9Dsz7a NYFxwP8VrLb4h4pEy9FBiJ3abLTPrJqitGuPNulxvmHytQMmCCHNaQ+DBTRIogz/x/h9 Mg95PDdcnWFhq1vBpExBgFlyDBIM/Q3OpYc5i8gzBpRBSwRtLO61hKDAqPpQu7Ks7+RB faI3Lc305+qorufuIDnkxcPoTGGtnVz2x00nmoZZ0bSn3p9X15RjW+3MfGLBG0OQlWfW gb+JaW9wJy89HYqoXiLNVtiIzu0Tv269MKj+8lNr3NVJfJB56CiuXF1S1jw5jfPYi/nz EOiQ== X-Gm-Message-State: AOJu0YwoXU6NvMlY6kF0DcNzrxu7d4ZiR6Xkzg4bcYCVIyFrYSNKFFGQ NAR/kwCOcgHS2PMVSVyZ+geN/JctFcuGjC1rog3dmyjy0EUqQet5TAdi1A== X-Google-Smtp-Source: AGHT+IFGbzh0u9e7vAmPAhEFCg4dA+zzEBzca0r0t5/pIJkAjZjuv+bhMD7EpDBXZqily7lB+ReUzw== X-Received: by 2002:a17:906:d553:b0:a90:3497:e138 with SMTP id a640c23a62f3a-a98f8386d7dmr137683766b.13.1727899928561; Wed, 02 Oct 2024 13:12:08 -0700 (PDT) Received: from smtpclient.apple ([188.212.112.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c277c056sm905873666b.33.2024.10.02.13.12.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Oct 2024 13:12:07 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-stable@freebsd.org Sender: owner-freebsd-stable@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3818.100.11.1.3\)) Subject: Re: uaudio device re-attach and persisting dev.pcm.$pcm.bitperfect sysctl From: Alban Hertroys In-Reply-To: <86ploiwxw8.fsf@ltc.des.dev> Date: Wed, 2 Oct 2024 22:11:57 +0200 Cc: freebsd-stable@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <8745F9FB-9CC1-476C-9445-DC0A7A76165F@gmail.com> References: <86ploiwxw8.fsf@ltc.des.dev> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= X-Mailer: Apple Mail (2.3818.100.11.1.3) X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4XJmDp1y4Nz4cxZ X-Spamd-Bar: ---- > On 2 Oct 2024, at 13:24, Dag-Erling Sm=C3=B8rgrav = wrote: >=20 > Alban Hertroys 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.