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