Commit 35680baa authored by Jean-François Moine's avatar Jean-François Moine Committed by Mauro Carvalho Chehab

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: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c4dc692c
...@@ -640,12 +640,16 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev) ...@@ -640,12 +640,16 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
: USB_ENDPOINT_XFER_ISOC; : USB_ENDPOINT_XFER_ISOC;
i = gspca_dev->alt; /* previous alt setting */ i = gspca_dev->alt; /* previous alt setting */
if (gspca_dev->cam.reverse_alts) { if (gspca_dev->cam.reverse_alts) {
if (gspca_dev->audio)
i++;
while (++i < gspca_dev->nbalt) { while (++i < gspca_dev->nbalt) {
ep = alt_xfer(&intf->altsetting[i], xfer); ep = alt_xfer(&intf->altsetting[i], xfer);
if (ep) if (ep)
break; break;
} }
} else { } else {
if (gspca_dev->audio)
i--;
while (--i >= 0) { while (--i >= 0) {
ep = alt_xfer(&intf->altsetting[i], xfer); ep = alt_xfer(&intf->altsetting[i], xfer);
if (ep) if (ep)
...@@ -2146,6 +2150,24 @@ int gspca_dev_probe2(struct usb_interface *intf, ...@@ -2146,6 +2150,24 @@ int gspca_dev_probe2(struct usb_interface *intf,
gspca_dev->dev = dev; gspca_dev->dev = dev;
gspca_dev->iface = intf->cur_altsetting->desc.bInterfaceNumber; gspca_dev->iface = intf->cur_altsetting->desc.bInterfaceNumber;
gspca_dev->nbalt = intf->num_altsetting; gspca_dev->nbalt = intf->num_altsetting;
/* check if any audio device */
if (dev->config->desc.bNumInterfaces != 1) {
int i;
struct usb_interface *intf2;
for (i = 0; i < dev->config->desc.bNumInterfaces; i++) {
intf2 = dev->config->interface[i];
if (intf2 != NULL
&& intf2->altsetting != NULL
&& intf2->altsetting->desc.bInterfaceClass ==
USB_CLASS_AUDIO) {
gspca_dev->audio = 1;
break;
}
}
}
gspca_dev->sd_desc = sd_desc; gspca_dev->sd_desc = sd_desc;
gspca_dev->nbufread = 2; gspca_dev->nbufread = 2;
gspca_dev->empty_packet = -1; /* don't check the empty packets */ gspca_dev->empty_packet = -1; /* don't check the empty packets */
......
...@@ -198,6 +198,7 @@ struct gspca_dev { ...@@ -198,6 +198,7 @@ struct gspca_dev {
struct mutex read_lock; /* read protection */ struct mutex read_lock; /* read protection */
struct mutex queue_lock; /* ISOC queue protection */ struct mutex queue_lock; /* ISOC queue protection */
int usb_err; /* USB error - protected by usb_lock */ int usb_err; /* USB error - protected by usb_lock */
u16 pkt_size; /* ISOC packet size */
#ifdef CONFIG_PM #ifdef CONFIG_PM
char frozen; /* suspend - resume */ char frozen; /* suspend - resume */
#endif #endif
...@@ -208,7 +209,7 @@ struct gspca_dev { ...@@ -208,7 +209,7 @@ struct gspca_dev {
__u8 iface; /* USB interface number */ __u8 iface; /* USB interface number */
__u8 alt; /* USB alternate setting */ __u8 alt; /* USB alternate setting */
__u8 nbalt; /* number of USB alternate settings */ __u8 nbalt; /* number of USB alternate settings */
u16 pkt_size; /* ISOC packet size */ u8 audio; /* presence of audio device */
}; };
int gspca_dev_probe(struct usb_interface *intf, int gspca_dev_probe(struct usb_interface *intf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment