Changeset 707
- Timestamp:
- 12/05/09 19:52:20 (14 years ago)
- Location:
- branches/smartreader
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/smartreader/Distribution/doc/example/oscam.server
r660 r707 59 59 caid = 0300 60 60 61 # remote cccam reader61 # remote CCcam reader 62 62 63 63 [reader] 64 label = remote465 protocol = cccam66 device = 192.168.0.5,1200067 account = login4,password468 group = 469 caid = 030070 version = 2.0.11 71 build = 2892 64 label = remote4 65 protocol = cccam 66 device = 192.168.0.5,45678 67 account = login4,password4 68 group = 4 69 caid = 0400 70 cccversion = 1.2.34 71 cccbuild = 5678 72 72 73 73 # remote radegast reader … … 76 76 label = remote5 77 77 protocol = radegast 78 device = 192.168.0.6,5 000078 device = 192.168.0.6,56789 79 79 group = 5 80 caid = 0 30080 caid = 0500 -
branches/smartreader/csctapi/icc_async.c
r693 r707 168 168 { 169 169 icc->baudrate = baudrate; 170 if (IFD_Towitoko_SetBaudrate (icc->ifd, baudrate) != IFD_TOWITOKO_OK) 171 return ICC_ASYNC_IFD_ERROR; 172 170 173 return ICC_ASYNC_OK; 171 174 } -
branches/smartreader/csctapi/ifd_towitoko.c
r693 r707 262 262 return IFD_TOWITOKO_OK; 263 263 } 264 264 /* 265 265 if (IFD_Towitoko_GetMaxBaudrate (ifd) < baudrate) 266 266 { … … 269 269 #endif 270 270 return IFD_TOWITOKO_PARAM_ERROR; 271 } 271 }*/ 272 272 273 273 #ifdef DEBUG_IFD 274 274 printf ("IFD: Setting baudrate to %lu\n", baudrate); 275 275 #endif 276 277 276 /* Get current settings */ 278 277 if (!IO_Serial_GetProperties (ifd->io)) … … 812 811 } 813 812 } 814 else if (*atr) { //if valid ATR switch to post-ATR baudrate 815 double atrparam_f,atrparam_d; 816 if (ATR_GetParameter(*atr,ATR_PARAMETER_F,&atrparam_f)!=ATR_OK) { 817 cs_log ("Error getting ATR parameter (F)"); 818 ATR_Delete (*atr); 819 (*atr) = NULL; 820 return IFD_TOWITOKO_IO_ERROR; 821 } 822 if (ATR_GetParameter(*atr,ATR_PARAMETER_D,&atrparam_d)!=ATR_OK) { 823 cs_log ("Error getting ATR parameter (D)"); 824 ATR_Delete (*atr); 825 (*atr) = NULL; 826 return IFD_TOWITOKO_IO_ERROR; 827 } 828 829 if (atrparam_f && atrparam_d) { //both should be valid 830 int baudrate = (int)(IFD_TOWITOKO_BAUDRATE * ATR_DEFAULT_F * atrparam_d / atrparam_f); 831 832 if (baudrate != IFD_TOWITOKO_BAUDRATE) { 833 cs_debug("After ATR switching to baudrate %i. F=%.0f, D=%f",baudrate, atrparam_f, atrparam_d); 834 if (IFD_Towitoko_SetBaudrate (ifd, baudrate) != IFD_TOWITOKO_OK) //switch to baud, if error stay on normal baudrate 835 cs_debug("After ATR switching failed"); 836 } 837 } 838 } 813 /* 814 //PLAYGROUND faking ATR for test purposes only 815 // 816 // sky 919 unsigned char atr_test[] = { 0x3F, 0xFF, 0x13, 0x25, 0x03, 0x10, 0x80, 0x33, 0xB0, 0x0E, 0x69, 0xFF, 0x4A, 0x50, 0x70, 0x00, 0x00, 0x49, 0x54, 0x02, 0x00, 0x00 }; 817 // HD+ unsigned char atr_test[] = { 0x3F, 0xFF, 0x95, 0x00, 0xFF, 0x91, 0x81, 0x71, 0xFE, 0x47, 0x00, 0x44, 0x4E, 0x41, 0x53, 0x50, 0x31, 0x34, 0x32, 0x20, 0x52, 0x65, 0x76, 0x47, 0x43, 0x34, 0x63 }; 818 // S02 = irdeto unsigned char atr_test[] = { 0x3B, 0x9F, 0x21, 0x0E, 0x49, 0x52, 0x44, 0x45, 0x54, 0x4F, 0x20, 0x41, 0x43, 0x53, 0x03}; 819 //cryptoworks unsigned char atr_test[] = { 0x3B, 0x78, 0x12, 0x00, 0x00, 0x65, 0xC4, 0x05, 0xFF, 0x8F, 0xF1, 0x90, 0x00 }; 820 unsigned char atr_test[] = { 0x3F, 0xFF, 0x95, 0x00, 0xFF, 0x91, 0x81, 0x71, 0xFE, 0x47, 0x00, 0x44, 0x4E, 0x41, 0x53, 0x50, 0x31, 0x34, 0x32, 0x20, 0x52, 0x65, 0x76, 0x47, 0x43, 0x34, 0x63 }; 821 ATR_Delete(*atr); //throw away actual ATR 822 (*atr) = ATR_New (); 823 ATR_InitFromArray ((*atr), atr_test, sizeof(atr_test)); 824 //END OF PLAYGROUND 825 */ 839 826 840 827 return ret; … … 995 982 { 996 983 //return IFD_TOWITOKO_CLOCK_RATE; 997 cs_debug("CLOCK RATE IS %i in 10kHz steps",ifd->io->mhz); 998 return ifd->io->mhz * 10000L; 984 if (ifd->io->cardmhz == 357 || ifd->io->cardmhz == 358) 985 return (372L * 9600L); 986 else 987 return ifd->io->cardmhz * 10000L; 999 988 } 1000 989 -
branches/smartreader/csctapi/io_serial.c
r698 r707 211 211 #endif 212 212 213 #ifdef OS_MACOSX 213 //#ifdef OS_MACOSX 214 214 // on mac os x, make sure you use the /dev/cu.XXXX device in oscam.server 215 io->fd = open (filename, O_RDWR | O_NOCTTY 216 #else217 if (com==RTYP_SMART) 218 io->fd = open (filename, O_RDWR | O_NOCTTY | O_NONBLOCK); 219 else 220 221 #endif215 io->fd = open (filename, O_RDWR | O_NOCTTY| O_NONBLOCK); 216 //#else 217 // with O_SYNC set OSCam is very critical on opening a device, on certain installs 218 // (eg virtual Ubuntu with /dev/ttyUSB) it gives "Error activating card" 219 // with O_NONBLOCK this problem is solved 220 // io->fd = open (filename, O_RDWR | O_NOCTTY | O_SYNC); 221 //#endif 222 222 223 223 if (io->fd < 0) … … 317 317 { 318 318 struct termios newtio; 319 int mhz;320 319 321 320 #ifdef SCI_DEV … … 328 327 329 328 /* Set the bitrate */ 330 mhz = io->mhz;331 329 332 330 #ifdef OS_LINUX … … 428 426 { 429 427 #ifdef DEBUG_IO 430 printf("IO: SMARTREADER .. switching %s to %2.2fMHz\n", io->filename,(float) mhz/100.0);428 printf("IO: SMARTREADER .. switching %s to %2.2fMHz\n", io->filename,(float)(io->mhz)/100.0); 431 429 #endif 432 430 if(!IO_Serial_Set_Smartreader_Config(io)) 433 431 { 434 432 #ifdef DEBUG_IO 435 printf("IO: SMARTREADER .. ERROR switching %s to %2.2fMHz\n", io->filename,(float) mhz/100.0);433 printf("IO: SMARTREADER .. ERROR switching %s to %2.2fMHz\n", io->filename,(float)(io->mhz)/100.0); 436 434 #endif 437 435 return FALSE; -
branches/smartreader/csctapi/pps.c
r481 r707 89 89 { 90 90 ATR *atr; 91 int ret ;91 int ret = PPS_HANDSAKE_ERROR; 92 92 93 93 /* Perform PPS Exchange if requested */ … … 107 107 } 108 108 109 /* 109 110 ret = PPS_InitICC(pps); 110 111 111 112 if (ret != PPS_OK) 112 113 return ret; 114 */ 113 115 } 116 /* 114 117 else 115 118 { 116 119 return ret; 117 120 } 118 } 119 else /* Get parameters from ATR */ 121 */ 122 } 123 if ((*length) <= 0 || ret != PPS_OK) /* Get parameters from ATR */ 120 124 { 121 125 PPS_SelectFirstProtocol (pps); … … 129 133 #endif 130 134 } 135 136 ret = PPS_InitICC(pps); 137 138 if (ret != PPS_OK) 139 return ret; 131 140 132 141 #ifdef DEBUG_PROTOCOL … … 246 255 static int PPS_InitICC (PPS * pps) 247 256 { 257 #ifdef SCI_DEV 258 //case readertype = internal 259 //code for setting parameters to SCI_DEV (currently in ifd_towitoko.c in ResetAsync_ICC should be placed here 260 //if ok return PPS_OK; 261 //else return PPS_ICC_ERROR; 262 // 263 #endif 248 264 unsigned long baudrate; 249 long double work_etu; 250 251 /* Work etu = (1/D) * (F/fs) * 1000 milliseconds */ 252 work_etu = (1000 * pps->parameters.f) / (pps->parameters.d * ICC_Async_GetClockRate (pps->icc)); 253 254 /* Baudrate = 1000 / etu bps */ 255 baudrate = (long unsigned int) (1000 / work_etu); 256 265 266 baudrate = pps->parameters.d * ICC_Async_GetClockRate (pps->icc) / pps->parameters.f; 267 //FIXME notice that cardmhz is taken into account here 268 //not sure whether that goes ok when cardmhz = 600 269 //if not then IFD_GetClockRate should be devaluated to returning the DEFINED 372L * 9600L (like it usd to be..) 270 257 271 #ifdef DEBUG_PROTOCOL 258 272 printf ("PPS: Baudrate = %d\n", (int)baudrate); 259 273 #endif 260 274 275 276 //FIXME currently for SCI_DEV Setbaudrate is dummied 277 //but it should be something like 278 //case readertype = smart: 279 //case readertype = mouse: 261 280 if (ICC_Async_SetBaudrate (pps->icc, baudrate) != ICC_ASYNC_OK) 262 281 return PPS_ICC_ERROR; -
branches/smartreader/module-cccam.c
r660 r707 803 803 804 804 if (read(handle, data, 20) != 20) { 805 cs_log("cc am: login failed, pwd ack not received");805 cs_log("cccam: login failed, pwd ack not received"); 806 806 return -2; 807 807 } -
branches/smartreader/reader-nagra.c
r693 r707 437 437 } 438 438 case 0x08: 439 case 0x88: if (cta_res[11] == 0x49) decryptDT08(); 439 case 0x88: if (cta_res[11] == 0x49) decryptDT08(); return 1; 440 440 default: 441 441 return 1; … … 454 454 return 0; 455 455 } 456 if( cta_res[2]==0) return 1;456 if((cta_res[2]==0) && (dt != CAMDATA)) return 1; 457 457 if(!ParseDataType(dt&0x0F)) return 0; 458 458 if ((dt == CAMDATA) && (cta_res[11] == 0x49)) return 1; //got dt08 data … … 485 485 reader[ridx].caid[0]=SYSTEM_NAGRA; 486 486 487 if ( memcmp(atr+11, "DNASP", 5)==0)487 if ((memcmp(atr+11, "DNASP", 5)==0 || memcmp(atr+11, "TIGER", 5)==0)) 488 488 { 489 489 //if(SetIFS(0xFE) != 1) return 0; … … 522 522 cs_debug("[nagra-reader] DT01 DONE"); 523 523 CamStateRequest(); 524 if(!GetDataType(IRDINFO,0x39,MAX_REC)) return 0; 525 cs_debug("[nagra-reader] IRDINFO DONE"); 526 CamStateRequest(); 524 527 if(!GetDataType(CAMDATA,0x55,10)) return 0; 525 528 cs_debug("[nagra-reader] CAMDATA Done"); 526 CamStateRequest();527 if(!GetDataType(IRDINFO,0x39,MAX_REC)) return 0;528 cs_debug("[nagra-reader] IRDINFO DONE");529 529 /* 530 530 //DumpDatatypes(); … … 557 557 int nagra2_do_ecm(ECM_REQUEST *er) 558 558 { 559 if RENEW_SESSIONKEY NegotiateSessionKey();560 if SENDDATETIME DateTimeCMD();559 //if RENEW_SESSIONKEY NegotiateSessionKey(); 560 //if SENDDATETIME DateTimeCMD(); 561 561 if(!do_cmd(er->ecm[3],er->ecm[4]+2,0x87,0x02, er->ecm+3+2)) 562 562 { 563 cs_debug("[nagra-reader] nagra2_do_ecm failed"); 564 return (0); 563 cs_debug("[nagra-reader] nagra2_do_ecm failed, retry"); 564 if(!do_cmd(er->ecm[3],er->ecm[4]+2,0x87,0x02, er->ecm+3+2)) 565 { 566 cs_debug("[nagra-reader] nagra2_do_ecm failed"); 567 return (0); 568 } 569 565 570 } 566 571 //cs_sleepms(100);
Note:
See TracChangeset
for help on using the changeset viewer.