Re: uaudio device re-attach and persisting dev.pcm.$pcm.bitperfect sysctl

From: Warner Losh <imp_at_bsdimp.com>
Date: Sun, 06 Oct 2024 22:14:41 UTC
On Sun, Oct 6, 2024 at 2:55 AM Dag-Erling Smørgrav <des@freebsd.org> wrote:

> Alban Hertroys <haramrae@gmail.com> writes:
> > Originally I tried checking for the device using:
> >       test "`sysctl -n dev.pcm.${PCM}.%desc`" = 'Topping D90SE’
> > , but that statement seems to require the double-quotes for test to
> > accept it, which conflict with the double-quotes of the action
> > string. I couldn’t find a way to escape those inner quotes. So that’s
> > another issue I ran into, although approaches to use the USB attach
> > event for matching the dsp device to the usb device are clearly
> > superior to reading out a sysctl that’s an effect of it.
>
> You realize you can just put everything in a shell script which devd
> invokes, right?
>

That would also have the advantage of knowing which device(s) were
involved, so it
could be parameterized rather than being hard-coded to something that's
usually true but
might fail if you, for example, start playing with bluetooth headphones
that may or may not
be present at boot...

Warner