From nobody Tue May 3 23:50:41 2022 X-Original-To: questions@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 0267F1AC40ED for ; Wed, 4 May 2022 00:10:45 +0000 (UTC) (envelope-from mazen@illumed.net) Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4KtHKc0HWHz3qq5 for ; Wed, 4 May 2022 00:10:44 +0000 (UTC) (envelope-from mazen@illumed.net) Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4KtHKR50Nyz9sRs for ; Wed, 4 May 2022 02:10:35 +0200 (CEST) References: <8635hq1j8c.fsf@mars.illumed.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illumed.net; s=MBO0001; t=1651623033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y/OqUFN9VoRJlqa3rtpKNZQtrl6JQbtUYu0cVQ4iNQY=; b=PIfKApFdwevHoZToLlKcZy14kBUura0SBIQImv4qsKzyJXRhzJLKgs0H1x0Dy3i3fy6gLL HZHnTUmByp6aqNQqVu5C2/SFu/Yi4uvJa4GB1U75hAFzA0FHhUkrgmDhO2ULf5I5yPdQJ/ cNg5St843Z85AA4D1ldzNfJ9dJofM0Oh923oURsjcMFlhgtPdphodaN0lJGpBTm6s2YGR6 b22/5zd70SyoXlJMYhh3SY8lLwW4my/SzoG9NeRPxTiyMV8MPv9/X3JP+zltuBGUCIqEkt 2pRt4hsumw2L0iMPIznuzgHTR+qbvmPeYALVMZwfIzgQBOvS0DKQnZk7GCWi3w== From: Mazin Fadl To: questions@freebsd.org Subject: Re: get uaudio pcm/mixer device name using devd Date: Tue, 03 May 2022 19:50:41 -0400 In-reply-to: <8635hq1j8c.fsf@mars.illumed.net> Message-ID: <86y1ziyx6v.fsf@mars.illumed.net> List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: 4KtHKc0HWHz3qq5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=illumed.net header.s=MBO0001 header.b=PIfKApFd; dmarc=pass (policy=none) header.from=illumed.net; spf=pass (mx1.freebsd.org: domain of mazen@illumed.net designates 80.241.56.151 as permitted sender) smtp.mailfrom=mazen@illumed.net X-Spamd-Result: default: False [-4.10 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[illumed.net:s=MBO0001]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:80.241.56.0/21]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[illumed.net:+]; DMARC_POLICY_ALLOW(-0.50)[illumed.net,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MLMMJ_DEST(0.00)[questions]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:199118, ipnet:80.241.56.0/21, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[80.241.56.151:from] X-ThisMailContainsUnwantedMimeParts: N I've solved my problem by referencing the kernel log in the action script to find the pcm/mixer device. The updated configuration in case it is useful to someone else: attach 100 { # find vendor and product ids to match against # from devinfo(8) or usbconfig(8) match "vendor" "0x040d"; match "product" "0x340b"; action "/etc/set_usb_audio.sh $device-name"; # for our device gives "uaudioN" }; in set_usb_audio.sh: pcm=$(grep -F "$1" /var/log/messages | grep -o 'pcm[[:digit:]]\+' | tail -n1) if [ -n "$pcm" ]; then logger set_usb_audio.sh: found usb audio playback on "$pcm" # set default audio card mixer -d "${pcm#pcm}" >/dev/null 2>&1 fi Possible path not taken is to use devinfo(8) output, instead of the message log, to find the pcm device but this was easiest. Regards, mazin