diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -2153,6 +2153,7 @@ uint8_t bits = uaudio_default_bits; uint8_t y; uint8_t channels = uaudio_default_channels; + uint8_t channels_max; uint8_t x; bits -= (bits % 8); @@ -2160,22 +2161,23 @@ /* set a valid value */ bits = 32; } + switch (usbd_get_speed(udev)) { + case USB_SPEED_LOW: + case USB_SPEED_FULL: + /* + * Due to high bandwidth usage and problems + * with HIGH-speed split transactions we + * disable surround setups on FULL-speed USB + * by default + */ + channels_max = 4; + break; + default: + channels_max = UAUDIO_CHANNELS_MAX; + break; + } if (channels == 0) { - switch (usbd_get_speed(udev)) { - case USB_SPEED_LOW: - case USB_SPEED_FULL: - /* - * Due to high bandwidth usage and problems - * with HIGH-speed split transactions we - * disable surround setups on FULL-speed USB - * by default - */ - channels = 4; - break; - default: - channels = UAUDIO_CHANNELS_MAX; - break; - } + channels = channels_max; } else if (channels > UAUDIO_CHANNELS_MAX) channels = UAUDIO_CHANNELS_MAX; @@ -2193,7 +2195,21 @@ /* try find a matching rate, if any */ for (z = 0; uaudio_rate_list[z]; z++) uaudio_chan_fill_info_sub(sc, udev, uaudio_rate_list[z], x, y); + + /* after default value in first round, proceed with 32 bits */ + if (y == bits) + y = 32 + 8; + /* skip default value subsequently */ + if (y == (bits + 8)) + y -= 8; } + + /* after default value in first round, proceed with max channels */ + if ((x == channels) && (channels < channels_max)) + x = channels_max + 1; + /* skip default value subsequently */ + if (x == (channels + 1)) + x--; } if (sc->sc_sndstat_valid) sbuf_finish(&sc->sc_sndstat);