Changeset 1399 for trunk/reader-dre.c


Ignore:
Timestamp:
Feb 2, 2010, 2:20:14 PM (10 years ago)
Author:
landlord
Message:

Merge from ump rev. 1545: now with new debug masks, added the prefix '[*-reader]' to all reader modules execpt history logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/reader-dre.c

    r1389 r1399  
    3636
    3737  uchar checksum = ~xor (cmd, cmdlen);
    38   //cs_debug ("Checksum: %02x", checksum);
     38  //cs_debug ("[dre-reader] Checksum: %02x", checksum);
    3939  cmdlen += headerlen;
    4040  command[cmdlen++] = checksum;
     
    4343
    4444  if ((cta_lr != 2) || (cta_res[0] != OK_RESPONSE)) {
    45     cs_log ("DRECRYPT ERROR: unexpected answer from card: %s", cs_hexdump (0, cta_res, cta_lr));
     45    cs_log ("[dre-reader] unexpected answer from card: %s", cs_hexdump (0, cta_res, cta_lr));
    4646    return ERROR;           //error
    4747  }
     
    5151
    5252  if (cta_res[0] != CMD_BYTE) {
    53     cs_log ("DRECRYPT Unknown response: cta_res[0] expected to be %02x, is %02x", CMD_BYTE, cta_res[0]);
     53    cs_log ("[dre-reader] unknown response: cta_res[0] expected to be %02x, is %02x", CMD_BYTE, cta_res[0]);
    5454    return ERROR;
    5555  }
     
    5757    switch (cta_res[3]) {
    5858    case 0xe1:
    59       cs_log ("DRECRYPT checksum error: %s.", cs_hexdump (0, cta_res, cta_lr));
     59      cs_log ("[dre-reader] checksum error: %s.", cs_hexdump (0, cta_res, cta_lr));
    6060      break;
    6161    case 0xe2:
    62       cs_log ("DRECRYPT wrong provider: %s.", cs_hexdump (0, cta_res, cta_lr));
     62      cs_log ("[dre-reader] wrong provider: %s.", cs_hexdump (0, cta_res, cta_lr));
    6363      break;
    6464    case 0xe3:
    65       cs_log ("DRECRYPT illegal command: %s.", cs_hexdump (0, cta_res, cta_lr)); 
     65      cs_log ("[dre-reader] illegal command: %s.", cs_hexdump (0, cta_res, cta_lr)); 
    6666      break;
    6767    case 0xec:
    68       cs_log ("DRECRYPT wrong signature: %s.", cs_hexdump (0, cta_res, cta_lr));
     68      cs_log ("[dre-reader] wrong signature: %s.", cs_hexdump (0, cta_res, cta_lr));
    6969      break;
    7070    default:
    71       cs_debug ("DRECRYPT unknown error: %s.", cs_hexdump (0, cta_res, cta_lr));
     71      cs_debug ("[dre-reader] unknown error: %s.", cs_hexdump (0, cta_res, cta_lr));
    7272      break;
    7373    }
     
    8181
    8282  if (cta_res[length_excl_leader - 1] != checksum) {
    83     cs_log ("DRECRYPT checksum does not match, expected %02x received %02x:%s", checksum,
     83    cs_log ("[dre-reader] checksum does not match, expected %02x received %02x:%s", checksum,
    8484        cta_res[length_excl_leader - 1], cs_hexdump (0, cta_res, cta_lr));
    8585    return ERROR;           //error
     
    103103    uchar pbm[32];
    104104    memcpy (pbm, cta_res + 3, cta_lr - 6);
    105     cs_debug ("DRECRYPT pbm: %s", cs_hexdump (0, pbm, 32));
     105    cs_debug ("[dre-reader] pbm: %s", cs_hexdump (0, pbm, 32));
    106106
    107107    if (pbm[0] == 0xff)
    108       cs_log ("No active packages!");
     108      cs_log ("[dre-reader] no active packages");
    109109    else
    110110      for (i = 0; i < 32; i++)
     
    129129      int endmonth = temp->tm_mon + 1;
    130130      int endday = temp->tm_mday;
    131       cs_log ("Active package %i valid from %04i/%02i/%02i to %04i/%02i/%02i", i, startyear, startmonth, startday,
     131      cs_log ("[dre-reader] active package %i valid from %04i/%02i/%02i to %04i/%02i/%02i", i, startyear, startmonth, startday,
    132132          endyear, endmonth, endday);
    133133    }
     
    151151
    152152  if (checksum != atr[7])
    153     cs_log ("DRECRYPT Warning: expected ATR checksum %02x, smartcard reports %02x", checksum, atr[7]);
     153    cs_log ("[dre-reader] warning: expected ATR checksum %02x, smartcard reports %02x", checksum, atr[7]);
    154154
    155155  switch (atr[6]) {
     
    232232  }
    233233
    234   //cs_ri_log("type: DRECrypt, caid: %04X, serial: %llu, card: v%x",
    235   cs_log ("type: DRECrypt, caid: %04X, serial: %s, dre id: %i%i%i%08i, geocode %i, card: %s v%i.%i",
     234  //cs_ri_log("[dre-reader] type: DRE Crypt, caid: %04X, serial: %llu, card: v%x",
     235  cs_log ("[dre-reader] type: DRE Crypt, caid: %04X, serial: %s, dre id: %i%i%i%08i, geocode %i, card: %s v%i.%i",
    236236      reader[ridx].caid[0], cs_hexdump (0, reader[ridx].hexserial + 2, 4), dre_chksum, provider - 16,
    237237      major_version + 1, low_dre_id, geocode, card, major_version, minor_version);
    238   cs_log ("Provider name:%s.", provname);
     238  cs_log ("[dre-reader] Provider name:%s.", provname);
    239239
    240240
     
    242242  memcpy (reader[ridx].sa[0], reader[ridx].hexserial + 2, 1);   //copy first byte of unique address also in shared address, because we dont know what it is...
    243243
    244   cs_log ("DEBUG: SA = %02X%02X%02X%02X, UA = %s", reader[ridx].sa[0][0], reader[ridx].sa[0][1], reader[ridx].sa[0][2],
     244  cs_log ("[dre-reader] SA = %02X%02X%02X%02X, UA = %s", reader[ridx].sa[0][0], reader[ridx].sa[0][1], reader[ridx].sa[0][2],
    245245      reader[ridx].sa[0][3], cs_hexdump (0, reader[ridx].hexserial + 2, 4));
    246246
     
    250250    return ERROR;           //fatal error
    251251
    252   cs_log ("ready for requests");
     252  cs_log ("[dre-reader] ready for requests");
    253253  return OK;
    254254}
     
    267267    ecmcmd41[20] = er->ecm[6];  //keynumber
    268268    ecmcmd41[21] = 0x58 + er->ecm[25];  //package number
    269     cs_debug ("DEBUG: unused ECM info front:%s", cs_hexdump (0, er->ecm, 8));
    270     cs_debug ("DEBUG: unused ECM info back:%s", cs_hexdump (0, er->ecm + 24, er->ecm[2] + 2 - 24));
     269    cs_debug ("[dre-reader] unused ECM info front:%s", cs_hexdump (0, er->ecm, 8));
     270    cs_debug ("[dre-reader] unused ECM info back:%s", cs_hexdump (0, er->ecm + 24, er->ecm[2] + 2 - 24));
    271271    if ((dre_cmd (ecmcmd41))) { //ecm request
    272272      if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
     
    288288    };
    289289    memcpy (ecmcmd51 + 1, er->ecm + 5, 0x21);
    290     cs_debug ("DEBUG: unused ECM info front:%s", cs_hexdump (0, er->ecm, 5));
    291     cs_debug ("DEBUG: unused ECM info back:%s", cs_hexdump (0, er->ecm + 37, 4));
     290    cs_debug ("[dre-reader] unused ECM info front:%s", cs_hexdump (0, er->ecm, 5));
     291    cs_debug ("[dre-reader] unused ECM info back:%s", cs_hexdump (0, er->ecm + 37, 4));
    292292    ecmcmd51[33] = provider;    //no part of sig
    293293    if ((dre_cmd (ecmcmd51))) { //ecm request
Note: See TracChangeset for help on using the changeset viewer.