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

Ragner Magalhaes <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
ext 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.
> 
> 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) {
Comment with "//" ...
> +                       // 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) {
Again ... as above ..
> +                       // 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/
_______________________________________________
[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.