Friday, June 28, 2024

Re: make usb audio device always rsnd/1 - not rsnd/2

On Fri, Jun 28, 2024 at 11:56:11AM +0200, Divan Santana wrote:
> Thanks to all for the suggestions!
>
> >> How can one make "Creative Creative BT-W5" device always rsnd/1 and not
> > A -workaround- is:
> >   Don't explicitly name an audio device in your commands.
> >   Use the environment variable AUDIODEVICE instead.
> > You would -source- a shell script which looked at (for instance) dmesg
> > and deduced the correct setting. There may be a library call which
> > returns something useful like a serial number, manufacturer, etcThat
> > script would only have to be run once a session.
>
> I think this may do it :)

If all you want to do is discover the current u.* device number that has
been assigned to a particular textual device ID, and you're happy with
parsing dmesg to do that, a starting point using sed would be:

dmesg | sed -n -E 's/^u[a-z]*(.) .*ID_STRING.*/\1/p' | tail -1

Obviously refine as required for your particular use-case, but in
principle it can be done fairly easily from the shell.

No comments:

Post a Comment