summaryrefslogtreecommitdiff
path: root/usb
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-08 15:16:38 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-08 15:16:38 +0100
commitf912bc40dc2c720d98bc69eff6eac2000ab39197 (patch)
tree0ca716ae76c112645491771cd6d8fde1110bbc22 /usb
parent0d9de4db679436581f554242d7635ddef4b96773 (diff)
DFU: fix upload case, we need to return number of bytes read
Diffstat (limited to 'usb')
-rw-r--r--usb/device/dfu/dfu_driver.c10
1 files changed, 4 insertions, 6 deletions
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 */
personal git repositories of Harald Welte. Your mileage may vary