Changeset 615
- Timestamp:
- 12/02/09 10:42:50 (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/cardterminal.c
r567 r615 71 71 } 72 72 73 char CardTerminal_Init (CardTerminal * ct, unsigned short pn, int reader_type, int mhz )73 char CardTerminal_Init (CardTerminal * ct, unsigned short pn, int reader_type, int mhz, int cardmhz) 74 74 { 75 75 char ret; … … 78 78 79 79 /* Create a new IO_Serial */ 80 ct->io = IO_Serial_New (reader_type, mhz );80 ct->io = IO_Serial_New (reader_type, mhz, cardmhz); 81 81 82 82 /* Memory error */ -
trunk/csctapi/cardterminal.h
r566 r615 68 68 /* Intialice a CardTerminal in a given port */ 69 69 extern char 70 CardTerminal_Init (CardTerminal * ct, unsigned short pn, int reader_type, int mhz );70 CardTerminal_Init (CardTerminal * ct, unsigned short pn, int reader_type, int mhz, int cardmhz); 71 71 72 72 /* Send a CT-BCS command to a CardTerminal */ -
trunk/csctapi/ctapi.c
r566 r615 50 50 */ 51 51 52 char CT_init (unsigned short ctn, unsigned short pn, int reader_type, int mhz )52 char CT_init (unsigned short ctn, unsigned short pn, int reader_type, int mhz, int cardmhz) 53 53 { 54 54 CardTerminal *ct; … … 69 69 { 70 70 /* Initialize CardTerminal */ 71 ret = CardTerminal_Init (ct, pn, reader_type, mhz );71 ret = CardTerminal_Init (ct, pn, reader_type, mhz, cardmhz); 72 72 73 73 /* Add CardTerminal to list */ -
trunk/csctapi/ctapi.h
r566 r615 23 23 unsigned short pn, /* Port Number */ 24 24 int reader_type, /* reader type (mouse, smartreader) */ 25 int mhz 25 int mhz, 26 int cardmhz 26 27 ); 27 28 -
trunk/csctapi/io_serial.c
r573 r615 158 158 */ 159 159 160 IO_Serial * IO_Serial_New (int reader_type, int mhz )160 IO_Serial * IO_Serial_New (int reader_type, int mhz, int cardmhz) 161 161 { 162 162 IO_Serial *io; … … 169 169 io->reader_type=reader_type; 170 170 io->mhz=mhz; 171 io->cardmhz=cardmhz; 171 172 172 173 return io; … … 509 510 // printf("IO: Setting properties: com%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->com, io->input_bitrate, io->bits, io->parity == IO_SERIAL_PARITY_EVEN ? "Even" : io->parity == IO_SERIAL_PARITY_ODD ? "Odd" : "None", io->stopbits, io->dtr, io->rts); 510 511 memset (&newtio, 0, sizeof (newtio)); 512 513 511 514 /* Set the bitrate */ 512 513 514 int mhz = io->mhz;515 extern int reader_irdeto_mode;516 517 515 if(io->reader_type==RTYP_SMART) 518 516 { 519 517 #ifdef DEBUG_IO 520 printf("IO: SMARTREADER .. switching to frequency to %2.2fMHz\n", (float) mhz/100.0);521 #endif 522 if(!IO_Serial_Set_Smartreader_Freq(io ,mhz,reader_irdeto_mode))518 printf("IO: SMARTREADER .. switching to frequency to %2.2fMHz\n", (float)io->mhz/100.0); 519 #endif 520 if(!IO_Serial_Set_Smartreader_Freq(io)) 523 521 { 524 522 #ifdef DEBUG_IO … … 529 527 } 530 528 531 532 529 #ifdef OS_LINUX 533 int standard_card_clock; //contains non-overclocked, standard clockrate of the card in 10kHz steps 534 if (reader_irdeto_mode) 535 standard_card_clock = 600; 536 else 537 standard_card_clock = 357; 538 if (mhz == standard_card_clock) 530 if (io->mhz == io->cardmhz) 539 531 #endif 540 532 { //no overclocking … … 547 539 struct serial_struct nuts; 548 540 ioctl(io->fd, TIOCGSERIAL, &nuts); 549 int custom_baud = 9600 * mhz / standard_card_clock;541 int custom_baud = 9600 * io->mhz / io->cardmhz; 550 542 nuts.custom_divisor = (nuts.baud_base + (custom_baud/2))/ custom_baud; 551 543 cs_debug("customspeed: standardclock=%d mhz=%d custom_baud=%d baud_base=%d divisor=%d -> effective baudrate %d", 552 standard_card_clock,mhz, custom_baud, nuts.baud_base, nuts.custom_divisor, nuts.baud_base/nuts.custom_divisor);544 io->cardmhz, io->mhz, custom_baud, nuts.baud_base, nuts.custom_divisor, nuts.baud_base/nuts.custom_divisor); 553 545 nuts.flags &= ~ASYNC_SPD_MASK; 554 546 nuts.flags |= ASYNC_SPD_CUST; … … 1067 1059 1068 1060 1069 bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io , int freq, int irdeto_mode)1061 bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io) 1070 1062 { 1071 1063 struct termios term; 1072 1064 struct termios orig; 1065 int freq = io->mhz; 1073 1066 unsigned char fi_di[4]={0x01, 0x01, 0x74, 0x01}; 1074 1067 unsigned char fr[3]={0x02, 0x00, 0x00}; … … 1094 1087 1095 1088 // Irdeto card supposedly need NN set to 1 .. to be confirmed 1096 if(i rdeto_mode)1089 if(io->cardmhz == 600) 1097 1090 nn[1]=0x01; 1098 1091 -
trunk/csctapi/io_serial.h
r567 r615 72 72 int reader_type; 73 73 int mhz; /* mhz specified in config = actual reader clock speed */ 74 int cardmhz; /* mhz specified in config = standard (non overclocked) clock speed of card*/ 74 75 } 75 76 IO_Serial; … … 82 83 //extern void IO_Serial_Reopen (IO_Serial * io); 83 84 extern void IO_Serial_Flush (IO_Serial * io); 84 extern IO_Serial *IO_Serial_New (int reader_type, int mhz );85 extern IO_Serial *IO_Serial_New (int reader_type, int mhz, int cardmhz); 85 86 extern void IO_Serial_Delete (IO_Serial * io); 86 87 … … 108 109 109 110 /* smartreader Frequency set */ 110 extern bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io , int freq, int irdeto_mode);111 extern bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io); 111 112 112 113 #endif /* IO_SERIAL */ -
trunk/globals.h
r597 r615 351 351 int detect; 352 352 int mhz; //actual clock rate of reader in 10khz steps 353 int cardmhz; //standard clock speed your card should have in 10khz steps; normally 357 but for Irdeto cards 600 353 354 int custom_speed; //request immediate baudrate adaption after ATR; no PTS/PPS will be executed 354 355 int r_port; -
trunk/oscam-config.c
r597 r615 1096 1096 return; 1097 1097 } 1098 if (!strcmp(token, "cardmhz")) { rdr->cardmhz=atoi(value); return; } 1098 1099 if (!strcmp(token, "customspeed")) { rdr->custom_speed=atoi(value); return; } 1099 1100 if (!strcmp(token, "protocol")) … … 1207 1208 reader[nr].maxqlen = CS_MAXQLEN; 1208 1209 reader[nr].mhz = 357; 1210 reader[nr].cardmhz = 357; 1209 1211 reader[nr].custom_speed = 1; 1210 1212 strcpy(reader[nr].pincode, "none"); -
trunk/oscam.c
r578 r615 543 543 { 544 544 if (reader[ridx].typ==R_MOUSE || reader[ridx].typ==R_SMART) 545 cs_log("reader started (pid=%d, device=%s, detect=%s%s, mhz=%d )",545 cs_log("reader started (pid=%d, device=%s, detect=%s%s, mhz=%d, cardmhz=%d)", 546 546 pid, reader[ridx].device, 547 547 reader[ridx].detect&0x80 ? "!" : "", 548 548 RDR_CD_TXT[reader[ridx].detect&0x7f], 549 reader[ridx].mhz); 549 reader[ridx].mhz, 550 reader[ridx].cardmhz); 550 551 else 551 552 cs_log("reader started (pid=%d, device=%s)", -
trunk/reader-common.c
r597 r615 4 4 char oscam_device[128]; 5 5 int oscam_card_detect; 6 int reader_irdeto_mode;7 6 8 7 uchar cta_cmd[272], cta_res[260], atr[64]; … … 180 179 #endif 181 180 cs_ri_log("ATR: %s", cs_hexdump(1, atr, atr_size)); 182 if (!memcmp(atr+4, "IRDETO", 6))183 reader_irdeto_mode = 1;184 else185 reader_irdeto_mode = 0;186 181 sleep(1); 187 182 return(1); … … 299 294 cs_ptyp=D_DEVICE; 300 295 snprintf(oscam_device, sizeof(oscam_device), "%s", device); 301 if ((rc=CT_init(1, reader_device_type(device, typ),reader[ridx].typ,reader[ridx].mhz ))!=OK)296 if ((rc=CT_init(1, reader_device_type(device, typ),reader[ridx].typ,reader[ridx].mhz,reader[ridx].cardmhz))!=OK) 302 297 cs_log("Cannot open device: %s", device); 303 298 cs_debug("ct_init on %s: %d", device, rc);
Note:
See TracChangeset
for help on using the changeset viewer.