aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2010-07-14 05:30:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 15:43:06 -0400
commit35680baa6822df98a6ed602e2380aa0a04e18b07 (patch)
treeee4ebc67f847f67ebd068248187f62958dcb19ab /drivers
parentc4dc692ce6212f4513c39dfcde725aab438a2940 (diff)
V4L/DVB: gspca - main: Handle the audio device
When there is an audio device, use a lower alternate setting. This patch does not fix correctly all audio and bandwidth problems. Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/gspca/gspca.c22
-rw-r--r--drivers/media/video/gspca/gspca.h3
2 files changed, 24 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 29b047942826..d951b0f0e053 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -640,12 +640,16 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
640 : USB_ENDPOINT_XFER_ISOC; 640 : USB_ENDPOINT_XFER_ISOC;
641 i = gspca_dev->alt; /* previous alt setting */ 641 i = gspca_dev->alt; /* previous alt setting */
642 if (gspca_dev->cam.reverse_alts) { 642 if (gspca_dev->cam.reverse_alts) {
643 if (gspca_dev->audio)
644 i++;
643 while (++i < gspca_dev->nbalt) { 645 while (++i < gspca_dev->nbalt) {
644 ep = alt_xfer(&intf->altsetting[i], xfer); 646 ep = alt_xfer(&intf->altsetting[i], xfer);
645 if (ep) 647 if (ep)
646 break; 648 break;
647 } 649 }
648 } else { 650 } else {
651 if (gspca_dev->audio)
652 i--;
649 while (--i >= 0) { 653 while (--i >= 0) {
650 ep = alt_xfer(&intf->altsetting[i], xfer); 654 ep = alt_xfer(&intf->altsetting[i], xfer);
651 if (ep) 655 if (ep)
@@ -2146,6 +2150,24 @@ int gspca_dev_probe2(struct usb_interface *intf,
2146 gspca_dev->dev = dev; 2150 gspca_dev->dev = dev;
2147 gspca_dev->iface = intf->cur_altsetting->desc.bInterfaceNumber; 2151 gspca_dev->iface = intf->cur_altsetting->desc.bInterfaceNumber;
2148 gspca_dev->nbalt = intf->num_altsetting; 2152 gspca_dev->nbalt = intf->num_altsetting;
2153
2154 /* check if any audio device */
2155 if (dev->config->desc.bNumInterfaces != 1) {
2156 int i;
2157 struct usb_interface *intf2;
2158
2159 for (i = 0; i < dev->config->desc.bNumInterfaces; i++) {
2160 intf2 = dev->config->interface[i];
2161 if (intf2 != NULL
2162 && intf2->altsetting != NULL
2163 && intf2->altsetting->desc.bInterfaceClass ==
2164 USB_CLASS_AUDIO) {
2165 gspca_dev->audio = 1;
2166 break;
2167 }
2168 }
2169 }
2170
2149 gspca_dev->sd_desc = sd_desc; 2171 gspca_dev->sd_desc = sd_desc;
2150 gspca_dev->nbufread = 2; 2172 gspca_dev->nbufread = 2;
2151 gspca_dev->empty_packet = -1; /* don't check the empty packets */ 2173 gspca_dev->empty_packet = -1; /* don't check the empty packets */
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h
index 17e55580631e..b749c36d9f7e 100644
--- a/drivers/media/video/gspca/gspca.h
+++ b/drivers/media/video/gspca/gspca.h
@@ -198,6 +198,7 @@ struct gspca_dev {
198 struct mutex read_lock; /* read protection */ 198 struct mutex read_lock; /* read protection */
199 struct mutex queue_lock; /* ISOC queue protection */ 199 struct mutex queue_lock; /* ISOC queue protection */
200 int usb_err; /* USB error - protected by usb_lock */ 200 int usb_err; /* USB error - protected by usb_lock */
201 u16 pkt_size; /* ISOC packet size */
201#ifdef CONFIG_PM 202#ifdef CONFIG_PM
202 char frozen; /* suspend - resume */ 203 char frozen; /* suspend - resume */
203#endif 204#endif
@@ -208,7 +209,7 @@ struct gspca_dev {
208 __u8 iface; /* USB interface number */ 209 __u8 iface; /* USB interface number */
209 __u8 alt; /* USB alternate setting */ 210 __u8 alt; /* USB alternate setting */
210 __u8 nbalt; /* number of USB alternate settings */ 211 __u8 nbalt; /* number of USB alternate settings */
211 u16 pkt_size; /* ISOC packet size */ 212 u8 audio; /* presence of audio device */
212}; 213};
213 214
214int gspca_dev_probe(struct usb_interface *intf, 215int gspca_dev_probe(struct usb_interface *intf,