Fixing dfu-util warning due to improper protocol state sequence
Fixes this warning message: dfu-util: unable to read DFU status after completion Results in: Download done. state(7) = dfuMANIFEST, status(0) = No error condition is present state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present Done! Functionally no different, just a better user experience.
This commit is contained in:
parent
26915c4d5b
commit
77218a641b
@ -185,10 +185,18 @@ static int dfu_handle_control( struct usb_ctrl_req_t *req, void *data )
|
|||||||
* and reset the system to put the new firmware into
|
* and reset the system to put the new firmware into
|
||||||
* effect.
|
* effect.
|
||||||
*/
|
*/
|
||||||
usb_ep0_tx_cp(&st, sizeof(st), req->wLength, NULL, NULL);
|
usb_ep0_tx_cp( &st, sizeof(st), req->wLength, NULL, NULL );
|
||||||
if (ctx->state == DFU_STATE_dfuMANIFEST) {
|
switch ( ctx->state )
|
||||||
|
{
|
||||||
|
case DFU_STATE_dfuMANIFEST:
|
||||||
|
ctx->state = DFU_STATE_dfuMANIFEST_WAIT_RESET;
|
||||||
|
break;
|
||||||
|
case DFU_STATE_dfuMANIFEST_WAIT_RESET:
|
||||||
|
ctx->state = DFU_STATE_dfuIDLE;
|
||||||
usb_handle_control_status_cb(dfu_reset_system);
|
usb_handle_control_status_cb(dfu_reset_system);
|
||||||
goto out_no_status;
|
goto out_no_status;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -198,11 +206,12 @@ static int dfu_handle_control( struct usb_ctrl_req_t *req, void *data )
|
|||||||
break;
|
break;
|
||||||
case USB_CTRL_REQ_DFU_GETSTATE: {
|
case USB_CTRL_REQ_DFU_GETSTATE: {
|
||||||
uint8_t st = ctx->state;
|
uint8_t st = ctx->state;
|
||||||
usb_ep0_tx_cp(&st, sizeof(st), req->wLength, NULL, NULL);
|
usb_ep0_tx_cp( &st, sizeof(st), req->wLength, NULL, NULL );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case USB_CTRL_REQ_DFU_ABORT:
|
case USB_CTRL_REQ_DFU_ABORT:
|
||||||
switch (ctx->state) {
|
switch ( ctx->state )
|
||||||
|
{
|
||||||
case DFU_STATE_dfuIDLE:
|
case DFU_STATE_dfuIDLE:
|
||||||
case DFU_STATE_dfuDNLOAD_IDLE:
|
case DFU_STATE_dfuDNLOAD_IDLE:
|
||||||
case DFU_STATE_dfuUPLOAD_IDLE:
|
case DFU_STATE_dfuUPLOAD_IDLE:
|
||||||
|
Reference in New Issue
Block a user