Changeset 1784


Ignore:
Timestamp:
Mar 5, 2010, 1:16:52 PM (10 years ago)
Author:
merek
Message:

Code cleanup and fixes in do_emm()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oscam.c

    r1781 r1784  
    21052105void do_emm(EMM_PACKET *ep)
    21062106{
    2107   int au;//, ephs;
    2108   au=client[cs_idx].au;
     2107    int au;
     2108    au = client[cs_idx].au;
     2109
    21092110    cs_ddump_mask(D_ATR, ep->emm, ep->l, "emm:");
    21102111
    2111   if ((au<0) || (au>=CS_MAXREADER))
    2112     return;
     2112    if ((au < 0) || (au >= CS_MAXREADER))
     2113        return;
     2114
    21132115    if (!reader_get_emm_type(ep, &reader[au])) //decodes ep->type and ep->hexserial from the EMM
    21142116        return;
    2115   cs_ddump_mask(D_EMM, ep->hexserial, 8, "emm UA/SA:");
     2117
     2118    cs_ddump_mask(D_EMM, ep->hexserial, 8, "emm UA/SA:");
     2119
    21162120    switch (ep->type) {
    21172121        case UNKNOWN:
    2118         cs_debug_mask(D_EMM, "Emmtype UNKNOWN. Reader %s has serial %s.", reader[au].label, cs_hexdump(0, reader[au].hexserial, 8));
     2122            cs_debug_mask(D_EMM, "emmtype UNKNOWN. Reader %s has serial %s.", reader[au].label, cs_hexdump(0, reader[au].hexserial, 8));
    21192123            if (reader[au].blockemm_unknown) return;
     2124            break;
     2125
    21202126        case UNIQUE:
    2121         cs_debug_mask(D_EMM, "Emmtype UNIQUE. Reader %s has serial %s.", reader[au].label, cs_hexdump(0, reader[au].hexserial, 8));
     2127            cs_debug_mask(D_EMM, "emmtype UNIQUE. Reader %s has serial %s.", reader[au].label, cs_hexdump(0, reader[au].hexserial, 8));
    21222128            if (reader[au].blockemm_u) return;
     2129            break;
     2130
    21232131        case SHARED:
    2124         cs_debug_mask(D_EMM, "Emmtype SHARED. Reader %s has serial %s.", reader[au].label, cs_hexdump(0, reader[au].hexserial, 8));
     2132            cs_debug_mask(D_EMM, "emmtype SHARED. Reader %s has serial %s.", reader[au].label, cs_hexdump(0, reader[au].hexserial, 8));
    21252133            if (reader[au].blockemm_s) return;
    2126 //FIXME only camd33 delivers hexserial from the net, newcamd, camd35 copy cardreader hexserial in; reader_get_emm_type overwrites this with real SA value if known!
     2134            break;
     2135
     2136        // FIXME only camd33 delivers hexserial from the net, newcamd, camd35 copy
     2137        // cardreader hexserial in; reader_get_emm_type overwrites this with real SA value if known!
    21272138        case GLOBAL:
    2128         cs_debug_mask(D_EMM, "Emmtype GLOBAL. Reader %s has serial %s.", reader[au].label, cs_hexdump(0, reader[au].hexserial, 8));
     2139            cs_debug_mask(D_EMM, "emmtype GLOBAL. Reader %s has serial %s.", reader[au].label, cs_hexdump(0, reader[au].hexserial, 8));
    21292140            if (reader[au].blockemm_g) return;
     2141            break;
    21302142    }
    2131   client[cs_idx].lastemm=time((time_t)0);
    2132   cs_ddump_mask(D_EMM, ep->emm, ep->l, "emm:");
    2133 //  if ((!reader[au].fd) || (reader[au].b_nano[ep->emm[3]])) // blocknano is obsolete
    2134   if ((!reader[au].fd) ||       // reader has no fd
    2135       (reader[au].caid[0]!=b2i(2,ep->caid))) {   // wrong caid
     2143
     2144    client[cs_idx].lastemm = time((time_t)0);
     2145    cs_ddump_mask(D_EMM, ep->emm, ep->l, "emm:");
     2146
     2147    if ((!reader[au].fd) ||       // reader has no fd
     2148    (reader[au].caid[0] != b2i(2,ep->caid))) {   // wrong caid
    21362149#ifdef WEBIF
    21372150      client[cs_idx].emmnok++;
    21382151#endif
    21392152      return;
    2140   }
     2153    }
    21412154#ifdef WEBIF
    2142   client[cs_idx].emmok++;
    2143 #endif
    2144   ep->cidx=cs_idx;
    2145   cs_debug_mask(D_EMM, "EMM is being sent to reader %s.", reader[au].label);
    2146   write_to_pipe(reader[au].fd, PIP_ID_EMM, (uchar *) ep, sizeof(EMM_PACKET));
     2155    client[cs_idx].emmok++;
     2156#endif
     2157    ep->cidx = cs_idx;
     2158    cs_debug_mask(D_EMM, "emm is being sent to reader %s.", reader[au].label);
     2159    write_to_pipe(reader[au].fd, PIP_ID_EMM, (uchar *) ep, sizeof(EMM_PACKET));
    21472160}
    21482161
Note: See TracChangeset for help on using the changeset viewer.