aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2013-11-04 22:41:08 -0500
committerTakashi Iwai <tiwai@suse.de>2013-11-05 01:46:48 -0500
commit504333df8ba5fc310260285a22ab5d7cf3208795 (patch)
treeca3b1e699342489ad5f27a8e1430e6e74c8c0dbc /sound/usb
parente3e35f750fff74e701c8913fd7dd714e37a848cd (diff)
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>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/stream.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index badd1d6d175d..d737d0e6e558 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -662,7 +662,6 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
662 * (fp->maxpacksize & 0x7ff); 662 * (fp->maxpacksize & 0x7ff);
663 fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no); 663 fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no);
664 fp->clock = clock; 664 fp->clock = clock;
665 fp->chmap = convert_chmap(num_channels, chconfig, protocol);
666 665
667 /* some quirks for attributes here */ 666 /* some quirks for attributes here */
668 667
@@ -698,12 +697,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
698 /* ok, let's parse further... */ 697 /* ok, let's parse further... */
699 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream) < 0) { 698 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream) < 0) {
700 kfree(fp->rate_table); 699 kfree(fp->rate_table);
701 kfree(fp->chmap);
702 kfree(fp); 700 kfree(fp);
703 fp = NULL; 701 fp = NULL;
704 continue; 702 continue;
705 } 703 }
706 704
705 /* Create chmap */
706 if (fp->channels != num_channels)
707 chconfig = 0;
708 fp->chmap = convert_chmap(fp->channels, chconfig, protocol);
709
707 snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint %#x\n", dev->devnum, iface_no, altno, fp->endpoint); 710 snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint %#x\n", dev->devnum, iface_no, altno, fp->endpoint);
708 err = snd_usb_add_audio_stream(chip, stream, fp); 711 err = snd_usb_add_audio_stream(chip, stream, fp);
709 if (err < 0) { 712 if (err < 0) {