Changeset 1849
- Timestamp:
- 03/18/10 13:11:52 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/0.99.4a/reader-irdeto.c
r1507 r1849 154 154 if (l && (cta_lr!=l)) return ERROR; } 155 155 156 static int irdeto_card_init 2(void)156 static int irdeto_card_init_provider(void) 157 157 { 158 158 int i, p; 159 159 uchar buf[256]={0}; 160 160 161 /* 162 * Provider 163 */ 164 memset(reader[ridx].prid, 0xff, sizeof(reader[ridx].prid)); 165 for (buf[0]=i=p=0; i<reader[ridx].nprov; i++) 166 { 167 sc_GetProvider[3]=i; 168 reader_chk_cmd(sc_GetProvider, 0); 169 // if ((cta_lr==26) && (cta_res[0]!=0xf)) 170 if ((cta_lr==26) && ((!(i&1)) || (cta_res[0]!=0xf))) 171 { 172 reader[ridx].prid[i][4]=p++; 161 /* 162 * Provider 163 */ 164 memset(reader[ridx].prid, 0xff, sizeof(reader[ridx].prid)); 165 for (buf[0]=i=p=0; i<reader[ridx].nprov; i++) 166 { 167 sc_GetProvider[3]=i; 168 reader_chk_cmd(sc_GetProvider, 0); 169 //if ((cta_lr==26) && (cta_res[0]!=0xf)) 170 if ((cta_lr==26) && ((!(i&1)) || (cta_res[0]!=0xf))) 171 { 172 reader[ridx].prid[i][4]=p++; 173 174 // maps the provider id for Betacrypt from FFFFFF to 000000, 175 // fixes problems with cascading CCcam and OSCam 176 if ((reader[ridx].caid[0] >= 0x1700) && (reader[ridx].caid[0] <= 0x1799)) 177 memset(&reader[ridx].prid[i][0], 0, 4); 178 else 173 179 memcpy(&reader[ridx].prid[i][0], cta_res, 4); 174 sprintf((char *) buf+strlen((char *)buf), ",%06lx", b2i(3, &reader[ridx].prid[i][1])); 175 } 176 else 177 reader[ridx].prid[i][0]=0xf; 178 } 179 if (p) 180 cs_ri_log("providers: %d (%s)", p, buf+1); 181 182 /* 183 * ContryCode2 184 */ 185 reader_chk_cmd(sc_GetCountryCode2, 0); 186 if ((cta_lr>9) && !(cta_res[cta_lr-2]|cta_res[cta_lr-1])) 187 { 188 cs_debug("[irdeto-reader] max chids: %d, %d, %d, %d", cta_res[6], cta_res[7], cta_res[8], cta_res[9]); 189 190 /* 191 * Provider 2 192 */ 193 for (i=p=0; i<reader[ridx].nprov; i++) 194 { 195 int j, k, chid, first=1; 196 char t[32]; 197 if (reader[ridx].prid[i][4]!=0xff) 198 { 199 p++; 200 sc_GetChanelIds[3]=i; 201 for (j=0; j<10; j++) 202 { 203 sc_GetChanelIds[5]=j; 204 reader_chk_cmd(sc_GetChanelIds, 0); 205 if (cta_lr<61) break; 206 for(k=0; k<cta_lr; k+=6) 207 { 208 chid=b2i(2, cta_res+k); 209 if (chid && chid!=0xFFFF) 210 { 211 time_t date; 212 chid_date(date=b2i(2, cta_res+k+2), t, 16); 213 chid_date(date+cta_res[k+4], t+16, 16); 214 if (first) 215 { 216 cs_ri_log("provider: %d, id: %06X", p, b2i(3, &reader[ridx].prid[i][1])); 217 first=0; 218 } 219 cs_ri_log("chid: %04X, date: %s - %s", chid, t, t+16); 220 } 221 } 222 } 223 } 224 } 225 } 226 227 // maps the provider id for Betacrypt from FFFFFF to 000000, 228 // fixes problems with cascading CCcam and OSCam 229 230 if ((reader[ridx].caid[0] >= 0x1700) && (reader[ridx].caid[0] <= 0x1799)) 231 { 232 memset(reader[ridx].prid, 0xff, sizeof(reader[ridx].prid)); 233 for (i=0; i<reader[ridx].nprov; i++) 234 { 235 reader[ridx].prid[i][0]=0; 236 reader[ridx].prid[i][1]=0; 237 reader[ridx].prid[i][2]=0; 238 reader[ridx].prid[i][3]=i; 239 reader[ridx].sa[i][0]=0x00; 240 reader[ridx].sa[i][1]=0xFF; 241 reader[ridx].sa[i][2]=0xFF; 242 reader[ridx].sa[i][3]=0xFF; 243 } 244 } 245 cs_log("[irdeto-reader] ready for requests"); 180 181 sprintf((char *) buf+strlen((char *)buf), ",%06lx", b2i(3, &reader[ridx].prid[i][1])); 182 } 183 else 184 reader[ridx].prid[i][0]=0xf; 185 } 186 if (p) 187 cs_ri_log("providers: %d (%s)", p, buf+1); 188 246 189 return OK; 247 190 } … … 249 192 int irdeto_card_init(ATR newatr) 250 193 { 251 252 int i,camkey=0;194 get_atr; 195 int camkey=0; 253 196 uchar buf[256]={0}; 254 197 … … 308 251 } 309 252 310 if ((reader[ridx].caid[0] >= 0x1700) && (reader[ridx].caid[0] <= 0x1799)) // Betacrypt311 {312 memset(reader[ridx].prid, 0xff, sizeof(reader[ridx].prid));313 for (i=0; i<reader[ridx].nprov; i++)314 {315 //values are needed for AU to work for Nagravision/Aladin/Betacrypt316 reader[ridx].prid[i][0]=0;317 reader[ridx].prid[i][1]=0;318 reader[ridx].prid[i][2]=0;319 reader[ridx].prid[i][3]=i;320 //reader[ridx].prid[i][4]=0; //not sure what to do with this one321 322 //since shared address is not filled, we fill it here323 reader[ridx].sa[i][0]=0x00;324 reader[ridx].sa[i][1]=0xFF;325 reader[ridx].sa[i][2]=0xFF;326 reader[ridx].sa[i][3]=0xFF;327 }328 }329 330 253 cs_debug("[irdeto-reader] set camkey for type=%d", camkey); 331 254 … … 347 270 if (reader[ridx].cardmhz != 600) 348 271 cs_log("WARNING: For Irdeto cards you will have to set 'cardmhz = 600' in oscam.server"); 349 return irdeto_card_init2(); 272 273 return irdeto_card_init_provider(); 350 274 } 351 275 … … 415 339 int irdeto_card_info(void) 416 340 { 417 //original irdeto_card_info is not pure info, it is actually needed for init 418 return OK; 419 } 420 341 int i, p; 342 343 /* 344 * ContryCode2 345 */ 346 reader_chk_cmd(sc_GetCountryCode2, 0); 347 348 if ((cta_lr>9) && !(cta_res[cta_lr-2]|cta_res[cta_lr-1])) 349 { 350 cs_debug("[irdeto-reader] max chids: %d, %d, %d, %d", cta_res[6], cta_res[7], cta_res[8], cta_res[9]); 351 352 /* 353 * Provider 2 354 */ 355 for (i=p=0; i<reader[ridx].nprov; i++) 356 { 357 int j, k, chid, first=1; 358 char t[32]; 359 if (reader[ridx].prid[i][4]!=0xff) 360 { 361 p++; 362 sc_GetChanelIds[3]=i; 363 for (j=0; j<10; j++) 364 { 365 sc_GetChanelIds[5]=j; 366 reader_chk_cmd(sc_GetChanelIds, 0); 367 if (cta_lr<61) break; 368 for(k=0; k<cta_lr; k+=6) 369 { 370 chid=b2i(2, cta_res+k); 371 if (chid && chid!=0xFFFF) 372 { 373 time_t date; 374 chid_date(date=b2i(2, cta_res+k+2), t, 16); 375 chid_date(date+cta_res[k+4], t+16, 16); 376 if (first) 377 { 378 cs_ri_log("provider: %d, id: %06X", p, b2i(3, &reader[ridx].prid[i][1])); 379 first=0; 380 } 381 cs_ri_log("chid: %04X, date: %s - %s", chid, t, t+16); 382 } 383 } 384 } 385 } 386 } 387 } 388 cs_ri_log("[irdeto-reader] ready for requests"); 389 return OK; 390 }
Note:
See TracChangeset
for help on using the changeset viewer.