dfu: force USB reset when download end in DFUIdle state
This commit is contained in:
parent
9d494c1be1
commit
0979194da2
|
|
@ -442,11 +442,13 @@ int DFU::set_state(char newState)
|
||||||
* an handle others states */
|
* an handle others states */
|
||||||
if (newState == STATE_appIDLE) {
|
if (newState == STATE_appIDLE) {
|
||||||
// reset
|
// reset
|
||||||
|
ret = libusb_reset_device(dev_handle);
|
||||||
// reenum
|
// reenum
|
||||||
} else { // download or upload
|
} else { // download or upload
|
||||||
// are handled by download() and upload()
|
// are handled by download() and upload()
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
break;
|
break;
|
||||||
case STATE_dfuDNLOAD_IDLE:
|
case STATE_dfuDNLOAD_IDLE:
|
||||||
if (newState == STATE_dfuMANIFEST_SYNC) {
|
if (newState == STATE_dfuMANIFEST_SYNC) {
|
||||||
|
|
@ -770,6 +772,9 @@ int DFU::download()
|
||||||
}
|
}
|
||||||
} while (must_continue);
|
} while (must_continue);
|
||||||
|
|
||||||
|
if (status.bState == STATE_dfuIDLE)
|
||||||
|
set_state(STATE_appIDLE);
|
||||||
|
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue