[Pcsclite-cvs-commit] r2334 - trunk/PCSC/src

Ludovic Rousseau rousseau at alioth.debian.org
Thu Jan 11 18:58:43 CET 2007


Author: rousseau
Date: 2007-01-11 18:58:43 +0100 (Thu, 11 Jan 2007)
New Revision: 2334

Modified:
   trunk/PCSC/src/hotplug_libusb.c
   trunk/PCSC/src/pcscdaemon.c
Log:
add --force-reader-polling command line option to force the bus polling
even if the drivers says they support IFD_GENERATE_HOTPLUG

Thanks to Alon Bar-Lev for the suggestion


Modified: trunk/PCSC/src/hotplug_libusb.c
===================================================================
--- trunk/PCSC/src/hotplug_libusb.c	2007-01-11 17:56:32 UTC (rev 2333)
+++ trunk/PCSC/src/hotplug_libusb.c	2007-01-11 17:58:43 UTC (rev 2334)
@@ -55,6 +55,7 @@
 static PCSCLITE_THREAD_T usbNotifyThread;
 static int driverSize = -1;
 static char AraKiriHotPlug = FALSE;
+extern int HPForceReaderPolling;
 
 /* values of ifdCapabilities bits */
 #define IFD_GENERATE_HOTPLUG 1
@@ -395,9 +396,16 @@
 				break;
 			}
 
+	if (HPForceReaderPolling)
+	{
+		Log2(PCSC_LOG_INFO,
+				"Polling forced every %d second(s)", HPForceReaderPolling);
+		do_polling = TRUE;
+	}
+
 	while (do_polling)
 	{
-		SYS_Sleep(1);
+		SYS_Sleep(HPForceReaderPolling);
 		HPRescanUsbBus();
 	}
 }

Modified: trunk/PCSC/src/pcscdaemon.c
===================================================================
--- trunk/PCSC/src/pcscdaemon.c	2007-01-11 17:56:32 UTC (rev 2333)
+++ trunk/PCSC/src/pcscdaemon.c	2007-01-11 17:58:43 UTC (rev 2334)
@@ -51,6 +51,7 @@
 
 char AraKiri = FALSE;
 static char Init = TRUE;
+int HPForceReaderPolling = 0;
 
 /*
  * Some internal functions
@@ -259,6 +260,7 @@
 		{"error", 0, 0, 'e'},
 		{"critical", 0, 0, 'C'},
 		{"hotplug", 0, 0, 'H'},
+		{"force-reader-polling", optional_argument, 0, 0},
 		{0, 0, 0, 0}
 	};
 #endif
@@ -297,6 +299,13 @@
 	while ((opt = getopt (argc, argv, OPT_STRING)) != -1) {
 #endif
 		switch (opt) {
+#ifdef  HAVE_GETOPT_LONG
+			case 0:
+				if (strcmp(long_options[option_index].name,
+					"force-reader-polling") == 0)
+					HPForceReaderPolling = optarg ? abs(atoi(optarg)) : 1;
+				break;
+#endif
 			case 'c':
 				Log2(PCSC_LOG_INFO, "using new config file: %s", optarg);
 				newReaderConfig = optarg;




More information about the Pcsclite-cvs-commit mailing list