aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-03-18 06:03:54 -0400
committerTakashi Iwai <tiwai@suse.de>2009-03-18 06:31:08 -0400
commit9311c9b4f12218b588e51806c44d290cfec678a3 (patch)
tree9abf620f6497fcc491b079c0577a9abcfdfea46d /sound/usb
parent1313e7041480f523a09dedc7ef2185d8ee94c163 (diff)
ALSA: snd-usb-caiaq: drop bogus iso packets
Drop inbound packets that are smaller than expected. This has been observed at the very beginning of the streaming transaction. And when the hardware is in panic mode (which can only very rarely happen in case of massive EMI chaos), mute the input channels. Signed-off-by: Daniel Mack <daniel@caiaq.de> Tested-by: Mark Hills <mark@pogo.org.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/caiaq/caiaq-audio.c6
-rw-r--r--sound/usb/caiaq/caiaq-device.c2
-rw-r--r--sound/usb/caiaq/caiaq-device.h2
3 files changed, 9 insertions, 1 deletions
diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c
index 577b1129de0e..08d51e0c9fea 100644
--- a/sound/usb/caiaq/caiaq-audio.c
+++ b/sound/usb/caiaq/caiaq-audio.c
@@ -377,6 +377,9 @@ static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev,
377 377
378 for (stream = 0; stream < dev->n_streams; stream++, i++) { 378 for (stream = 0; stream < dev->n_streams; stream++, i++) {
379 sub = dev->sub_capture[stream]; 379 sub = dev->sub_capture[stream];
380 if (dev->input_panic)
381 usb_buf[i] = 0;
382
380 if (sub) { 383 if (sub) {
381 struct snd_pcm_runtime *rt = sub->runtime; 384 struct snd_pcm_runtime *rt = sub->runtime;
382 char *audio_buf = rt->dma_area; 385 char *audio_buf = rt->dma_area;
@@ -398,6 +401,9 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev,
398 if (!dev->streaming) 401 if (!dev->streaming)
399 return; 402 return;
400 403
404 if (iso->actual_length < dev->bpp)
405 return;
406
401 switch (dev->spec.data_alignment) { 407 switch (dev->spec.data_alignment) {
402 case 0: 408 case 0:
403 read_in_urb_mode0(dev, urb, iso); 409 read_in_urb_mode0(dev, urb, iso);
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c
index 5736669df2d5..336a93de0b30 100644
--- a/sound/usb/caiaq/caiaq-device.c
+++ b/sound/usb/caiaq/caiaq-device.c
@@ -251,6 +251,8 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev,
251 251
252 if (dev->audio_parm_answer != 1) 252 if (dev->audio_parm_answer != 1)
253 debug("unable to set the device's audio params\n"); 253 debug("unable to set the device's audio params\n");
254 else
255 dev->bpp = bpp;
254 256
255 return dev->audio_parm_answer == 1 ? 0 : -EINVAL; 257 return dev->audio_parm_answer == 1 ? 0 : -EINVAL;
256} 258}
diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h
index 098b194f7259..4cce1ad7493d 100644
--- a/sound/usb/caiaq/caiaq-device.h
+++ b/sound/usb/caiaq/caiaq-device.h
@@ -91,7 +91,7 @@ struct snd_usb_caiaqdev {
91 int period_out_count[MAX_STREAMS]; 91 int period_out_count[MAX_STREAMS];
92 int input_panic, output_panic, warned; 92 int input_panic, output_panic, warned;
93 char *audio_in_buf, *audio_out_buf; 93 char *audio_in_buf, *audio_out_buf;
94 unsigned int samplerates; 94 unsigned int samplerates, bpp;
95 95
96 struct snd_pcm_substream *sub_playback[MAX_STREAMS]; 96 struct snd_pcm_substream *sub_playback[MAX_STREAMS];
97 struct snd_pcm_substream *sub_capture[MAX_STREAMS]; 97 struct snd_pcm_substream *sub_capture[MAX_STREAMS];