Changeset 1951 for trunk/reader-seca.c
- Timestamp:
- 04/05/10 09:13:48 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/reader-seca.c
r1948 r1951 3 3 #include <stdlib.h> 4 4 5 extern uchar cta_res[];6 extern ushort cta_lr;7 8 #define write_cmd(cmd, data) \9 { \10 if (card_write(reader, cmd, data)) return ERROR; \11 }12 13 #define read_cmd(cmd, data) \14 { \15 if (card_write(reader, cmd, NULL)) return ERROR; \16 }17 18 5 static int set_provider_info(struct s_reader * reader, int i) 19 6 { 7 def_resp; 20 8 static uchar ins12[] = { 0xc1, 0x12, 0x00, 0x00, 0x19 }; // get provider info 21 9 int year, month, day; … … 26 14 27 15 ins12[2]=i;//select provider 28 read_cmd(ins12, NULL); // show provider properties16 write_cmd(ins12, NULL); // show provider properties 29 17 30 18 if ((cta_res[25] != 0x90) || (cta_res[26] != 0x00)) return ERROR; … … 61 49 { 62 50 get_atr; 51 def_resp; 63 52 char *card; 64 53 static unsigned short pmap=0; // provider-maptable … … 92 81 reader->caid[0]=0x0100; 93 82 memset(reader->prid, 0xff, sizeof(reader->prid)); 94 read_cmd(ins0e, NULL); // read unique id83 write_cmd(ins0e, NULL); // read unique id 95 84 memcpy(reader->hexserial, cta_res+2, 6); 96 85 serial = b2ll(5, cta_res+3) ; 97 86 cs_ri_log (reader, "type: SECA, caid: %04X, serial: %llu, card: %s v%d.%d", 98 87 reader->caid[0], serial, card, atr[9]&0x0F, atr[9]>>4); 99 read_cmd(ins16, NULL); // read nr of providers88 write_cmd(ins16, NULL); // read nr of providers 100 89 pmap=cta_res[2]<<8|cta_res[3]; 101 90 for (reader->nprov=0, i=pmap; i; i>>=1) … … 135 124 int seca_do_ecm(struct s_reader * reader, ECM_REQUEST *er) 136 125 { 126 def_resp; 137 127 unsigned char ins3c[] = { 0xc1,0x3c,0x00,0x00,0x00 }; // coding cw 138 128 unsigned char ins3a[] = { 0xc1,0x3a,0x00,0x00,0x10 }; // decoding cw … … 153 143 } 154 144 if ((cta_res[0] != 0x90) || (cta_res[1] != 0x00)) return ERROR; 155 read_cmd(ins3a, NULL); //get cw's145 write_cmd(ins3a, NULL); //get cw's 156 146 if ((cta_res[16] != 0x90) || (cta_res[17] != 0x00)) return ERROR;//exit if response is not 90 00 //TODO: if response is 9027 ppv mode is possible! 157 147 memcpy(er->cw,cta_res,16); … … 189 179 int seca_do_emm(struct s_reader * reader, EMM_PACKET *ep) 190 180 { 181 def_resp; 191 182 unsigned char ins40[] = { 0xc1,0x40,0x00,0x00,0x00 }; 192 183 int i,ins40data_offset; … … 240 231 //This module is therefore optical only 241 232 233 def_resp; 242 234 static unsigned char ins34[] = { 0xc1, 0x34, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 }; //data following is provider Package Bitmap Records 243 235 static unsigned char ins32[] = { 0xc1, 0x32, 0x00, 0x00, 0x20 }; // get PBM … … 247 239 ins32[2] = prov; 248 240 write_cmd (ins34, ins34 + 5); //prepare card for pbm request 249 read_cmd(ins32, NULL); //pbm request241 write_cmd (ins32, NULL); //pbm request 250 242 uchar pbm[8]; //TODO should be arrayed per prov 251 243 switch (cta_res[0]) {
Note:
See TracChangeset
for help on using the changeset viewer.