Changeset 4994 for trunk/reader-videoguard12.c
- Timestamp:
- 04/13/11 23:19:59 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/reader-videoguard12.c
r4845 r4994 10 10 #endif 11 11 12 static int vg12_do_cmd(struct s_reader *reader, const unsigned char *ins, const unsigned char *txbuff, unsigned char *rxbuff, unsigned char *cta_res)13 { 14 u short cta_lr;12 static int32_t vg12_do_cmd(struct s_reader *reader, const unsigned char *ins, const unsigned char *txbuff, unsigned char *rxbuff, unsigned char *cta_res) 13 { 14 uint16_t cta_lr; 15 15 unsigned char ins2[5]; 16 16 memcpy(ins2, ins, 5); … … 46 46 47 47 static const unsigned char ins2A[5] = { 0x48, 0x2A, 0x00, 0x00, 0x90 }; 48 int l;48 int32_t l; 49 49 50 50 if (!write_cmd_vg(ins2A,NULL) || !status_ok(cta_res+cta_lr-2)) { … … 64 64 ins76[3] = 0; 65 65 ins76[4] = 0x0a; 66 int num = cta_res[1];67 int i;66 int32_t num = cta_res[1]; 67 int32_t i; 68 68 69 69 for (i = 0; i < num; i++) { … … 76 76 break; 77 77 } 78 int y, m, d, H, M, S;78 int32_t y, m, d, H, M, S; 79 79 rev_date_calc(&cta_res[4], &y, &m, &d, &H, &M, &S, reader->card_baseyear); 80 u nsigned short tier_id = (cta_res[2] << 8) | cta_res[3];80 uint16_t tier_id = (cta_res[2] << 8) | cta_res[3]; 81 81 char *tier_name = get_tiername(tier_id, reader->caid); 82 82 cs_ri_log(reader, "tier: %04x, expiry date: %04d/%02d/%02d-%02d:%02d:%02d %s", tier_id, y, m, d, H, M, S, tier_name); … … 84 84 } 85 85 86 static int videoguard12_card_init(struct s_reader *reader, ATR newatr)86 static int32_t videoguard12_card_init(struct s_reader *reader, ATR newatr) 87 87 { 88 88 … … 131 131 132 132 unsigned char boxID[4]; 133 int boxidOK = 0;133 int32_t boxidOK = 0; 134 134 135 135 /* … … 158 158 } else { 159 159 // skipping the initial fixed fields: encr/rev++ (4) 160 int i = 4;161 int gotUA = 0;160 int32_t i = 4; 161 int32_t gotUA = 0; 162 162 while (i < (cta_lr-2)) { 163 163 if (!gotUA && cta_res[i] < 0xF0) { // then we guess that the next 4 bytes is the UA … … 239 239 /* the boxid is specified in the config */ 240 240 if (reader->boxid > 0) { 241 int i;241 int32_t i; 242 242 for (i = 0; i < 4; i++) { 243 243 boxID[i] = (reader->boxid >> (8 * (3 - i))) % 0x100; … … 314 314 } 315 315 316 static int videoguard12_do_ecm(struct s_reader *reader, ECM_REQUEST * er)316 static int32_t videoguard12_do_ecm(struct s_reader *reader, ECM_REQUEST * er) 317 317 { 318 318 unsigned char cta_res[CTA_RES_LEN]; 319 319 unsigned char ins40[5] = { 0x49, 0x40, 0x40, 0x80, 0xFF }; 320 320 static const unsigned char ins54[5] = { 0x4B, 0x54, 0x00, 0x00, 0x17 }; 321 int posECMpart2 = er->ecm[6] + 7;322 int lenECMpart2 = er->ecm[posECMpart2];321 int32_t posECMpart2 = er->ecm[6] + 7; 322 int32_t lenECMpart2 = er->ecm[posECMpart2]; 323 323 unsigned char tbuff[264]; 324 324 unsigned char rbuff[264]; 325 325 memcpy(&tbuff[0], &(er->ecm[posECMpart2 + 1]), lenECMpart2 - 1); 326 326 ins40[4] = lenECMpart2; 327 int l;327 int32_t l; 328 328 l = vg12_do_cmd(reader, ins40, tbuff, NULL, cta_res); 329 329 if (l > 0 && status_ok(cta_res)) { … … 350 350 } 351 351 352 static int videoguard12_do_emm(struct s_reader *reader, EMM_PACKET * ep)352 static int32_t videoguard12_do_emm(struct s_reader *reader, EMM_PACKET * ep) 353 353 { 354 354 return videoguard_do_emm(reader, ep, 0x49, read_tiers, vg12_do_cmd); 355 355 } 356 356 357 static int videoguard12_card_info(struct s_reader *reader)357 static int32_t videoguard12_card_info(struct s_reader *reader) 358 358 { 359 359 /* info is displayed in init, or when processing info */
Note:
See TracChangeset
for help on using the changeset viewer.