From 30165768d174d544584a2657b68e98c6aaa76e8d Mon Sep 17 00:00:00 2001 From: Erhan Kurubas Date: Fri, 17 May 2024 11:44:37 +0200 Subject: [PATCH] jtag/esp_usb_jtag: re-init usb port when replug or hard reset detected --- src/jtag/drivers/esp_usb_jtag.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/jtag/drivers/esp_usb_jtag.c b/src/jtag/drivers/esp_usb_jtag.c index 1e352b8255..6b8080648d 100644 --- a/src/jtag/drivers/esp_usb_jtag.c +++ b/src/jtag/drivers/esp_usb_jtag.c @@ -322,18 +322,8 @@ static int esp_usb_jtag_revive_device(struct libusb_device_handle *usb_device) while (tries-- >= 0) { new_dev = jtag_libusb_find_device(vids, pids, esp_usb_jtag_serial); - if (new_dev) { - if (esp_usb_jtag_libusb_location_equal(cur_dev, new_dev)) { - /* device is still at the same location on bus and with the same address, - try to reset it */ - int rc = libusb_reset_device(usb_device); - if (rc == LIBUSB_ERROR_NOT_FOUND || rc == LIBUSB_ERROR_NO_DEVICE) { - /* re-enumeration is necessary */ - break; - } - libusb_unref_device(new_dev); - return rc == 0 ? ERROR_OK : ERROR_WAIT; - } + if (new_dev && esp_usb_jtag_libusb_location_equal(cur_dev, new_dev)) { + /* device is still at the same location on bus and with the same address, try to re-init it */ break; } jtag_sleep(100000);