openocd/src/jtag/aice
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
..
aice_interface.c adapter: switch from struct jtag_interface to adapter_driver 2020-01-14 11:39:37 +00:00
aice_interface.h nds32: Add jtag scan_chain command 2018-03-12 14:12:59 +00:00
aice_pipe.c target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
aice_pipe.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
aice_port.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
aice_port.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
aice_transport.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
aice_transport.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
aice_usb.c jtag_libusb_bulk_read|write: return error code instead of size 2020-01-22 05:33:31 +00:00
aice_usb.h nds32: Avoid detected JTAG clock 2018-07-18 21:06:51 +01:00
Makefile.am Convert to non-recursive make 2016-12-08 16:23:10 +00:00