From b01dc91c0b0d4a13b610c08a4523ee42d8a4b227 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 26 Jan 2022 20:31:46 +0100 Subject: [PATCH] simtrace2-cardem-pcsc: continue in case of LIBUSB_TRANSFER_ERROR Sometimes I get LIBUSB_TRANSFER_ERROR particularly when the USB bus is very busy. We shouldn't terminate the program, but simply resubmit it. That's what we have multiple transfers for... Change-Id: I77d7bc636c21171fcff7e70e87c0109cbaee9b51 --- host/src/simtrace2-cardem-pcsc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/host/src/simtrace2-cardem-pcsc.c b/host/src/simtrace2-cardem-pcsc.c index 031e1f0b..b7d41bda 100644 --- a/host/src/simtrace2-cardem-pcsc.c +++ b/host/src/simtrace2-cardem-pcsc.c @@ -278,6 +278,9 @@ static void usb_in_xfer_cb(struct libusb_transfer *xfer) /* hand the message up the stack */ process_usb_msg(ci, xfer->buffer, xfer->actual_length); break; + case LIBUSB_TRANSFER_ERROR: + LOGCI(ci, LOGL_FATAL, "USB IN transfer error, trying resubmit\n"); + break; case LIBUSB_TRANSFER_NO_DEVICE: LOGCI(ci, LOGL_FATAL, "USB device disappeared\n"); exit(1); @@ -329,6 +332,9 @@ static void usb_irq_xfer_cb(struct libusb_transfer *xfer) case LIBUSB_TRANSFER_COMPLETED: process_usb_msg_irq(ci, xfer->buffer, xfer->actual_length); break; + case LIBUSB_TRANSFER_ERROR: + LOGCI(ci, LOGL_FATAL, "USB INT transfer error, trying resubmit\n"); + break; case LIBUSB_TRANSFER_NO_DEVICE: LOGCI(ci, LOGL_FATAL, "USB device disappeared\n"); exit(1);