| 36 |
#include "ccid.h" |
#include "ccid.h" |
| 37 |
|
|
| 38 |
|
|
| 39 |
#define USB_TIMEOUT (60 * 1000) /* 1 minute timeout */ |
/* read timeout |
| 40 |
|
* we must wait enough so that the card can finish its calculation |
| 41 |
|
* the card, and then the reader should send TIME REQUEST bytes |
| 42 |
|
* so this timeout should never occur */ |
| 43 |
|
#define USB_READ_TIMEOUT (60 * 1000) /* 1 minute timeout */ |
| 44 |
|
|
| 45 |
|
/* write timeout |
| 46 |
|
* we don't have to wait a long time since the card was doing nothing */ |
| 47 |
|
#define USB_WRITE_TIMEOUT (5 * 1000) /* 5 seconds timeout */ |
| 48 |
|
|
| 49 |
|
|
| 50 |
#define BUS_DEVICE_STRSIZE 32 |
#define BUS_DEVICE_STRSIZE 32 |
| 51 |
|
|
| 297 |
DEBUG_XXD(debug_header, buffer, length); |
DEBUG_XXD(debug_header, buffer, length); |
| 298 |
#endif |
#endif |
| 299 |
|
|
| 300 |
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); |
| 301 |
|
|
| 302 |
if (rv < 0) |
if (rv < 0) |
| 303 |
{ |
{ |
| 326 |
#endif |
#endif |
| 327 |
|
|
| 328 |
|
|
| 329 |
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); |
| 330 |
*length = rv; |
*length = rv; |
| 331 |
|
|
| 332 |
if (rv < 0) |
if (rv < 0) |