You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After PR #18 is merged, the USBDFU code should be updated as well.
Exactly how I'm not sure, since it's not trivial.
The simplest non-functional change would be:
diff --git a/firmware/library/usbdfu.c b/firmware/library/usbdfu.c
index 38ca144..2fc9178 100644
--- a/firmware/library/usbdfu.c+++ b/firmware/library/usbdfu.c@@ -93,14 +93,16 @@ bool usb_dfu_setup(usb_dfu_iface_state_t *dfu, __xdata struct usb_req_setup *req
dfu->length = req->wLength;
dfu->pending = true;
dfu->sync = false;
- SETUP_EP0_BUF(0);+ SETUP_EP0_OUT_BUF();+ ACK_EP0(); // TODO: this should probably be refactored to ack the buffer only after it's been processed?
return true;
} else if(dfu->state == USB_DFU_STATE_dfuDNLOAD_IDLE && req->wLength > 0) {
dfu->state = USB_DFU_STATE_dfuDNLOAD_SYNC;
dfu->length = req->wLength;
dfu->pending = true;
dfu->sync = false;
- SETUP_EP0_BUF(0);+ SETUP_EP0_OUT_BUF();+ ACK_EP0(); // TODO: this should probably be refactored to ack the buffer only after it's been processed?
return true;
} else if(dfu->state == USB_DFU_STATE_dfuDNLOAD_IDLE) {
dfu->state = USB_DFU_STATE_dfuMANIFEST_SYNC;
However reading the code, it seems like USB_DFU_STATE_dfuDNLOAD_SYNC state exists specifically to work around the problem introduced by SETUP_EP0_BUF(0);, so I think the right implementation is to remove the USB_DFU_STATE_dfuDNLOAD_SYNC state completely.
Since the correct solution is not necessarily trivial, I'm not submitting a PR for this.
The text was updated successfully, but these errors were encountered:
After PR #18 is merged, the USBDFU code should be updated as well.
Exactly how I'm not sure, since it's not trivial.
The simplest non-functional change would be:
However reading the code, it seems like USB_DFU_STATE_dfuDNLOAD_SYNC state exists specifically to work around the problem introduced by
SETUP_EP0_BUF(0);
, so I think the right implementation is to remove theUSB_DFU_STATE_dfuDNLOAD_SYNC
state completely.Since the correct solution is not necessarily trivial, I'm not submitting a PR for this.
The text was updated successfully, but these errors were encountered: