]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] em28xx: fix check for audio only usb interfaces when changing the usb alterna...
authorFrank Schaefer <fschaefer.oss@googlemail.com>
Mon, 13 Jan 2014 22:02:07 +0000 (19:02 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 14 Jan 2014 21:25:17 +0000 (19:25 -0200)
Previously, we've been assuming that the video endpoints are always at usb
interface 0. Hence, if vendor audio endpoints are provided at a separate
interface, they were supposed to be at interface number > 0.
Instead of checking for (interface number > 0) to determine if an interface
is a pure audio interface, dev->is_audio_only should be checked.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/usb/em28xx/em28xx-audio.c

index 50c4ab49a276da0bb01c643c83ec344603f07c68..332abf7b32f818457899d8671aebb428f015f817 100644 (file)
@@ -266,7 +266,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
        dprintk("opening device and trying to acquire exclusive lock\n");
 
        runtime->hw = snd_em28xx_hw_capture;
-       if ((dev->alt == 0 || dev->ifnum) && dev->adev.users == 0) {
+       if ((dev->alt == 0 || dev->is_audio_only) && dev->adev.users == 0) {
                int nonblock = !!(substream->f_flags & O_NONBLOCK);
 
                if (nonblock) {
@@ -274,10 +274,21 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
                                return -EAGAIN;
                } else
                        mutex_lock(&dev->lock);
-               if (dev->ifnum)
+               if (dev->is_audio_only)
+                       /* vendor audio is on a separate interface */
                        dev->alt = 1;
                else
+                       /* vendor audio is on the same interface as video */
                        dev->alt = 7;
+                       /*
+                        * FIXME: The intention seems to be to select the alt
+                        * setting with the largest wMaxPacketSize for the video
+                        * endpoint.
+                        * At least dev->alt should be used instead, but we
+                        * should probably not touch it at all if it is
+                        * already >0, because wMaxPacketSize of the audio
+                        * endpoints seems to be the same for all.
+                        */
 
                dprintk("changing alternate number on interface %d to %d\n",
                        dev->ifnum, dev->alt);