git: f60e99f45e81 - main - snd_uaudio: mark selected configurations

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Mon, 12 Feb 2024 11:08:49 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=f60e99f45e8197de2bc0970c7dd7f87148fdaf30

commit f60e99f45e8197de2bc0970c7dd7f87148fdaf30
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-02-12 11:05:47 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-02-12 11:07:50 +0000

    snd_uaudio: mark selected configurations
    
    snd_uaudio(4) selects the first maching rate/channel/bit/format/buffer
    configuration for use during attach, even though it will print the rest
    of the supported configurations detected. To make this clear, mark the
    selected playback and recording configurations with a "selected" string.
    
    Sponsored by: The FreeBSD Foundation
    MFC after: 2 weeks
    Reviewed by:    dev_submerge.ch
    Differential Revision:  https://reviews.freebsd.org/D43766
---
 sys/dev/sound/usb/uaudio.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index eb4b676d5e7d..26d95bf3ee9f 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -1051,11 +1051,12 @@ uaudio_attach(device_t dev)
 
 		for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) {
 			device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, "
-			    "2x%dms buffer.\n", i,
+			    "2x%dms buffer.%s\n", i,
 			    sc->sc_play_chan[i].usb_alt[x].sample_rate,
 			    sc->sc_play_chan[i].usb_alt[x].channels,
 			    sc->sc_play_chan[i].usb_alt[x].p_fmt->description,
-			    uaudio_buffer_ms);
+			    uaudio_buffer_ms,
+			    (x == 0) ? " (selected)" : "");
 		}
 	}
 	if (i == 0)
@@ -1081,11 +1082,12 @@ uaudio_attach(device_t dev)
 
 		for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) {
 			device_printf(dev, "Record[%u]: %d Hz, %d ch, %s format, "
-			    "2x%dms buffer.\n", i,
+			    "2x%dms buffer.%s\n", i,
 			    sc->sc_rec_chan[i].usb_alt[x].sample_rate,
 			    sc->sc_rec_chan[i].usb_alt[x].channels,
 			    sc->sc_rec_chan[i].usb_alt[x].p_fmt->description,
-			    uaudio_buffer_ms);
+			    uaudio_buffer_ms,
+			    (x == 0) ? " (selected)" : "");
 		}
 	}
 	if (i == 0)