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.

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.

--- 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;
                        }

-------------------------------------------------------------------------
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

Reply via email to