From f912bc40dc2c720d98bc69eff6eac2000ab39197 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 8 Jan 2012 15:16:38 +0100 Subject: DFU: fix upload case, we need to return number of bytes read --- usb/device/dfu/dfu_driver.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'usb') diff --git a/usb/device/dfu/dfu_driver.c b/usb/device/dfu/dfu_driver.c index c6c1a18..f97073d 100644 --- a/usb/device/dfu/dfu_driver.c +++ b/usb/device/dfu/dfu_driver.c @@ -183,18 +183,16 @@ static int handle_upload(uint16_t val, uint16_t len, int first) return DFU_RET_STALL; } - /* FIXME: altif */ rc = USBDFU_handle_upload(if_altsettings[0], dfu.total_bytes, dfu_buf, len); if (rc < 0) { TRACE_ERROR("application handle_upload() returned %d\n\r", rc); return DFU_RET_STALL; } - rc = USBD_Write(0, dfu_buf, rc, &upload_cb, 0); - if (rc == USBD_STATUS_SUCCESS) - return DFU_RET_NOTHING; - else - return DFU_RET_STALL; + if (USBD_Write(0, dfu_buf, rc, &upload_cb, 0) == USBD_STATUS_SUCCESS) + return rc; + + return DFU_RET_STALL; } /* this function gets daisy-chained into processing EP0 requests */ -- cgit v1.2.3