Changeset 1966
- Timestamp:
- 04/06/10 11:41:43 (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/ifd_sc8in1.c
r1965 r1966 31 31 static int current_slot; //FIXME should not be a global, but one per SC8in1 32 32 static unsigned char cardstatus; //FIXME not global but one per SC8in1 //if not static, the threads dont share same cardstatus! 33 static unsigned char sc8in1_clock[2];34 static unsigned short is_mcr;35 33 36 34 #define MAX_TRANSMIT 255 … … 63 61 tcdrain(reader->handle); 64 62 if (IO_Serial_Read (reader, 1000, lenread, buff) == ERROR) { 65 cs_log(" ERROR:SC8in1 Command read error");63 cs_log("SC8in1 Command read error"); 66 64 return ERROR; 67 65 } … … 153 151 //additional init, Phoenix_Init is also called for Sc8in1 ! 154 152 struct termios termio; 155 int i; 153 int i,speed,fd = reader->handle; 154 unsigned int is_mcr, sc8in1_clock = 0; 156 155 tcgetattr(reader->handle,&termio); 157 156 for (i=0; i<8; i++) … … 167 166 is_mcr = 0; 168 167 tcflush(reader->handle, TCIOFLUSH); // a non MCR reader might give longer answer 169 int fd = reader->handle;170 168 for (i=0; i<CS_MAXREADER; i++) //copy handle to other slots, FIXME change this if multiple sc8in1 readers 171 if (reader[i].typ == R_SC8in1) 169 if (reader[i].typ == R_SC8in1) { 172 170 reader[i].handle = fd; 171 if (!is_mcr) 172 continue; 173 //if MCR set clock 174 switch (reader->mhz) { 175 case 357: 176 case 358: 177 continue; 178 case 368: 179 case 369: 180 speed = 1; 181 break; 182 case 600: 183 speed = 2; 184 break; 185 case 800: 186 speed = 3; 187 break; 188 default: 189 speed = 0; 190 cs_log("ERROR Sc8in1, cannot set clockspeed to %i", reader->mhz); 191 break; 192 } 193 sc8in1_clock |= (speed << (reader->slot - 1) * 2); 194 } 195 buff[0] = 0x63; //MCR set clock 196 buff[1] = (sc8in1_clock >> 8) & 0xFF; 197 buff[2] = sc8in1_clock & 0xFF; 198 sc8in1_command(reader, buff, 3, 0); 199 // } 173 200 174 201 return OK; … … 203 230 return OK; 204 231 } 205 206 int MCR_SetClockrate (struct s_reader * reader, int mhz)207 {208 unsigned short speed, shift, mask;209 switch (mhz) {210 case 357:211 case 358:212 speed = 0;213 break;214 case 368:215 case 369:216 speed = 1;217 break;218 case 600:219 speed = 2;220 break;221 case 800:222 speed = 3;223 break;224 default:225 speed = 0;226 cs_log("ERROR Sc8in1, cannot set clockspeed to %i", mhz);227 break;228 }229 if (reader->slot >= 5)230 shift = (reader->slot - 5) * 2;231 else232 shift = (reader->slot - 1) * 2;233 speed = speed << shift;234 mask = 3 << shift;235 236 if (reader->slot >= 5) {237 sc8in1_clock[0] &= mask;238 sc8in1_clock[0] |= speed;239 }240 else {241 sc8in1_clock[1] &= mask;242 sc8in1_clock[1] |= speed;243 }244 return OK;245 }246 -
trunk/reader-cryptoworks.c
r1951 r1966 450 450 } 451 451 452 int cryptoworks_get_emm_type(EMM_PACKET *ep, struct s_reader * rdr) //returns TRUE if shared emm matches SA, unique emm matches serial, or global or unknown 453 { 454 rdr=rdr; 452 int cryptoworks_get_emm_type(EMM_PACKET *ep, struct s_reader * rdr) 453 { 454 cs_debug_mask(D_EMM, "Entered cryptoworks_get_emm_type ep->emm[0]=%02x",ep->emm[0]); 455 455 456 switch (ep->emm[0]) { 456 457 case 0x82: 457 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[13]==0x80 && ep->emm[14]==0x05) 458 ep->type = UNIQUE; //FIXME no ep->hexserial set 459 else 460 ep->type = UNKNOWN; 461 break; 458 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[13]==0x80 && ep->emm[14]==0x05) { 459 ep->type = UNIQUE; //FIXME: no ep->hexserial set 460 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: UNIQUE"); 461 return TRUE; //FIXME: still no check on serial 462 } 463 462 464 case 0x84: 463 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[12]==0x80 && ep->emm[13]==0x04) 465 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[12]==0x80 && ep->emm[13]==0x04) { 464 466 ep->type = SHARED; 465 else 466 ep->type = UNKNOWN; 467 break; 467 memset(ep->hexserial, 0, 8); 468 memcpy(ep->hexserial, ep->emm + 6, 4); 469 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: SHARED, ep = %s rdr = %s", 470 cs_hexdump(1, ep->emm + 6, 4), cs_hexdump(1, ep->hexserial, 4)); 471 return (!memcmp(ep->emm + 6, rdr->hexserial, 4)); // check for SA 472 } 473 468 474 case 0x88: 469 475 case 0x89: 470 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[8]==0x83 && ep->emm[9]==0x01) 476 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[8]==0x83 && ep->emm[9]==0x01) { 477 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: GLOBAL"); 471 478 ep->type = GLOBAL; 472 else 473 ep->type = UNKNOWN; 474 break; 475 case 0x8F://incoming via camd3.5x 476 //ep->type=emm[4]; 479 return TRUE; 480 } 481 482 //incoming via camd3.5x 483 //ep->type=emm[4]; 484 case 0x8F: 477 485 default: 478 486 ep->type = UNKNOWN; 487 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: UNKNOWN"); 488 return TRUE; 479 489 } 480 return TRUE; //no check on serial or SA481 490 } 482 491
Note:
See TracChangeset
for help on using the changeset viewer.