Changeset 1389 for trunk/reader-conax.c
- Timestamp:
- 01/31/10 19:48:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/reader-conax.c
r1323 r1389 2 2 #include "reader-common.h" 3 3 4 extern uchar cta_ cmd[], cta_res[];4 extern uchar cta_res[]; 5 5 extern ushort cta_lr; 6 6 … … 30 30 #define write_cmd(cmd, data) \ 31 31 { \ 32 if (card_write(cmd, data)) return (0); \32 if (card_write(cmd, data)) return ERROR; \ 33 33 } 34 34 35 35 #define read_cmd(cmd, data) \ 36 36 { \ 37 if (card_write(cmd, NULL)) return (0); \37 if (card_write(cmd, NULL)) return ERROR; \ 38 38 } 39 39 … … 52 52 } 53 53 54 int conax_card_init(uchar *atr) 55 { 54 int conax_card_init(ATR newatr) 55 { 56 get_atr; 56 57 int i, j, n; 57 uchar atr_ 0b00[] = { '0', 'B', '0', '0'};58 uchar atr_conax[] = { 0x3B, 0x24, 0x00 }; 58 59 uchar ins26[] = {0xDD, 0x26, 0x00, 0x00, 0x03, 0x10, 0x01, 0x40}; 59 60 uchar ins82[] = {0xDD, 0x82, 0x00, 0x00, 0x11, 0x11, 0x0f, 0x01, 0xb0, 0x0f, 0xff, \ … … 62 63 uchar cardver=0; 63 64 64 if ((memcmp(atr+3, atr_0b00, sizeof(atr_0b00))) && 65 (memcmp(atr+4, atr_0b00, sizeof(atr_0b00)))) 66 return(0); 65 if (memcmp(atr, atr_conax, sizeof(atr_conax))) 66 return ERROR; 67 67 68 68 reader[ridx].caid[0]=0xB00; 69 69 70 if ((n=read_record(ins26, ins26+5))<0) return (0); // read caid, card-version70 if ((n=read_record(ins26, ins26+5))<0) return ERROR; // read caid, card-version 71 71 for (i=0; i<n; i+=cta_res[i+1]+2) 72 72 switch(cta_res[i]) … … 76 76 } 77 77 78 if ((n=read_record(ins82, ins82+5))<0) return (0); // read serial78 if ((n=read_record(ins82, ins82+5))<0) return ERROR; // read serial 79 79 80 80 for (j=0, i=2; i<n; i+=cta_res[i+1]+2) … … 109 109 110 110 cs_log("ready for requests"); 111 return (1);112 } 113 114 int conax_send_pin(void)111 return OK; 112 } 113 114 static int conax_send_pin(void) 115 115 { 116 116 unsigned char insPIN[] = { 0xDD,0xC8,0x00,0x00,0x07,0x1D,0x05,0x01,0x00,0x00,0x00,0x00 }; //letzte vier ist der Pin-Code … … 120 120 cs_ri_log("[conax]-sending pincode to card"); 121 121 122 return (1);122 return OK; 123 123 } 124 124 … … 133 133 134 134 if ((n=CheckSctLen(er->ecm, 3))<0) 135 return (0);135 return ERROR; 136 136 137 137 buf[0]=0x14; … … 199 199 } 200 200 } 201 return(rc==3); 201 if (rc==3) 202 return OK; 203 else 204 return ERROR; 202 205 } 203 206 … … 226 229 rc=((cta_res[0]==0x90)&&(cta_res[1]==0x00)); 227 230 228 return(rc); 229 231 if (rc) 232 return OK; 233 else 234 return ERROR; 230 235 } 231 236 … … 277 282 } 278 283 } 279 return (1);280 } 284 return OK; 285 }
Note:
See TracChangeset
for help on using the changeset viewer.