[Pcsclite-cvs-commit] r6890 - trunk/Drivers/ccid/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Thu Apr 24 13:51:03 UTC 2014


Author: rousseau
Date: 2014-04-24 13:51:03 +0000 (Thu, 24 Apr 2014)
New Revision: 6890

Modified:
   trunk/Drivers/ccid/src/ccid_usb.c
Log:
OpenUSBByName(): add a 100 ms delay on Mac OS X

The USB device may be detected by the Mac OS X USB layer (used by pcscd)
but not yet by libusb (used by libccid).

We must give some time (100 ms) before listing the USB devices seen by
libusb. Noticed on OS X Mavericks using libusb 1.0.18.


Modified: trunk/Drivers/ccid/src/ccid_usb.c
===================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c	2014-04-24 13:48:01 UTC (rev 6889)
+++ trunk/Drivers/ccid/src/ccid_usb.c	2014-04-24 13:51:03 UTC (rev 6890)
@@ -219,6 +219,9 @@
 	char infofile[FILENAME_MAX];
 #ifndef __APPLE__
 	unsigned int device_vendor, device_product;
+#else
+	/* 100 ms delay */
+	struct timespec sleep_time = { 0, 100 * 1000 * 1000 };
 #endif
 	int interface_number = -1;
 	int i;
@@ -311,6 +314,10 @@
 		}
 	}
 
+#ifdef __APPLE__
+	/* give some time to libusb to detect the new USB devices on Mac OS X */
+	nanosleep(&sleep_time, NULL);
+#endif
 	cnt = libusb_get_device_list(ctx, &devs);
 	if (cnt < 0)
 	{




More information about the Pcsclite-cvs-commit mailing list