/[pcsclite]/trunk/Drivers/ccid/src/ccid_serial.c
ViewVC logotype

Diff of /trunk/Drivers/ccid/src/ccid_serial.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1452 by rousseau, Tue Apr 26 13:44:08 2005 UTC revision 1453 by rousseau, Tue Apr 26 14:34:52 2005 UTC
# Line 42  Line 42 
42  #include "utils.h"  #include "utils.h"
43  #include "commands.h"  #include "commands.h"
44    
 /* communication timeout in seconds  
  * the value is set at the end of OpenSerialByName() */  
 int SerialTimeout;  
   
45  #define SYNC 0x03  #define SYNC 0x03
46  #define CTRL_ACK 0x06  #define CTRL_ACK 0x06
47  #define CTRL_NAK 0x15  #define CTRL_NAK 0x15
# Line 447  static int ReadChunk(unsigned int reader Line 443  static int ReadChunk(unsigned int reader
443                  /* use select() to, eventually, timeout */                  /* use select() to, eventually, timeout */
444                  FD_ZERO(&fdset);                  FD_ZERO(&fdset);
445                  FD_SET(fd, &fdset);                  FD_SET(fd, &fdset);
446                  t.tv_sec = SerialTimeout;                  t.tv_sec = serialDevice[reader_index].ccid.readTimeout;
447                  t.tv_usec = 0;                  t.tv_usec = 0;
448    
449                  i = select(fd+1, &fdset, NULL, NULL, &t);                  i = select(fd+1, &fdset, NULL, NULL, &t);
# Line 459  static int ReadChunk(unsigned int reader Line 455  static int ReadChunk(unsigned int reader
455                  else                  else
456                          if (i == 0)                          if (i == 0)
457                          {                          {
458                                  DEBUG_COMM2("Timeout! (%d sec)", SerialTimeout);                                  DEBUG_COMM2("Timeout! (%d sec)", serialDevice[reader_index].ccid.readTimeout);
459                                  return -1;                                  return -1;
460                          }                          }
461    
# Line 620  status_t OpenSerialByName(unsigned int r Line 616  status_t OpenSerialByName(unsigned int r
616                  unsigned int rx_length = sizeof(rx_buffer);                  unsigned int rx_length = sizeof(rx_buffer);
617    
618                  /* 2 seconds timeout to not wait too long if no reader is connected */                  /* 2 seconds timeout to not wait too long if no reader is connected */
619                  SerialTimeout = 2;                  serialDevice[reader].ccid.readTimeout = 2;
620    
621                  if (IFD_SUCCESS != CmdEscape(reader_index, tx_buffer, sizeof(tx_buffer),                  if (IFD_SUCCESS != CmdEscape(reader_index, tx_buffer, sizeof(tx_buffer),
622                          rx_buffer, &rx_length))                          rx_buffer, &rx_length))
# Line 629  status_t OpenSerialByName(unsigned int r Line 625  status_t OpenSerialByName(unsigned int r
625                          return STATUS_UNSUCCESSFUL;                          return STATUS_UNSUCCESSFUL;
626                  }                  }
627    
628                  /* normal timeout: 1 minute to allow long time APDU */                  /* normal timeout: 2 seconds */
629                  SerialTimeout = 60;                  serialDevice[reader].ccid.readTimeout = DEFAULT_COM_READ_TIMEOUT ;
630    
631                  rx_buffer[rx_length] = '\0';                  rx_buffer[rx_length] = '\0';
632                  DEBUG_INFO2("Firmware: %s", rx_buffer);                  DEBUG_INFO2("Firmware: %s", rx_buffer);

Legend:
Removed from v.1452  
changed lines
  Added in v.1453

  ViewVC Help
Powered by ViewVC 1.1.5