Skip to content

Commit

Permalink
[media] gspca - main: Add endpoint direction test in alt_xfer
Browse files Browse the repository at this point in the history
This patch fixes a bug in gspca, more precisely in alt_xfer().

This function looks for an input transfer endpoint in an alternate setting.
By default it returns the first endpoint corresponding to the transfer type
indicated in parameter.
But with some USB devices, the first endpoint corresponding to the transfer
type is not always an INPUT endpoint but an OUTPUT one.

This patch adds the endpoint direction test to be sure to return an INPUT endpoint

Signed-off-by: Patrice CHOTARD <patricechotard@free.fr>
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Patrice Chotard authored and Mauro Carvalho Chehab committed Mar 22, 2011
1 parent 8e3c08b commit 7106225
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ static struct usb_host_endpoint *alt_xfer(struct usb_host_interface *alt,
ep = &alt->endpoint[i];
attr = ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
if (attr == xfer
&& ep->desc.wMaxPacketSize != 0)
&& ep->desc.wMaxPacketSize != 0
&& usb_endpoint_dir_in(&ep->desc))
return ep;
}
return NULL;
Expand Down

0 comments on commit 7106225

Please sign in to comment.