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 dissapear.
Signed-off-by: Luis Lloret <[EMAIL PROTECTED]> --- Thanks for the explanations, Alan. I missed quite a lot things. Sorry. I added the CBI ADSC pathway and removed the comments. Here I go again... The patch: --- 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; } 2007/7/23, Alan Stern <[EMAIL PROTECTED]>: > On Mon, 23 Jul 2007, Luis Lloret wrote: > > > This patch makes the File Storage Gadget stall the control endpoint > > when a MSC class request (USB_BULK_RESET_REQUEST or > > USB_BULK_RESET_REQUEST) is made with wValue != 0, that is what the > > standard asks for. Just a very minor change, indeed. > > The standard does not say that the device has to STALL if wValue != 0. > It only says that the host must set wValue to 0. > > > This change makes some USB MSC compliance tests warnings disappear. > > This is my first kernel patch submission, and I've tried my best to > > avoid any error. If I made any, pls let me know. Thank you. > > You didn't CC: the maintainer of the driver you want to change. > > You didn't add a Signed-off-by: line as explained in > Documentation/SubmittingPatches. > > > --- 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-23 > > 13:59:55.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,8 @@ 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) { > > + // To fully comply with USB MSC tests, we > > check for w_value != 0 > > + if (w_index != 0 || w_value != 0) { > > value = -EDOM; > > break; > > } > > @@ -1325,7 +1327,8 @@ 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) { > > + // To fully comply with USB MSC tests, we > > check for w_value != 0 > > + if (w_index != 0 || w_value != 0) { > > value = -EDOM; > > break; > > } > > The two comment lines are unnecessary, since it's obvious what the code > does (check for valid setup parameters). > > You should also add the same test to the CBI ADSC pathway. > > If you resubmit the patch with those changes, I will accept it. > > Alan Stern > > ------------------------------------------------------------------------- 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/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel