File acsccid-1.1.6-polling-unplug.patch of Package pcsc-acsccid

Index: acsccid-1.1.6/src/ccid_usb.c
===================================================================
--- acsccid-1.1.6.orig/src/ccid_usb.c
+++ acsccid-1.1.6/src/ccid_usb.c
@@ -1808,6 +1808,8 @@ int InterruptRead(int reader_index, int
 		libusb_free_transfer(transfer);
 		DEBUG_CRITICAL2("libusb_submit_transfer failed: %s",
 			libusb_error_name(ret));
+		if (ret == LIBUSB_ERROR_NO_DEVICE)
+			return IFD_NO_SUCH_DEVICE;
 		return IFD_COMMUNICATION_ERROR;
 	}
 
@@ -1827,6 +1829,8 @@ int InterruptRead(int reader_index, int
 			libusb_free_transfer(transfer);
 			DEBUG_CRITICAL2("libusb_handle_events failed: %s",
 				libusb_error_name(ret));
+			if (ret == LIBUSB_ERROR_NO_DEVICE)
+				return IFD_NO_SUCH_DEVICE;
 			return IFD_COMMUNICATION_ERROR;
 		}
 	}
@@ -1881,7 +1885,10 @@ int InterruptRead(int reader_index, int
 			DEBUG_COMM4("InterruptRead (%d/%d): %d",
 				usbDevice[reader_index].bus_number,
 				usbDevice[reader_index].device_address, ret);
-			return_value = IFD_COMMUNICATION_ERROR;
+			if (ret == LIBUSB_TRANSFER_NO_DEVICE)
+				return_value = IFD_NO_SUCH_DEVICE;
+			else
+				return_value = IFD_COMMUNICATION_ERROR;
 	}
 
 	return return_value;
openSUSE Build Service is sponsored by