]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ALSA: snd-usb-caiaq: drop bogus iso packets
authorDaniel Mack <daniel@caiaq.de>
Wed, 18 Mar 2009 10:03:54 +0000 (11:03 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 18 Mar 2009 10:31:08 +0000 (11:31 +0100)
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>
sound/usb/caiaq/caiaq-audio.c
sound/usb/caiaq/caiaq-device.c
sound/usb/caiaq/caiaq-device.h

index 577b1129de0e68641d2363a84959c7ac402a898f..08d51e0c9feae466175f87cb45fe87cebbcd13ec 100644 (file)
@@ -377,6 +377,9 @@ static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev,
 
                for (stream = 0; stream < dev->n_streams; stream++, i++) {
                        sub = dev->sub_capture[stream];
+                       if (dev->input_panic)
+                               usb_buf[i] = 0;
+
                        if (sub) {
                                struct snd_pcm_runtime *rt = sub->runtime;
                                char *audio_buf = rt->dma_area;
@@ -398,6 +401,9 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev,
        if (!dev->streaming)
                return;
 
+       if (iso->actual_length < dev->bpp)
+               return;
+
        switch (dev->spec.data_alignment) {
        case 0:
                read_in_urb_mode0(dev, urb, iso);
index 5736669df2d5b2365c528fd6d1c114809fdc11cc..336a93de0b309725ab4166f03b365f38c3cb8385 100644 (file)
@@ -251,6 +251,8 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev,
                
        if (dev->audio_parm_answer != 1) 
                debug("unable to set the device's audio params\n");
+       else
+               dev->bpp = bpp;
 
        return dev->audio_parm_answer == 1 ? 0 : -EINVAL;
 }
index 098b194f72592a0c7e992b8ee198698968d62657..4cce1ad7493db4ec138216bb3a56b6ae20fcc90f 100644 (file)
@@ -91,7 +91,7 @@ struct snd_usb_caiaqdev {
        int period_out_count[MAX_STREAMS];
        int input_panic, output_panic, warned;
        char *audio_in_buf, *audio_out_buf;
-       unsigned int samplerates;
+       unsigned int samplerates, bpp;
 
        struct snd_pcm_substream *sub_playback[MAX_STREAMS];
        struct snd_pcm_substream *sub_capture[MAX_STREAMS];