diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 12 | ||||
-rw-r--r-- | drivers/media/video/gspca/gspca.h | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index ed18401fd8ba..66e91d896eda 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -474,14 +474,14 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev) | |||
474 | i = gspca_dev->alt; /* previous alt setting */ | 474 | i = gspca_dev->alt; /* previous alt setting */ |
475 | 475 | ||
476 | /* try isoc */ | 476 | /* try isoc */ |
477 | while (--i > 0) { /* alt 0 is unusable */ | 477 | while (--i >= 0) { |
478 | ep = alt_xfer(&intf->altsetting[i], | 478 | ep = alt_xfer(&intf->altsetting[i], |
479 | USB_ENDPOINT_XFER_ISOC); | 479 | USB_ENDPOINT_XFER_ISOC); |
480 | if (ep) | 480 | if (ep) |
481 | break; | 481 | break; |
482 | } | 482 | } |
483 | 483 | ||
484 | /* if no isoc, try bulk */ | 484 | /* if no isoc, try bulk (alt 0 only) */ |
485 | if (ep == NULL) { | 485 | if (ep == NULL) { |
486 | ep = alt_xfer(&intf->altsetting[0], | 486 | ep = alt_xfer(&intf->altsetting[0], |
487 | USB_ENDPOINT_XFER_BULK); | 487 | USB_ENDPOINT_XFER_BULK); |
@@ -489,6 +489,8 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev) | |||
489 | err("no transfer endpoint found"); | 489 | err("no transfer endpoint found"); |
490 | return NULL; | 490 | return NULL; |
491 | } | 491 | } |
492 | i = 0; | ||
493 | gspca_dev->bulk = 1; | ||
492 | } | 494 | } |
493 | PDEBUG(D_STREAM, "use alt %d ep 0x%02x", | 495 | PDEBUG(D_STREAM, "use alt %d ep 0x%02x", |
494 | i, ep->desc.bEndpointAddress); | 496 | i, ep->desc.bEndpointAddress); |
@@ -515,7 +517,7 @@ static int create_urbs(struct gspca_dev *gspca_dev, | |||
515 | /* calculate the packet size and the number of packets */ | 517 | /* calculate the packet size and the number of packets */ |
516 | psize = le16_to_cpu(ep->desc.wMaxPacketSize); | 518 | psize = le16_to_cpu(ep->desc.wMaxPacketSize); |
517 | 519 | ||
518 | if (gspca_dev->alt != 0) { /* isoc */ | 520 | if (!gspca_dev->bulk) { /* isoc */ |
519 | 521 | ||
520 | /* See paragraph 5.9 / table 5-11 of the usb 2.0 spec. */ | 522 | /* See paragraph 5.9 / table 5-11 of the usb 2.0 spec. */ |
521 | psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3)); | 523 | psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3)); |
@@ -615,7 +617,7 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev) | |||
615 | goto out; | 617 | goto out; |
616 | 618 | ||
617 | /* clear the bulk endpoint */ | 619 | /* clear the bulk endpoint */ |
618 | if (gspca_dev->alt == 0) /* if bulk transfer */ | 620 | if (gspca_dev->bulk) |
619 | usb_clear_halt(gspca_dev->dev, | 621 | usb_clear_halt(gspca_dev->dev, |
620 | gspca_dev->urb[0]->pipe); | 622 | gspca_dev->urb[0]->pipe); |
621 | 623 | ||
@@ -628,7 +630,7 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev) | |||
628 | gspca_dev->streaming = 1; | 630 | gspca_dev->streaming = 1; |
629 | 631 | ||
630 | /* some bulk transfers are started by the subdriver */ | 632 | /* some bulk transfers are started by the subdriver */ |
631 | if (gspca_dev->alt == 0 && gspca_dev->cam.bulk_nurbs == 0) | 633 | if (gspca_dev->bulk && gspca_dev->cam.bulk_nurbs == 0) |
632 | break; | 634 | break; |
633 | 635 | ||
634 | /* submit the URBs */ | 636 | /* submit the URBs */ |
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h index 6f172e9e5fe9..e4d4cf6ce05a 100644 --- a/drivers/media/video/gspca/gspca.h +++ b/drivers/media/video/gspca/gspca.h | |||
@@ -167,6 +167,7 @@ struct gspca_dev { | |||
167 | __u8 iface; /* USB interface number */ | 167 | __u8 iface; /* USB interface number */ |
168 | __u8 alt; /* USB alternate setting */ | 168 | __u8 alt; /* USB alternate setting */ |
169 | __u8 nbalt; /* number of USB alternate settings */ | 169 | __u8 nbalt; /* number of USB alternate settings */ |
170 | u8 bulk; /* image transfer by 0:isoc / 1:bulk */ | ||
170 | }; | 171 | }; |
171 | 172 | ||
172 | int gspca_dev_probe(struct usb_interface *intf, | 173 | int gspca_dev_probe(struct usb_interface *intf, |