2009/2/2 Ludovic Rousseau <[email protected]>:
> Maybe we could also define a priority rule : if both openct and
> pcsc-lite are installed then pcsc-lite has priority, or something like
> that.
> It can be easy to implement: in the ccid driver just wait for 1 or 2
> seconds before claiming the device. pcsc-lite will then be the first
> to get it.

I propose the attached patch. The idea is to sleep for 3 seconds if a
CCID device is detected and pcsc-lite is also running.
If the device is not claimed by a pcsc-lite driver then openct will
use it as before.

I could not test the patch. I can't make openct 0.6.15 (SVN) work for
me. Maybe I forgot a ./configure option.

Any objection or comment?

Bye

-- 
 Dr. Ludovic Rousseau
Index: src/ifd/ifd-ccid.c
===================================================================
--- src/ifd/ifd-ccid.c   (révision 1135)
+++ src/ifd/ifd-ccid.c   (copie de travail)
@@ -15,6 +15,8 @@
 #include "atr.h"
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #define CCID_ERR_ABORTED 0xFF    /* CMD ABORTED */
 #define CCID_ERR_ICC_MUTE        0xFE
@@ -490,6 +492,13 @@ static int ccid_open_usb(ifd_device_t * 
  unsigned char *p;
  int support_events = 0;
 
+#define PCSCLITE_FILE "/var/run/pcscd/pcscd.comm"
+        struct stat buf;
+
+        /* give priority to pcsc-lite for CCID devices */
+        if (0 == stat(PCSCLITE_FILE, &buf))
+                sleep(3);
+
  if (ifd_usb_get_device(dev, &de)) {
          ct_error("ccid: device descriptor not found");
          ifd_device_close(dev);
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to