[PATCH] Stall control endpoint when file storage class request wValue != 0

luislloret <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <alpine.DEB.0.82.0707251023270.3429@luis>
From: Luis Lloret <[email protected]>

This patch makes the File Storage Gadget stall the control endpoint
when a MSC class request is made with wValue != 0.  This change makes
some MSC compliance test warnings disappear.

Signed-off-by: Luis Lloret <[email protected]>
---

Thanks again, Alan, for your patience. I didn't know gmail's web editor 
traded tabs for spaces. 
So here is the patch again...
--- linux-2.6.21.5/drivers/usb/gadget/file_storage.c.orig	2007-07-23 13:54:53.000000000 +0200
+++ linux-2.6.21.5/drivers/usb/gadget/file_storage.c	2007-07-24 09:11:19.000000000 +0200
@@ -1296,6 +1296,7 @@ static int class_setup_req(struct fsg_de
  	struct usb_request	*req = fsg->ep0req;
  	int			value = -EOPNOTSUPP;
  	u16			w_index = le16_to_cpu(ctrl->wIndex);
+	u16                     w_value = le16_to_cpu(ctrl->wValue);
  	u16			w_length = le16_to_cpu(ctrl->wLength);

  	if (!fsg->config)
@@ -1309,7 +1310,7 @@ static int class_setup_req(struct fsg_de
  			if (ctrl->bRequestType != (USB_DIR_OUT |
  					USB_TYPE_CLASS | USB_RECIP_INTERFACE))
  				break;
-			if (w_index != 0) {
+			if (w_index != 0 || w_value != 0) {
  				value = -EDOM;
  				break;
  			}
@@ -1325,7 +1326,7 @@ static int class_setup_req(struct fsg_de
  			if (ctrl->bRequestType != (USB_DIR_IN |
  					USB_TYPE_CLASS | USB_RECIP_INTERFACE))
  				break;
-			if (w_index != 0) {
+			if (w_index != 0 || w_value != 0) {
  				value = -EDOM;
  				break;
  			}
@@ -1344,7 +1345,7 @@ static int class_setup_req(struct fsg_de
  			if (ctrl->bRequestType != (USB_DIR_OUT |
  					USB_TYPE_CLASS | USB_RECIP_INTERFACE))
  				break;
-			if (w_index != 0) {
+			if (w_index != 0 || w_value != 0) {
  				value = -EDOM;
  				break;
  			}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.