jtag/drivers/kitprog: use HID read timeout
Use hid_read_timeout() instead of hid_read(). Improve error messages. Change-Id: Ia75b4fcd610442ab926bc454341f928d59843fcf Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7106 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
66d6f9a1e7
commit
1a9d991619
|
@ -321,9 +321,13 @@ static int kitprog_hid_command(uint8_t *command, size_t command_length,
|
|||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
ret = hid_read(kitprog_handle->hid_handle, data, data_length);
|
||||
if (ret < 0) {
|
||||
LOG_DEBUG("HID read returned %i", ret);
|
||||
ret = hid_read_timeout(kitprog_handle->hid_handle,
|
||||
data, data_length, LIBUSB_TIMEOUT_MS);
|
||||
if (ret == 0) {
|
||||
LOG_ERROR("HID read timed out");
|
||||
return ERROR_TIMEOUT_REACHED;
|
||||
} else if (ret < 0) {
|
||||
LOG_ERROR("HID read error %ls", hid_error(kitprog_handle->hid_handle));
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue