Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142206797
D43679.id134181.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D43679.id134181.diff
View Options
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
@@ -94,7 +94,7 @@
#include "feeder_if.h"
static int uaudio_default_rate = 0; /* use rate list */
-static int uaudio_default_bits = 32;
+static int uaudio_default_bits = 0; /* use default sample size */
static int uaudio_default_channels = 0; /* use default */
static int uaudio_buffer_ms = 4;
static bool uaudio_handle_hid = true;
@@ -150,6 +150,7 @@
#define UAUDIO_NFRAMES 64 /* must be factor of 8 due HS-USB */
#define UAUDIO_NCHANBUFS 2 /* number of outstanding request */
#define UAUDIO_RECURSE_LIMIT 255 /* rounds */
+#define UAUDIO_BITS_MAX 32 /* maximum sample size in bits */
#define UAUDIO_CHANNELS_MAX MIN(64, AFMT_CHANNEL_MAX)
#define UAUDIO_MATRIX_MAX 8 /* channels */
@@ -2203,31 +2204,37 @@
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);
- if ((bits == 0) || (bits > 32)) {
+ if ((bits == 0) || (bits > UAUDIO_BITS_MAX)) {
/* set a valid value */
- bits = 32;
+ bits = UAUDIO_BITS_MAX;
}
- 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;
- }
- } else if (channels > UAUDIO_CHANNELS_MAX)
+
+ if (channels > UAUDIO_CHANNELS_MAX)
channels = UAUDIO_CHANNELS_MAX;
+ 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;
+ /* more channels on request */
+ if (channels > channels_max)
+ channels_max = channels;
+ break;
+ default:
+ channels_max = UAUDIO_CHANNELS_MAX;
+ break;
+ }
+ if (channels == 0)
+ channels = channels_max;
if (sbuf_new(&sc->sc_sndstat, NULL, 4096, SBUF_AUTOEXTEND))
sc->sc_sndstat_valid = 1;
@@ -2241,9 +2248,26 @@
uaudio_chan_fill_info_sub(sc, udev, rate, x, y);
/* 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);
+ for (z = 0; uaudio_rate_list[z]; z++) {
+ if (uaudio_rate_list[z] != rate)
+ uaudio_chan_fill_info_sub(sc, udev,
+ uaudio_rate_list[z], x, y);
+ }
+
+ /* after default value in first round, proceed with max bits */
+ if (y == bits)
+ y = UAUDIO_BITS_MAX + 8;
+ /* skip default value subsequently */
+ if (y == (bits + 8))
+ y -= 8;
}
+
+ /* after default value in first round, proceed with max channels */
+ if (x == channels)
+ x = channels_max + 1;
+ /* skip default value subsequently */
+ if (x == (channels + 1))
+ x--;
}
if (sc->sc_sndstat_valid)
sbuf_finish(&sc->sc_sndstat);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 18, 5:55 AM (9 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27701857
Default Alt Text
D43679.id134181.diff (3 KB)
Attached To
Mode
D43679: snd_uaudio(4): Fix config detection with defaults set.
Attached
Detach File
Event Timeline
Log In to Comment