[Pcsclite-cvs-commit] Drivers/ccid/src ccid_usb.c,1.5,1.6
rousseau@quantz.debian.org
rousseau@quantz.debian.org
Tue, 16 Dec 2003 11:11:11 +0100
Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory quantz:/tmp/cvs-serv18791/src
Modified Files:
ccid_usb.c
Log Message:
read and write timeouts are not symmetric. write timout can be shorter
since the reader and card is not supposed to do anything before
receiving (write) a command.
Index: ccid_usb.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid_usb.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ccid_usb.c 28 Oct 2003 18:18:11 -0000 1.5
+++ ccid_usb.c 16 Dec 2003 10:11:09 -0000 1.6
@@ -36,7 +36,16 @@
#include "ccid.h"
-#define USB_TIMEOUT (60 * 1000) /* 1 minute timeout */
+/* read timeout
+ * we must wait enough so that the card can finish its calculation
+ * the card, and then the reader should send TIME REQUEST bytes
+ * so this timeout should never occur */
+#define USB_READ_TIMEOUT (60 * 1000) /* 1 minute timeout */
+
+/* write timeout
+ * we don't have to wait a long time since the card was doing nothing */
+#define USB_WRITE_TIMEOUT (5 * 1000) /* 5 seconds timeout */
+
#define BUS_DEVICE_STRSIZE 32
@@ -288,7 +297,7 @@
DEBUG_XXD(debug_header, buffer, length);
#endif
- rv = usb_bulk_write(usbDevice[reader].handle, usbDevice[reader].bulk_out, buffer, length, USB_TIMEOUT);
+ rv = usb_bulk_write(usbDevice[reader].handle, usbDevice[reader].bulk_out, buffer, length, USB_WRITE_TIMEOUT);
if (rv < 0)
{
@@ -317,7 +326,7 @@
#endif
- rv = usb_bulk_read(usbDevice[reader].handle, usbDevice[reader].bulk_in, buffer, *length, USB_TIMEOUT);
+ rv = usb_bulk_read(usbDevice[reader].handle, usbDevice[reader].bulk_in, buffer, *length, USB_READ_TIMEOUT);
*length = rv;
if (rv < 0)