]> git.hungrycats.org Git - linux/commitdiff
ALSA CVS update
authorJaroslav Kysela <perex@suse.cz>
Thu, 25 Sep 2003 17:40:14 +0000 (19:40 +0200)
committerJaroslav Kysela <perex@suse.cz>
Thu, 25 Sep 2003 17:40:14 +0000 (19:40 +0200)
D:2003/09/24 14:12:50
C:USB generic driver
A:Takashi Iwai <tiwai@suse.de>
F:usb/usbaudio.c:1.64->1.65
F:usb/usbmixer.c:1.22->1.23
L:- don't create controls from selector units with a single content.
L:- suppress the error if async-out or adaptive-in has only one EP.
L:  don't create a sync pipe in this case.

sound/usb/usbaudio.c
sound/usb/usbmixer.c

index 0f040b505aa70ce43e54331e4165474335bb9f74..292f271b9a25cbc6dc31873b7fbe2179a465246b 100644 (file)
@@ -1095,12 +1095,16 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt)
        subs->fill_max = 0;
 
        /* we need a sync pipe in async OUT or adaptive IN mode */
+       /* check the number of EP, since some devices have broken
+        * descriptors which fool us.  if it has only one EP,
+        * assume it as adaptive-out or sync-in.
+        */
        attr = fmt->ep_attr & EP_ATTR_MASK;
-       if ((is_playback && attr == EP_ATTR_ASYNC) ||
-           (! is_playback && attr == EP_ATTR_ADAPTIVE)) {
-               /* check endpoint */
-               if (altsd->bNumEndpoints < 2 ||
-                   get_endpoint(alts, 1)->bmAttributes != 0x01 ||
+       if (((is_playback && attr == EP_ATTR_ASYNC) ||
+            (! is_playback && attr == EP_ATTR_ADAPTIVE)) &&
+           altsd->bNumEndpoints >= 2) {
+               /* check sync-pipe endpoint */
+               if (get_endpoint(alts, 1)->bmAttributes != 0x01 ||
                    get_endpoint(alts, 1)->bSynchAddress != 0) {
                        snd_printk(KERN_ERR "%d:%d:%d : invalid synch pipe\n",
                                   dev->devnum, fmt->iface, fmt->altsetting);
index 0d63caf275ed8ec6fe99f21460e2076fbb323489..f8ead93d0b0b17b8abda9dc142eb9358fe53bdd8 100644 (file)
@@ -1358,6 +1358,9 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned
                return -EINVAL;
        }
 
+       if (num_ins == 1) /* only one ? nonsense! */
+               return 0;
+
        if (check_ignored_ctl(state, unitid, 0))
                return 0;