diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-05-26 12:11:36 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-05-27 03:48:31 -0400 |
commit | 74754f974b36c5a1156be46d0da05ab2c0a0960b (patch) | |
tree | 50d154e6d4c27fb18aad81795ec1b7f4970e358e /sound/usb/endpoint.c | |
parent | 1efddcc981c95e62c4e305fd462e3e98b6f9c5cd (diff) |
ALSA: usb-audio: parse more format descriptors with structs
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/endpoint.c')
-rw-r--r-- | sound/usb/endpoint.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index ef07a6d0dd5f..4887342cae27 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -158,8 +158,9 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
158 | int i, altno, err, stream; | 158 | int i, altno, err, stream; |
159 | int format = 0, num_channels = 0; | 159 | int format = 0, num_channels = 0; |
160 | struct audioformat *fp = NULL; | 160 | struct audioformat *fp = NULL; |
161 | unsigned char *fmt, *csep; | 161 | unsigned char *csep; |
162 | int num, protocol; | 162 | int num, protocol; |
163 | struct uac_format_type_i_continuous_descriptor *fmt; | ||
163 | 164 | ||
164 | dev = chip->dev; | 165 | dev = chip->dev; |
165 | 166 | ||
@@ -256,8 +257,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
256 | dev->devnum, iface_no, altno); | 257 | dev->devnum, iface_no, altno); |
257 | continue; | 258 | continue; |
258 | } | 259 | } |
259 | if (((protocol == UAC_VERSION_1) && (fmt[0] < 8)) || | 260 | if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) || |
260 | ((protocol == UAC_VERSION_2) && (fmt[0] != 6))) { | 261 | ((protocol == UAC_VERSION_2) && (fmt->bLength != 6))) { |
261 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", | 262 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", |
262 | dev->devnum, iface_no, altno); | 263 | dev->devnum, iface_no, altno); |
263 | continue; | 264 | continue; |
@@ -268,7 +269,9 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
268 | * with the previous one, except for a larger packet size, but | 269 | * with the previous one, except for a larger packet size, but |
269 | * is actually a mislabeled two-channel setting; ignore it. | 270 | * is actually a mislabeled two-channel setting; ignore it. |
270 | */ | 271 | */ |
271 | if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 && | 272 | if (fmt->bNrChannels == 1 && |
273 | fmt->bSubframeSize == 2 && | ||
274 | altno == 2 && num == 3 && | ||
272 | fp && fp->altsetting == 1 && fp->channels == 1 && | 275 | fp && fp->altsetting == 1 && fp->channels == 1 && |
273 | fp->formats == SNDRV_PCM_FMTBIT_S16_LE && | 276 | fp->formats == SNDRV_PCM_FMTBIT_S16_LE && |
274 | protocol == UAC_VERSION_1 && | 277 | protocol == UAC_VERSION_1 && |