Changeset 1255 for branches/smartreader/csctapi/ifd_phoenix.c
- Timestamp:
- 01/16/10 17:56:59 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/smartreader/csctapi/ifd_phoenix.c
r1254 r1255 13 13 #include <termios.h> 14 14 15 #define OK 1 15 #define OK 1 16 16 #define ERROR 0 17 17 … … 46 46 47 47 int Phoenix_Reset (ATR ** atr) 48 { 49 return OK; 48 { 49 50 #ifdef DEBUG_IFD 51 printf ("IFD: Resetting card:\n"); 52 #endif 53 54 int ret; 55 int i; 56 int parity[3] = {PARITY_EVEN, PARITY_ODD, PARITY_NONE}; 57 #ifdef HAVE_NANOSLEEP 58 struct timespec req_ts; 59 req_ts.tv_sec = 0; 60 req_ts.tv_nsec = 50000000; 61 #endif 62 63 (*atr) = NULL; 64 for(i=0; i<3; i++) { 65 IO_Serial_Flush(); 66 if (!IO_Serial_SetParity (parity[i])) 67 return ERROR; 68 69 ret = ERROR; 70 IO_Serial_Ioctl_Lock(1); 71 #ifdef USE_GPIO 72 if (gpio_detect){ 73 set_gpio(0); 74 set_gpio1(0); 75 } 76 else 77 #endif 78 IO_Serial_RTS_Set(); 79 #ifdef HAVE_NANOSLEEP 80 nanosleep (&req_ts, NULL); 81 #else 82 usleep (50000L); 83 #endif 84 #ifdef USE_GPIO 85 if (gpio_detect) { 86 set_gpio_input(); 87 set_gpio1(1); 88 } 89 else 90 #endif 91 IO_Serial_RTS_Clr(); 92 IO_Serial_Ioctl_Lock(0); 93 (*atr) = ATR_New (); 94 if(ATR_InitFromStream ((*atr), IFD_TOWITOKO_ATR_TIMEOUT) == ATR_OK) 95 ret = OK; 96 // Succesfully retrieve ATR 97 if (ret == OK) 98 break; 99 else 100 { 101 ATR_Delete (*atr); 102 (*atr) = NULL; 103 #ifdef USE_GPIO 104 if (gpio_detect) set_gpio1(0); 105 #endif 106 } 107 } 108 IO_Serial_Flush(); 109 110 /* 111 //PLAYGROUND faking ATR for test purposes only 112 // 113 // sky 919 unsigned char atr_test[] = { 0x3F, 0xFF, 0x13, 0x25, 0x03, 0x10, 0x80, 0x33, 0xB0, 0x0E, 0x69, 0xFF, 0x4A, 0x50, 0x70, 0x00, 0x00, 0x49, 0x54, 0x02, 0x00, 0x00 }; 114 // HD+ unsigned char atr_test[] = { 0x3F, 0xFF, 0x95, 0x00, 0xFF, 0x91, 0x81, 0x71, 0xFE, 0x47, 0x00, 0x44, 0x4E, 0x41, 0x53, 0x50, 0x31, 0x34, 0x32, 0x20, 0x52, 0x65, 0x76, 0x47, 0x43, 0x34, 0x63 }; 115 // S02 = irdeto unsigned char atr_test[] = { 0x3B, 0x9F, 0x21, 0x0E, 0x49, 0x52, 0x44, 0x45, 0x54, 0x4F, 0x20, 0x41, 0x43, 0x53, 0x03}; 116 //cryptoworks unsigned char atr_test[] = { 0x3B, 0x78, 0x12, 0x00, 0x00, 0x65, 0xC4, 0x05, 0xFF, 0x8F, 0xF1, 0x90, 0x00 }; 117 ATR_Delete(*atr); //throw away actual ATR 118 (*atr) = ATR_New (); 119 ATR_InitFromArray ((*atr), atr_test, sizeof(atr_test)); 120 //END OF PLAYGROUND 121 */ 122 123 return ret; 50 124 } 51 125 … … 70 144 if (gpio_detect) set_gpio1(0); 71 145 #endif 72 for (sent = 0; sent < size; sent = sent + to_send) 146 for (sent = 0; sent < size; sent = sent + to_send) 73 147 { 74 148 /* Calculate number of bytes to send */
Note:
See TracChangeset
for help on using the changeset viewer.