Commit 504333df8ba5fc310260285a22ab5d7cf3208795

Authored by David Henningsson
Committed by Takashi Iwai
1 parent e3e35f750f

ALSA: usb - Don't trust the channel config if the channel count changed

In case the channel count of the input terminal is not the same as
the channel count of the streaming descriptor, the channel config of
the input terminal can not be trusted. Instead fall back to a default
(guessed) channel map.

This was found on a Logitech USB Headset.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -662,7 +662,6 @@
662 662 * (fp->maxpacksize & 0x7ff);
663 663 fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no);
664 664 fp->clock = clock;
665   - fp->chmap = convert_chmap(num_channels, chconfig, protocol);
666 665  
667 666 /* some quirks for attributes here */
668 667  
669 668  
... ... @@ -698,11 +697,15 @@
698 697 /* ok, let's parse further... */
699 698 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream) < 0) {
700 699 kfree(fp->rate_table);
701   - kfree(fp->chmap);
702 700 kfree(fp);
703 701 fp = NULL;
704 702 continue;
705 703 }
  704 +
  705 + /* Create chmap */
  706 + if (fp->channels != num_channels)
  707 + chconfig = 0;
  708 + fp->chmap = convert_chmap(fp->channels, chconfig, protocol);
706 709  
707 710 snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint %#x\n", dev->devnum, iface_no, altno, fp->endpoint);
708 711 err = snd_usb_add_audio_stream(chip, stream, fp);