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 */
|
||||
if (newState == STATE_appIDLE) {
|
||||
// reset
|
||||
ret = libusb_reset_device(dev_handle);
|
||||
// reenum
|
||||
} else { // download or upload
|
||||
// are handled by download() and upload()
|
||||
return -2;
|
||||
}
|
||||
return ret;
|
||||
break;
|
||||
case STATE_dfuDNLOAD_IDLE:
|
||||
if (newState == STATE_dfuMANIFEST_SYNC) {
|
||||
|
|
@ -770,6 +772,9 @@ int DFU::download()
|
|||
}
|
||||
} while (must_continue);
|
||||
|
||||
if (status.bState == STATE_dfuIDLE)
|
||||
set_state(STATE_appIDLE);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue