openocd/src
Oleksij Rempel d612baacaa jtag_libusb_bulk_read|write: return error code instead of size
A USB bulk write/read operation may fail with different errors:
 LIBUSB_ERROR_TIMEOUT if the transfer timed out (and populates transferred)
 LIBUSB_ERROR_PIPE if the endpoint halted
 LIBUSB_ERROR_OVERFLOW if the device offered more data, see Packets and overflows
 LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
 another LIBUSB_ERROR code on other failures

Current OpenOCD code is using the transfer size based error detection.
Which may not always work. For example for LIBUSB_ERROR_OVERFLOW as libusb
documentation says:
"Problems may occur if the device attempts to send more data than can fit in
the buffer. libusb reports LIBUSB_TRANSFER_OVERFLOW for this condition but
other behaviour is largely undefined: actual_length may or may not be accurate,
the chunk of data that can fit in the buffer (before overflow) may or may not
have been transferred."

This patch is refactoring code to use actual error return value for
error detection instead of size.

Change-Id: Iec0798438ca7b5c76e2e2912af21d9aa76ee0217
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/4590
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-22 05:33:31 +00:00
..
flash flash/nor: Rename flash_address() to cfi_flash_address() 2020-01-16 12:26:23 +00:00
helper jtag_vpi: multiple improvements 2020-01-02 21:22:33 +00:00
jtag jtag_libusb_bulk_read|write: return error code instead of size 2020-01-22 05:33:31 +00:00
pld helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
rtos rtos/FreeRTOS: Fix FreeRTOS thread list reading 2020-01-02 21:20:29 +00:00
server server/server: fix clang static analyzer warning 2020-01-16 09:44:49 +00:00
svf helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
target mips_ejtag: there is no DCR.MIPS64 bit 2020-01-20 06:28:49 +00:00
transport adi_v5_dapdirect: add support for adapter drivers that provide DAP API 2020-01-14 11:40:25 +00:00
xsvf xsvf: fix memory leak 2020-01-16 09:44:33 +00:00
hello.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
hello.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
main.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
Makefile.am Convert to non-recursive make 2016-12-08 16:23:10 +00:00
openocd.c mflash: Remove this broken flash driver 2019-07-28 21:17:47 +01:00
openocd.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00