public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrice Chotard <patrice.chotard@sfr.fr>
To: linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Jean-Francois Moine <moinejf@free.fr>,
	Theodore Kilgore <kilgota@banach.math.auburn.edu>
Subject: [PATCH] add endpoint direction test in alt_xfer
Date: Mon, 21 Mar 2011 20:58:56 +0100	[thread overview]
Message-ID: <4D87AE00.8090403@sfr.fr> (raw)

Hi, 

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 OUTPOUT one.

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

Regards


Signed-off-by: Patrice CHOTARD <patricechotard@free.fr>
---
 drivers/media/video/gspca/gspca.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index f21f2a2..03823ea 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -631,7 +631,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;
-- 
1.7.0.4


                 reply	other threads:[~2011-03-21 19:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D87AE00.8090403@sfr.fr \
    --to=patrice.chotard@sfr.fr \
    --cc=kilgota@banach.math.auburn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=moinejf@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox