]> git.gag.com Git - fw/openocd/commit
libusb_helper.h: Increase USB timeout
authorGabor Csapo <gaborcsapo@google.com>
Fri, 18 Mar 2022 10:11:49 +0000 (18:11 +0800)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 3 Apr 2022 20:12:03 +0000 (20:12 +0000)
commitf0d8c3b0e024d045262ba50a516a3bd66bf22686
tree6c1d9ef087a4d2c889a430c559bb980abbcd2363
parent017d3ddafbfac459a799f7e60613312c61fa3195
libusb_helper.h: Increase USB timeout

When we debug a target that works as a USB device, halting
the target causes the USB communication with the USB host to
become unresponsive. The host will try to reconnect/reset/setup
the unresponsive device during which communication with other
devices on the same USB bus can get stalled for several seconds.
If the JTAG adapter is on the same bus, we need to make sure
openOCD will wait for packets at least as long as the host USB
stack. Otherwise the USB stack might deliver a valid packet, but
openOCD would ignore it due to the timeout. The xHCI spec uses 5
sec timeouts, so let's use that in openOCD with some margin.

Use this value in all libusb calls. HID API might have a libusb
backend and would probably be victim to the same bug, so it
should use this timeout, too.

Ticket: https://sourceforge.net/p/openocd/tickets/343/
Signed-off-by: Gabor Csapo <gaborcsapo@google.com>
Change-Id: Ia3dc1356e676fe550f57a4c72f7a24ba296b6af2
Reviewed-on: https://review.openocd.org/c/openocd/+/6882
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/jtag/drivers/cmsis_dap.c
src/jtag/drivers/libusb_helper.h
src/jtag/drivers/nulink_usb.c
src/jtag/drivers/rlink.c
src/jtag/drivers/stlink_usb.c
src/jtag/drivers/ti_icdi_usb.c
src/jtag/drivers/ulink.c