2009/2/6 Andreas Jellinghaus <[email protected]>:
> Am Freitag 06 Februar 2009 09:27:11 schrieb Ludovic Rousseau:
>> 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.
>
> please resend, the patch has strange ascii escape sequences in it.

It is a colored patch (colordiff). Sorry for the mistake. New version attached.

> also 3 seconds seems quite long to me.

Only if you also have pcscd running.

The patch will impact only people with the following configuration:
- use OpenCT
- use pcsc-lite (file "/var/run/pcscd/pcscd.comm" is present)
- have a CCID reader NOT supported by pcsc-lite but only by OpenCT

In all other cases the patch has no performance impact.
So no impact if you do not use pcsc-lite.

Is that acceptable?

-- 
 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