Commit 61cc2d77 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: usb-audio: Fix EP matching for continuous rates

The function to evaluate the match of the parameters with an EP
assumes only the discrete rate tables and doesn't handle the
continuous rates properly.

This patch fixes match_endpoint_audioformats() to handle the
continuous rates.  Also the almost useless debug prints there are
Tested-by: default avatarKeith Milner <>
Tested-by: default avatarDylan Robinson <>

Signed-off-by: default avatarTakashi Iwai <>
parent 75c16b51
......@@ -695,41 +695,30 @@ static int match_endpoint_audioformats(struct snd_usb_substream *subs,
struct audioformat *match, int rate,
snd_pcm_format_t pcm_format)
int i;
int score = 0;
int i, score;
if (fp->channels < 1) {
"%s: (fmt @%p) no channels\n", __func__, fp);
if (fp->channels < 1)
return 0;
if (!(fp->formats & pcm_format_to_bits(pcm_format))) {
"%s: (fmt @%p) no match for format %d\n", __func__,
fp, pcm_format);
if (!(fp->formats & pcm_format_to_bits(pcm_format)))
return 0;
if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS) {
if (rate < fp->rate_min || rate > fp->rate_max)
return 0;
} else {
for (i = 0; i < fp->nr_rates; i++) {
if (fp->rate_table[i] == rate) {
if (fp->rate_table[i] == rate)
if (!score) {
"%s: (fmt @%p) no match for rate %d\n", __func__,
fp, rate);
if (i >= fp->nr_rates)
return 0;
score = 1;
if (fp->channels == match->channels)
"%s: (fmt @%p) score %d\n", __func__, fp, score);
return score;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment