Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/63258 )
Change subject: ch341a_spi.c: Reset device before use ......................................................................
ch341a_spi.c: Reset device before use
This fixes the device being unusable, due to failed LIBUSB transfers after flashrom is interrupted.
Change-Id: Iff824c22dc871bb2d9504abe8b5ad4e4c191c4af Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M ch341a_spi.c 1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/58/63258/1
diff --git a/ch341a_spi.c b/ch341a_spi.c index bc4112b..b42254b 100644 --- a/ch341a_spi.c +++ b/ch341a_spi.c @@ -447,8 +447,14 @@ return -1; }
- ret = libusb_set_auto_detach_kernel_driver(handle, 1); + /* Reset device state to known good state. */ + ret = libusb_reset_device(handle); if (ret != 0) { + msg_pwarn("Unable to reset device.\n"); + } + + ret = libusb_set_auto_detach_kernel_driver(handle, 1); + if (ret != 0) { msg_pwarn("Platform does not support detaching of USB kernel drivers.\n" "If an unsupported driver is active, claiming the interface may fail.\n"); }