Changeset 1182 for trunk/csctapi/ifd_cool.c
- Timestamp:
- 01/11/10 12:11:53 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/ifd_cool.c
r1171 r1182 8 8 #include <time.h> 9 9 #include"ifd_cool.h" 10 /*11 #include "io_serial.h"12 #include "sci_global.h"13 #include "sci_ioctl.h"14 */15 10 16 // these should be called from icc, t0, cardterminal etc. like this:17 // switch (reader[ridx].type) {18 // case INTERN:19 // #ifdef COOL20 // Cool_Init();21 // break;22 // #endif23 // #ifdef SCI_DEV24 // //still in towitoko shit25 // #endif26 // case SMART:27 // case MOUSE:28 // IFD_Towitoko_Init(ifd, io, slot);29 // break;30 // default:31 // return ERROR;32 // }33 11 // all other IFD_Towitoko functions should be 34 12 // -eliminated (like SetLed or administrative jobs) … … 48 26 int Cool_Init () 49 27 { 50 //initialize properties(input_bitrate, output_bitrate, bits, stopbits, parity,dtr, rts) of device to default values51 //initialize ifd settings52 //and get reader info53 28 if (cnxt_kal_initialize ()) 54 29 return FALSE; … … 70 45 } 71 46 72 /*73 int Cool_GetStatus (BYTE * result)74 {75 // return status : 0 -start, 1 - card, 2- no card76 47 77 //extern int cnxt_smc_get_state(); 48 int Cool_GetStatus (int * in) 49 { 50 int state; 51 if (cnxt_smc_get_state(handle, &state)) 52 return ERROR; 53 //state = 0 no card, 1 = not ready, 2 = ready 54 if (state) 55 *in = 1; //CARD, even if not ready report card is in, or it will never get activated 56 else 57 *in = 0; //NOCARD 78 58 return OK; 79 59 } 80 */ 60 81 61 int Cool_Reset (ATR ** atr) 82 62 { 83 printf("Entering coolreset"); 84 fflush(stdout); 63 //Cool_Reset(atr); 85 64 //reset needs clock to be reset by hand 86 65 typedef unsigned long u_int32; … … 96 75 97 76 int n = 40; 98 //int atr_len = 40;99 77 unsigned char buf[40]; 100 78 if (cnxt_smc_get_atr (handle, buf, &n)) 101 79 return ERROR; 102 //atr_len = n; 103 // atr = buf; 104 ///////////// 105 (*atr) = ATR_New (); 106 if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK) 107 { 108 struct timespec req_ts; 109 req_ts.tv_sec = 0; 110 req_ts.tv_nsec = 50000000; 111 nanosleep (&req_ts, NULL); 112 #ifdef SCI_DEV 113 if (ioctl(ifd->io->fd, IOCTL_SET_ATR_READY)<0) 114 return ERROR; 115 #endif 116 return OK; 117 } 118 else 119 { 120 ATR_Delete (*atr); 121 (*atr) = NULL; 122 return ERROR; 123 } 124 /////////// 80 81 (*atr) = ATR_New (); 82 if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK) 83 { 84 struct timespec req_ts; 85 req_ts.tv_sec = 0; 86 req_ts.tv_nsec = 50000000; 87 nanosleep (&req_ts, NULL); 88 return OK; 89 } 90 else 91 { 92 ATR_Delete (*atr); 93 (*atr) = NULL; 94 return ERROR; 95 } 125 96 } 126 97 /* … … 155 126 #define TIMEOUT 4000 //max 4294 156 127 cardbuflen = 256;//it needs to know max buffer size to respond? 157 128 int rc = cnxt_smc_read_write(handle, FALSE, sent, size, cardbuffer, &cardbuflen, TIMEOUT, 0); 158 129 159 130 #ifdef DEBUG_IFD 160 131 //usually done in IFD_Towitoko, for COOL do it here 161 132 printf ("COOLIFD: Transmit: "); 162 133 int i; 163 134 for (i = 0; i < size; i++) 164 135 printf ("%X ", sent[i]); 165 136 printf ("\n"); 166 137 #endif
Note:
See TracChangeset
for help on using the changeset viewer.