From e3fae627f53af6688883aefadb091eb1f70342ff Mon Sep 17 00:00:00 2001 From: ksb Date: Sat, 11 Jul 2009 17:34:19 +0000 Subject: [PATCH] Removed reference to obsolete header. Fixed HALTing when the SCSI handler fails. --- cpu/arm/common/usb/msc/msc-descriptors.c | 2 +- cpu/arm/common/usb/msc/usb-msc-bulk.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/cpu/arm/common/usb/msc/msc-descriptors.c b/cpu/arm/common/usb/msc/msc-descriptors.c index 3ee0e613e..0c75e7693 100644 --- a/cpu/arm/common/usb/msc/msc-descriptors.c +++ b/cpu/arm/common/usb/msc/msc-descriptors.c @@ -1,5 +1,5 @@ #include "descriptors.h" -#include "usbmassbulk.h" +#include "usb-msc-bulk.h" #include const struct usb_st_device_descriptor device_descriptor = diff --git a/cpu/arm/common/usb/msc/usb-msc-bulk.c b/cpu/arm/common/usb/msc/usb-msc-bulk.c index e7c111668..65f650340 100644 --- a/cpu/arm/common/usb/msc/usb-msc-bulk.c +++ b/cpu/arm/common/usb/msc/usb-msc-bulk.c @@ -304,7 +304,27 @@ PROCESS_THREAD(usb_mass_bulk_request_process, ev , data) state.status = MASS_BULK_CSW_STATUS_FAILED; } if (ret != USB_MSC_HANDLER_DELAYED - && buf_submitted == buf_free) goto send_csw_state; + && buf_submitted == buf_free) { + if (cbw_buffer.dCBWDataTransferLength > 0) { + /* HALT the apropriate endpoint */ + if (cbw_buffer.bmCBWFlags & MASS_BULK_CBW_FLAG_IN) { + submit_halt(BULK_IN); + } else { + submit_halt(BULK_OUT); + } + /* Wait for HALT */ + while(1) { + PROCESS_WAIT_EVENT(); + if (ev == reset_event) goto reset_state; + if (ev == PROCESS_EVENT_POLL) { + USBBuffer *buffer = + get_next_buffer(BULK_IN, USB_BUFFER_ID_HALT); + if (buffer && (buffer->flags & USB_BUFFER_HALT)) break; + } + } + } + goto send_csw_state; + } if (cbw_buffer.bmCBWFlags & MASS_BULK_CBW_FLAG_IN) { goto send_data_state; } else {