From: Neil Jones <neiljay@xxxxxxxxx> Date: Mon, 12 Apr 2010 10:35:47 +0100 Subject: [PATCH] drivers/usb/gadget/f_mass_storage: Send Reply for Get Max LUN request. The response to a control transfer request for maximimum no. of LUNs is not being sent. I noticed on our USB analyzer when testing a new peripheral controller with the mass storage gadget that it was not responding to the request (a control transfer on EP0) to get the maximum number of LUNs supported by the device, I presume most people only use 1 LUN so don't see this problem, but it is a bug. Looking at the code I think the original author is assuming the response will be sent by the composite device driver see drivers/usb/gadget/composite.c lines 855-865, but the 'goto done' prevents the response from being sent, note you cannot remove the 'goto done' as other request have their responses handled in the function driver. Signed-off-by: Neil Jones <neiljay@xxxxxxxxx> --- drivers/usb/gadget/f_mass_storage.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index a37640e..341bf6b 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -614,7 +614,9 @@ static int fsg_setup(struct usb_function *f, return -EDOM; VDBG(fsg, "get max LUN\n"); *(u8 *) req->buf = fsg->common->nluns - 1; - return 1; + + return usb_ep_queue(fsg->gadget->ep0, req, GFP_ATOMIC); + } VDBG(fsg, -- 1.5.5.2
Attachment:
0001-drivers-usb-gadget-f_mass_storage-Send-Reply-for-Ge.patch
Description: Binary data