ChangeSet 1.1939.1.52, 2004/09/29 11:43:21-07:00, [EMAIL PROTECTED] [PATCH] USB Storage: revert GetMaxLUN strictness
This is patch as384. It reverts some of our sanity checks on the GetMaxLUN part of the Bulk-only protocol. Apparently, this is one area where vendors can't even get close to correct. So, in the face of any sort of error, we assume a single LUN. We also include some comments so we don't make this mistake again. Signed-off-by: Alan Stern <[EMAIL PROTECTED]> Signed-off-by: Matthew Dharm <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> drivers/usb/storage/transport.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c --- a/drivers/usb/storage/transport.c 2004-10-19 08:09:00 -07:00 +++ b/drivers/usb/storage/transport.c 2004-10-19 08:09:00 -07:00 @@ -911,7 +911,6 @@ int result; /* issue the command */ - us->iobuf[0] = 0; result = usb_stor_control_msg(us, us->recv_ctrl_pipe, US_BULK_GET_MAX_LUN, USB_DIR_IN | USB_TYPE_CLASS | @@ -922,7 +921,7 @@ result, us->iobuf[0]); /* if we have a successful request, return the result */ - if (result >= 0) + if (result > 0) return us->iobuf[0]; /* @@ -934,13 +933,16 @@ if (result == -EPIPE) { usb_stor_clear_halt(us, us->recv_bulk_pipe); usb_stor_clear_halt(us, us->send_bulk_pipe); - /* return the default -- no LUNs */ - return 0; } - /* An answer or a STALL are the only valid responses. If we get - * something else, return an indication of error */ - return -1; + /* + * Some devices don't like GetMaxLUN. They may STALL the control + * pipe, they may return a zero-length result, they may do nothing at + * all and timeout, or they may fail in even more bizarrely creative + * ways. In these cases the best approach is to use the default + * value: only one LUN. + */ + return 0; } int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel