Changeset 959


Ignore:
Timestamp:
12/26/09 22:54:46 (11 years ago)
Author:
alno
Message:

Sync with trunk up to trunk 956

Location:
branches/monitor-improvement
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/monitor-improvement/CMakeLists.txt

    r811 r959  
    229229)
    230230
     231#if the svnversion program is absent, this will leave the SVN_REVISION string empty,
     232#but won't stop CMake.
     233execute_process (COMMAND "svnversion" "-n" "${CMAKE_CURRENT_SOURCE_DIR}" OUTPUT_VARIABLE OSCAM_SVN_REVISION)
     234
     235if (OSCAM_SVN_REVISION)
     236    string (REGEX REPLACE "[0-9]+:" "" OSCAM_SVN_REVISION "${OSCAM_SVN_REVISION}")
     237    string (REPLACE "M" "" OSCAM_SVN_REVISION "${OSCAM_SVN_REVISION}")
     238    string (REPLACE "exported" "0" OSCAM_SVN_REVISION "${OSCAM_SVN_REVISION}")
     239else (OSCAM_SVN_REVISION)
     240    set (OSCAM_SVN_REVISION "0")
     241endif (OSCAM_SVN_REVISION)
     242
    231243# pass the version to the compilations as a define
    232 add_definitions ("-D'CS_SVN_VERSION=\"$(shell svnversion -n ${CMAKE_CURRENT_SOURCE_DIR} | sed 's/[MS]$$//')\"'")
     244add_definitions ("-D'CS_SVN_VERSION=\"${OSCAM_SVN_REVISION}\"'")
    233245
    234246#----------------------- global compile and link options ------------------------------
  • branches/monitor-improvement/Makefile

    r776 r959  
    11SHELL   = /bin/sh
    22
    3 VER = $(subst ",,$(filter-out \#define CS_VERSION,$(shell grep CS_VERSION globals.h)))$(shell svnversion -n . | sed 's/[MS]$$//' )
     3VER = $(subst ",,$(filter-out \#define CS_VERSION,$(shell grep CS_VERSION globals.h)))$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )
    44CS_CONFDIR = '\"/usr/local/etc\"'
    55
     
    6464        OS_CULI="-lncurses" \
    6565        OS_PTLI="-lpthread" \
    66         DS_OPTS="-O2 -DOS_LINUX -DCS_CONFDIR=${CS_CONFDIR} -Winline -Wall -Wno-implicit-function-declaration -Wno-parentheses  -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     66        DS_OPTS="-O2 -DOS_LINUX -DCS_CONFDIR=${CS_CONFDIR} -Winline -Wall -Wno-implicit-function-declaration -Wno-parentheses  -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    6767        DS_CFLAGS="-c" \
    6868        DS_LDFLAGS="" \
     
    8585        OS_CULI="-lncurses" \
    8686        OS_PTLI="-lpthread -lpcsclite" \
    87         DS_OPTS="-O2 -DOS_LINUX -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -I/usr/include/PCSC -Winline -Wall -Wno-implicit-function-declaration -Wno-parentheses  -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     87        DS_OPTS="-O2 -DOS_LINUX -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -I/usr/include/PCSC -Winline -Wall -Wno-implicit-function-declaration -Wno-parentheses  -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    8888        DS_CFLAGS="-c" \
    8989        DS_LDFLAGS="" \
     
    106106        OS_CULI="-lncurses" \
    107107        OS_PTLI="-lpthread" \
    108         DS_OPTS="-O2 -DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -Winline -Wall -Wno-implicit-function-declaration -Wno-parentheses  -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     108        DS_OPTS="-O2 -DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -Winline -Wall -Wno-implicit-function-declaration -Wno-parentheses  -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    109109        DS_CFLAGS="-c" \
    110110        DS_LDFLAGS="-framework PCSC" \
     
    128128        OS_CULI="-lncurses" \
    129129        OS_PTLI="-lpthread" \
    130         DS_OPTS="-O2 -DOS_FREEBSD -DBSD_COMP  -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     130        DS_OPTS="-O2 -DOS_FREEBSD -DBSD_COMP  -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    131131        DS_CFLAGS="-c" \
    132132        DS_LDFLAGS="" \
     
    149149        OS_CULI="-lncurses" \
    150150        OS_PTLI="-lpthread" \
    151         DS_OPTS="-O2 -DOS_FREEBSD -DBSD_COMP -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     151        DS_OPTS="-O2 -DOS_FREEBSD -DBSD_COMP -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    152152        DS_CFLAGS="-c" \
    153153        DS_LDFLAGS="" \
     
    170170        OS_CULI="-lncurses" \
    171171        OS_PTLI="-lpthread" \
    172         DS_OPTS="-O2 -DOS_LINUX -DTUXBOX -DPPC -DCS_CONFDIR='\"/var/tuxbox/config\"' -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     172        DS_OPTS="-O2 -DOS_LINUX -DTUXBOX -DPPC -DCS_CONFDIR='\"/var/tuxbox/config\"' -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    173173        DS_CFLAGS="-c" \
    174174        DS_LDFLAGS="" \
     
    186186        OS_CULI="-lncurses" \
    187187        OS_PTLI="-lpthread" \
    188         DS_OPTS="-O2 -DOS_LINUX -DTUXBOX -DPPC -DCS_CONFDIR='\"/var/tuxbox/config\"' -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     188        DS_OPTS="-O2 -DOS_LINUX -DTUXBOX -DPPC -DCS_CONFDIR='\"/var/tuxbox/config\"' -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    189189        DS_CFLAGS="-c" \
    190190        DS_LDFLAGS="" \
     
    208208        OS_CULI="-lncurses" \
    209209        OS_PTLI="-lpthread" \
    210         DS_OPTS="-O2 -DOS_LINUX -DSH4 -DTUXBOX -DCS_CONFDIR='\"/var/tuxbox/config\"' -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     210        DS_OPTS="-O2 -DOS_LINUX -DSH4 -DTUXBOX -DCS_CONFDIR='\"/var/tuxbox/config\"' -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    211211        DS_CFLAGS="-c" \
    212212        DS_LDFLAGS="" \
     
    229229        OS_CULI="-lncurses" \
    230230        OS_PTLI="-lpthread" \
    231         DS_OPTS="-O2 -DOS_CYGWIN32 -DCS_CONFDIR=${CS_CONFDIR} -static -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     231        DS_OPTS="-O2 -DOS_CYGWIN32 -DCS_CONFDIR=${CS_CONFDIR} -static -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    232232        DS_CFLAGS="-c" \
    233233        DS_LDFLAGS="" \
     
    250250        OS_CULI="-lncurses" \
    251251        OS_PTLI="-lpthread" \
    252         DS_OPTS="-O2 -DOS_CYGWIN32 -DCS_CONFDIR=${CS_CONFDIR} -I /tmp/include -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     252        DS_OPTS="-O2 -DOS_CYGWIN32 -DCS_CONFDIR=${CS_CONFDIR} -I /tmp/include -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    253253        DS_CFLAGS="-c" \
    254254        DS_LDFLAGS="" \
     
    271271        OS_CULI="-lncurses" \
    272272        OS_PTLI="-lpthread" \
    273         DS_OPTS="-O2 -DOS_SOLARIS -DOS_SOLARIS7 -DBSD_COMP -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     273        DS_OPTS="-O2 -DOS_SOLARIS -DOS_SOLARIS7 -DBSD_COMP -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    274274        DS_CFLAGS="-c" \
    275275        DS_LDFLAGS="-lsocket" \
     
    292292        OS_CULI="-lncurses" \
    293293        OS_PTLI="-lpthread" \
    294         DS_OPTS="-O2 -DOS_SOLARIS -DOS_SOLARIS7 -DBSD_COMP -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     294        DS_OPTS="-O2 -DOS_SOLARIS -DOS_SOLARIS7 -DBSD_COMP -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    295295        DS_CFLAGS="-c" \
    296296        DS_LDFLAGS="-lsocket" \
     
    313313        OS_CULI="-lncurses" \
    314314        OS_PTLI="-lpthreads" \
    315         DS_OPTS="-O2 -DOS_AIX -DOS_AIX42 -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     315        DS_OPTS="-O2 -DOS_AIX -DOS_AIX42 -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    316316        DS_CFLAGS="-c" \
    317317        DS_LDFLAGS="" \
     
    334334        OS_CULI="-lncurses" \
    335335        OS_PTLI="-lpthread" \
    336         DS_OPTS="-O2 -DOS_IRIX -DOS_IRIX65 -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     336        DS_OPTS="-O2 -DOS_IRIX -DOS_IRIX65 -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    337337        DS_CFLAGS="-c" \
    338338        DS_LDFLAGS="" \
     
    357357        OS_CULI="-lncurses" \
    358358        OS_PTLI="-lpthread" \
    359         DS_OPTS="-O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     359        DS_OPTS="-O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    360360        DS_CFLAGS="-c" \
    361361        DS_LDFLAGS="" \
     
    379379        OS_CULI="-lncurses" \
    380380        OS_PTLI="-lpthread" \
    381         DS_OPTS="-O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     381        DS_OPTS="-O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    382382        DS_CFLAGS="-c" \
    383383        DS_LDFLAGS="" \
     
    401401        OS_CULI="-lncurses" \
    402402        OS_PTLI="-lpthread" \
    403         DS_OPTS="-O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     403        DS_OPTS="-O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    404404        DS_CFLAGS="-c" \
    405405        DS_LDFLAGS="" \
     
    423423        OS_CULI="-lncurses" \
    424424        OS_PTLI="-lpthread" \
    425         DS_OPTS="-O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     425        DS_OPTS="-O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    426426        DS_CFLAGS="-c" \
    427427        DS_LDFLAGS="-static" \
     
    444444        OS_CULI="-lncurses" \
    445445        OS_PTLI="-lpthread" \
    446         DS_OPTS="-Iopenssl-include -O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     446        DS_OPTS="-Iopenssl-include -O2 -DOS_LINUX -DMIPSEL -DUCLIBC -DCS_CONFDIR=${CS_CONFDIR} -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    447447        DS_CFLAGS="-c" \
    448448        DS_LDFLAGS="" \
     
    465465        OS_CULI="-lncurses" \
    466466        OS_PTLI="-lpthread" \
    467         DS_OPTS="-O2 -DOS_LINUX -DTUXBOX -DMIPSEL -DCS_CONFDIR='\"/var/tuxbox/config\"' -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     467        DS_OPTS="-O2 -DOS_LINUX -DTUXBOX -DMIPSEL -DCS_CONFDIR='\"/var/tuxbox/config\"' -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    468468        DS_CFLAGS="-c" \
    469469        DS_LDFLAGS="" \
     
    481481        OS_CULI="-lncurses" \
    482482        OS_PTLI="-lpthread" \
    483         DS_OPTS="-O2 -DOS_LINUX -DTUXBOX -DMIPSEL -DCS_CONFDIR='\"/var/tuxbox/config\"' -static-libgcc -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     483        DS_OPTS="-O2 -DOS_LINUX -DTUXBOX -DMIPSEL -DCS_CONFDIR='\"/var/tuxbox/config\"' -static-libgcc -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    484484        DS_CFLAGS="-c" \
    485485        DS_LDFLAGS="" \
     
    502502        OS_CULI="-lncurses" \
    503503        OS_PTLI="-lpthread" \
    504         DS_OPTS="-O2 -DOS_HPUX -DOS_HPUX10 -D_XOPEN_SOURCE_EXTENDED -DCS_CONFDIR=${CS_CONFDIR} -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     504        DS_OPTS="-O2 -DOS_HPUX -DOS_HPUX10 -D_XOPEN_SOURCE_EXTENDED -DCS_CONFDIR=${CS_CONFDIR} -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    505505        DS_CFLAGS="-c" \
    506506        DS_LDFLAGS="" \
     
    523523        OS_CULI="-lncurses" \
    524524        OS_PTLI="-lpthread" \
    525         DS_OPTS="-O2 -DOS_OSF -DOS_OSF5 -DCS_CONFDIR=${CS_CONFDIR} -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     525        DS_OPTS="-O2 -DOS_OSF -DOS_OSF5 -DCS_CONFDIR=${CS_CONFDIR} -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    526526        XDS_CFLAGS="-I/usr/include -c" \
    527527        DS_CFLAGS="-c" \
     
    545545        OS_CULI="-lncurses" \
    546546        OS_PTLI="-lpthread" \
    547         DS_OPTS="-DOS_LINUX -O2 -DARM -DALIGNMENT -DCS_CONFDIR=${CS_CONFDIR} -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     547        DS_OPTS="-DOS_LINUX -O2 -DARM -DALIGNMENT -DCS_CONFDIR=${CS_CONFDIR} -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    548548        DS_CFLAGS="-c" \
    549549        DS_LDFLAGS="" \
     
    567567        OS_CULI="-lncurses" \
    568568        OS_PTLI="-lpthread" \
    569         DS_OPTS="-DOS_LINUX -O2 -DARM -DALIGNMENT -DCS_CONFDIR=${CS_CONFDIR} -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     569        DS_OPTS="-DOS_LINUX -O2 -DARM -DALIGNMENT -DCS_CONFDIR=${CS_CONFDIR} -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    570570        DS_CFLAGS="-c" \
    571571        DS_LDFLAGS="" \
     
    589589        OS_CULI="-lncurses" \
    590590        OS_PTLI="-lpthread" \
    591         DS_OPTS="-DOS_LINUX -O2 -DARM -DALIGNMENT -DCS_CONFDIR=${CS_CONFDIR}  -D'CS_SVN_VERSION="'"$(shell svnversion -n . | sed 's/[MS]$$//' )"'"'" \
     591        DS_OPTS="-DOS_LINUX -O2 -DARM -DALIGNMENT -DCS_CONFDIR=${CS_CONFDIR}  -D'CS_SVN_VERSION="'"$(shell test -f /usr/bin/svnversion && svnversion -n . | sed 's/[MS]$$//' | sed 's/exported/0/' || echo -n 0 )"'"'" \
    592592        DS_CFLAGS="-c" \
    593593        DS_LDFLAGS="" \
  • branches/monitor-improvement/cscrypt/bn_mul.c

    r8 r959  
    225225         int n, BN_ULONG *t)
    226226    {
    227     int i,j,n2=n*2;
    228     unsigned int c1,c2,neg,zero;
     227    int c1,c2,i,j,n2=n*2;
     228    unsigned int neg,zero;
    229229    BN_ULONG ln,lo,*p;
    230230
     
    679679        if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA))
    680680            {
    681             bn_wexpand(b,al);
     681            if (bn_wexpand(b,al) == NULL) goto err;
    682682            b->d[bl]=0;
    683683            bl++;
     
    686686        else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA))
    687687            {
    688             bn_wexpand(a,bl);
     688            if (bn_wexpand(a,bl) == NULL) goto err;
    689689            a->d[al]=0;
    690690            al++;
     
    701701            if (al == j) /* exact multiple */
    702702                {
    703                 bn_wexpand(t,k*2);
    704                 bn_wexpand(rr,k*2);
     703                if (bn_wexpand(t,k*2) == NULL) goto err;
     704                if (bn_wexpand(rr,k*2) == NULL) goto err;
    705705                bn_mul_recursive(rr->d,a->d,b->d,al,t->d);
    706706                }
    707707            else
    708708                {
    709                 bn_wexpand(a,k);
    710                 bn_wexpand(b,k);
    711                 bn_wexpand(t,k*4);
    712                 bn_wexpand(rr,k*4);
     709                if (bn_wexpand(a,k) == NULL) goto err;
     710                if (bn_wexpand(b,k) == NULL) goto err;
     711                if (bn_wexpand(t,k*4) == NULL) goto err;
     712                if (bn_wexpand(rr,k*4) == NULL) goto err;
    713713                for (i=a->top; i<k; i++)
    714714                    a->d[i]=0;
  • branches/monitor-improvement/cscrypt/des.c

    r64 r959  
     1#include <stdlib.h>
    12#include <stdio.h>
    23#include <string.h>
  • branches/monitor-improvement/csctapi/atr.c

    r925 r959  
    2525#include "defines.h"
    2626#include "atr.h"
     27#include "../globals.h"
    2728#include <stdlib.h>
    2829#include <string.h>
  • branches/monitor-improvement/csctapi/pps.c

    r925 r959  
    5858
    5959static int PPS_InitProtocol (PPS * pps, int protocol_selected);
    60 
    61 //static void PPS_SelectFirstProtocol (PPS * pps);
    6260
    6361static BYTE PPS_GetPCK (BYTE * block, unsigned length);
     
    183181            if (OffersT[i])
    184182                numprottype ++;
     183        cs_debug("%i protocol types detected. Historical bytes: %s",numprottype, cs_hexdump(1,atr->hb,atr->hbn));
    185184
    186185//If more than one protocol type and/or TA1 parameter values other than the default values and/or N equeal to 255 is/are indicated in the answer to reset, the card shall know unambiguously, after having sent the answer to reset, which protocol type or/and transmission parameter values (FI, D, N) will be used. Consequently a selection of the protocol type and/or the transmission parameters values shall be specified.
    187186        ATR_GetParameter (atr, ATR_PARAMETER_N, &(pps->parameters.n));
    188187        ATR_GetProtocolType(atr,1,&(pps->parameters.t)); //get protocol from TD1
    189         bool NeedsPTS = ((pps->icc->ifd->io->com != RTYP_SCI) && (pps->parameters.t != 14) && (numprottype > 1 || (atr->ib[0][ATR_INTERFACE_BYTE_TA].present == TRUE && atr->ib[0][ATR_INTERFACE_BYTE_TA].value != 0x11) || pps->parameters.n == 255)); //needs PTS according to ISO 7816 , SCI gets stuck on our PTS
    190         if (NeedsPTS) {
     188        bool NeedsPTS = ((pps->parameters.t != 14) && (numprottype > 1 || (atr->ib[0][ATR_INTERFACE_BYTE_TA].present == TRUE && atr->ib[0][ATR_INTERFACE_BYTE_TA].value != 0x11) || pps->parameters.n == 255)); //needs PTS according to ISO 7816 , SCI gets stuck on our PTS
     189        if (NeedsPTS && (pps->icc->ifd->io->com != RTYP_SCI)) {
    191190            //             PTSS  PTS0  PTS1  PTS2  PTS3  PCK
    192191            //             PTSS  PTS0  PTS1  PCK
     
    215214            }
    216215        }
    217 //FIXME: If the card is able to process more than one protocol type and if one of those protocol types is indicated as T=0, then the protocol type T=0 shall indicated in TD1 as the first offered protocol, and is assumed if no PTS is performed.
    218216
    219217        //FIXME Currently InitICC sets baudrate to 9600 for all T14 cards, which is the old behaviour...
    220218        if (!PPS_success) {//last PPS not succesfull
    221219            BYTE TA1;
    222             if (!NeedsPTS && ATR_GetInterfaceByte (atr, 1 , ATR_INTERFACE_BYTE_TA, &TA1) == ATR_OK && pps->parameters.t != 14) {
     220            if (ATR_GetInterfaceByte (atr, 1 , ATR_INTERFACE_BYTE_TA, &TA1) == ATR_OK && pps->parameters.t != 14) {
    223221                pps->parameters.FI = TA1 >> 4;
    224222                ATR_GetParameter (atr, ATR_PARAMETER_D, &(pps->parameters.d));
    225223            }
    226             else { //do not obey TA1 if T14, or when PTS is needed according to ISO, but failed, so not obeying ISO
     224            else { //do not obey TA1 if T14
    227225                pps->parameters.FI = ATR_DEFAULT_FI;
    228226                pps->parameters.d = ATR_DEFAULT_D;
     
    232230            ATR_GetProtocolType (atr, 1, &(pps->parameters.t));
    233231            protocol_selected = 1;
    234             cs_debug("No PTS, selected protocol 1: T%i, F=%.0f, D=%.6f, N=%.0f\n", pps->parameters.t, (double) atr_f_table[pps->parameters.FI], pps->parameters.d, pps->parameters.n);
     232
     233            if (NeedsPTS) { //FIXME we MUST discover PTS routine for Dreambox reader, now all cards in DBreaders which need PTS come here!!!
     234                if (OffersT[0]) {
     235    //If the card is able to process more than one protocol type and if one of those protocol types is indicated as T=0, then the protocol type T=0 shall indicated in TD1 as the first offered protocol, and is assumed if no PTS is performed.
     236                    pps->parameters.t =  ATR_PROTOCOL_TYPE_T0;
     237                    pps->parameters.FI = ATR_DEFAULT_FI; //ignoring TA1 is necessary at least for all viaccess cards on dreambox readers
     238                    pps->parameters.d = ATR_DEFAULT_D;   //but perhaps it is the general thing to do...
     239                }
     240            }
     241            /////Here all non-ISO behaviour
     242            // Nagra HD+
     243            // ATR: 3F FF 95 00 FF 91 81 71 FE 47 00 44 4E 41 53 50 31 34 32 20 52 65 76 47 43 34 63
     244            // Protocol 1: TA1=95 TB1=00 TC1=FF TD1=91 (T1)
     245            // Protocol 2: TA2=81 TD2=71 (T1)
     246            // Protocol 3: TA3=FE TB3=47 TC3=00 no TD3 means T0
     247            //
     248            // Problem1: card somehow fails all PTS attempts; perhaps because N=255 and we try PTS without it?
     249            // Problem2: card reports to support T0 but TA1=FE , which values are (still) undefined . On failure of PTS card reverts to TA=11 which
     250            // makes the card fail
     251            // We know the card needs 115200 (with cardmhz = 368) after ATR
     252            // Solution: longterm: implement PTS2
     253            // Solution: shorterm: this hardcoding
     254            //
     255            unsigned char nagra_hdplus[] = {0x44, 0x4E, 0x41, 0x53, 0x50}; //DNASP, not sure about timings of TIGER & others
     256            if (atr->hbn >= sizeof(nagra_hdplus))
     257                if (!memcmp(atr->hb, nagra_hdplus, sizeof(nagra_hdplus))) {
     258                    ATR_GetProtocolType (atr, 1, &(pps->parameters.t));
     259                    protocol_selected = 1;
     260                    if (ATR_GetInterfaceByte (atr, 1 , ATR_INTERFACE_BYTE_TA, &TA1) == ATR_OK) {
     261                        pps->parameters.FI = TA1 >> 4;
     262                        ATR_GetParameter (atr, ATR_PARAMETER_D, &(pps->parameters.d));
     263                    }
     264                }
     265            //
     266            //
     267            /////End  all non-ISO behaviour
     268          if (pps->icc->ifd->io->com == RTYP_SCI) {
     269          //// Here all fixes that are needed until PTS routine for Dreambox is found
     270            //// End  all fixes that are needed until PTS routine for Dreambox is found
     271                if (atr->hbn >=6)
     272                    if (!memcmp( atr->hb, "IRDETO", 6 )) { //IRDETO needs TA1 behaviour on /dev/sci  ; which other cards need ignore TA1 on T14?
     273                        pps->parameters.FI = TA1 >> 4;
     274                        ATR_GetParameter (atr, ATR_PARAMETER_D, &(pps->parameters.d));
     275                    }
     276            }
     277
     278            cs_debug("No PTS %s, selected protocol 1: T%i, F=%.0f, D=%.6f, N=%.0f\n", NeedsPTS?"happened":"needed", pps->parameters.t, (double) atr_f_table[pps->parameters.FI], pps->parameters.d, pps->parameters.n);
    235279        }
    236280    }//end length<0
     
    387431            return PPS_ICC_ERROR;
    388432
    389             ATR *atr = ICC_Async_GetAtr (pps->icc);
     433        ATR *atr = ICC_Async_GetAtr (pps->icc);
    390434
    391435        params.T = pps->parameters.t;
    392436
    393             BYTE oldFI = params.FI;
     437        BYTE oldFI = params.FI;
    394438//      params.FI = pps->parameters.FI; //somehow setting this gets "card unsupported"
    395439/*      if (pps->icc->ifd->io->mhz > 368) {
     
    406450
    407451        if (oldFI != params.FI)
    408           cs_log("Forcing params.FI from %i to %i", oldFI, params.FI);
    409 
    410         double F =  (double) atr_f_table[pps->parameters.FI];
     452            cs_log("Forcing params.FI from %i to %i", oldFI, params.FI);
     453
     454        double F =  (double) atr_f_table[pps->parameters.FI];
    411455        params.ETU = F / pps->parameters.d;
    412456        if (pps->parameters.n == 255)
     
    514558    return PPS_PROTOCOL_ERROR;
    515559}
    516 /*
    517 static void PPS_SelectFirstProtocol (PPS * pps)
    518 {
    519     ATR *atr = ICC_Async_GetAtr (pps->icc);
    520     unsigned np;
    521    
    522     pps->parameters.t = ATR_PROTOCOL_TYPE_T0;
    523    
    524     ATR_GetNumberOfProtocols (atr, &np);
    525    
    526      
    527     // Get protocol offered by interface bytes T*2 if available,
    528     // (that is, if TD1 is available), * otherwise use default T=0
    529    
    530     if (np>1)
    531         ATR_GetProtocolType (atr, 2, &(pps->parameters.t));
    532    
    533 #ifdef DEBUG_PROTOCOL
    534     printf ("PPS: Protocol T=%d selected\n", pps->parameters.t);
    535 #endif
    536 }
    537 */
     560
    538561static BYTE PPS_GetPCK (BYTE * block, unsigned length)
    539562{
  • branches/monitor-improvement/globals.h

    r949 r959  
    449449
    450450struct s_acasc_shm {
    451   ushort count : 15;
    452   ushort deny  : 1;
     451  ushort ac_count : 15;
     452  ushort ac_deny  : 1;
    453453};
    454454
     
    714714extern int chk_rsfilter(ECM_REQUEST *, int);
    715715extern int chk_avail_reader(ECM_REQUEST *, struct s_reader *);
     716extern int matching_reader(ECM_REQUEST *, struct s_reader *);
    716717extern void set_signal_handler(int , int , void (*)(int));
    717718extern void cs_log_config(void);
    718719extern void cs_reinit_clients(void);
     720extern void cs_resolve(void);
    719721
    720722#ifdef CS_ANTICASC
    721723//extern void start_anticascader(void);
    722724extern void init_ac(void);
    723 extern void ac_init_stat(int);
     725extern void ac_init_stat();
    724726extern int  ac_init_log(char*);
    725727extern void ac_do_stat(void);
     
    756758// oscam-log
    757759extern int  cs_init_log(char *);
     760extern void cs_write_log(char *);
    758761extern void cs_log(char *,...);
    759762extern void cs_debug(char *,...);
     
    773776extern int reader_device_init(char *, int);
    774777extern int reader_checkhealth(void);
     778extern void reader_post_process(void);
    775779extern int reader_ecm(ECM_REQUEST *);
    776780extern int reader_emm(EMM_PACKET *);
  • branches/monitor-improvement/module-cccam.c

    r885 r959  
    337337    if (errno != EINPROGRESS) {
    338338      cs_debug("cccam: conn_nb 3 (fd=%d)", sockfd);
    339     //  return(-1);
     339      //return(-1);
    340340    }
    341341  }
     
    512512  int n, i;
    513513  time_t t;
    514   struct cc_data *cc = reader[ridx].cc;
     514 // struct cc_data *cc = reader[ridx].cc;
    515515
    516516  t=time((time_t *)0);
     
    525525    if (ecmtask[i].rc >= 10) {  // stil active and waiting
    526526      // search for the ecm with the lowest time, this should be the next to go
    527       if ((!n || ecmtask[n].tps.time-ecmtask[i].tps.time < 0) && &ecmtask[n] != cc->found) n = i;
     527      if ((!n || ecmtask[n].tps.time-ecmtask[i].tps.time < 0) && &ecmtask[n]) n = i;
    528528    }
    529529  }
     
    539539  ECM_REQUEST *cur_er;
    540540
    541   if (!cc) return 0;
    542 
     541  if (!cc || (pfd < 1)) {
     542    if (er) {
     543      er->rc = 0;
     544      er->rcEx = 0x27;
     545      cs_log("cccam: server not init!");
     546      write_ecm_answer(fd_c2m, er);
     547    }
     548    return 0;
     549  }
     550
     551//  pthread_mutex_lock(&cc->ecm_busy);
    543552  if (pthread_mutex_trylock(&cc->ecm_busy) == EBUSY) {
    544553    cs_debug("cccam: ecm trylock: failed to get lock");
     
    566575    return 0;   // ecm already sent
    567576  }
     577
     578  //cc->found = cur_er;
    568579
    569580  if (buf) memcpy(buf, cur_er->ecm, cur_er->l);
     
    646657      while (card) {
    647658        if (card->caid == cur_er->caid) {   // caid matches
    648 
    649659          LLIST_ITR sitr;
    650660          uint16 *sid = llist_itr_init(card->badsids, &sitr);
    651661          while (sid) {
    652             if (*sid == cur_er->srvid) sid = llist_itr_remove(&sitr);
     662            if (*sid == cur_er->srvid)
     663                sid = llist_itr_remove(&sitr);
    653664            else sid = llist_itr_next(&sitr);
    654665          }
     
    658669      }
    659670      llist_itr_release(&itr);
    660   }
    661 
    662   pthread_mutex_unlock(&cc->lock);
     671
     672      pthread_mutex_unlock(&cc->ecm_busy);
     673  }
     674
    663675  return 0;
    664676}
    665 
    666 // this is a hack and it's baaaaaad. It's also not used yet!
    667677/*
    668 static void cc_rebuild_caid_tab()
    669 {
    670   int zz;
    671   for(zz = 0; zz < CS_MAXCAIDTAB; zz++) {
    672     cs_log("caid %x", reader[ridx].ctab.caid[zz]);
    673   }
    674 }
    675 */
    676 
    677678static int cc_abort_user_ecms(){
    678679  int n, i;
     
    699700
    700701}
    701 
     702*/
    702703static cc_msg_type_t cc_parse_msg(uint8 *buf, int l)
    703704{
    704705  int ret = buf[1];
    705706  struct cc_data *cc = reader[ridx].cc;
    706 
    707   pthread_mutex_lock(&cc->lock);
    708707
    709708  switch (buf[1]) {
     
    716715    break;
    717716  case MSG_NEW_CARD:
    718     // find blank caid slot in tab and add caid
    719717    {
    720718      int i = 0;
    721       /*, p = 0;
    722       while(reader[ridx].ctab.caid[i]) {
    723         if (reader[ridx].ctab.caid[i] == b2i(2, buf+12)) p = 1;
    724         i++;
    725       }
    726     if (!p) {
    727       reader[ridx].ctab.caid[i] = b2i(2, buf+12);
    728     }
    729     */
    730 
    731    // if (b2i(2, buf+12) == reader[ridx].ctab.caid[0]) { // only add cards with relevant caid (for now)
    732     //  int i;
    733719      struct cc_card *card = malloc(sizeof(struct cc_card));
    734720
     
    826812  }
    827813
    828   pthread_mutex_unlock(&cc->lock);
    829814  return ret;
    830815}
     
    851836{
    852837  int n;
     838  struct cc_data *cc = reader[ridx].cc;
    853839  uchar *cbuf = malloc(l);
    854840
    855841  memcpy(cbuf, buf, l);   // make a copy of buf
     842
     843  pthread_mutex_lock(&cc->lock);
    856844
    857845  if (!is_server) {
     
    879867  X_FREE(cbuf);
    880868
     869  pthread_mutex_unlock(&cc->lock);
     870
    881871  return(n);
    882872}
     
    964954  pfd=client[cs_idx].udp_fd;
    965955
    966   if (cc_send_cli_data(cc)<=0) {
     956  if (cc_send_cli_data()<=0) {
    967957    cs_log("cccam: login failed, could not send client data");
    968958    return -3;
  • branches/monitor-improvement/oscam-ac.c

    r573 r959  
    2323}
    2424
    25 void ac_init_stat(int i)
     25void ac_init_stat()
    2626{
    2727  memset(ac_stat, 0, sizeof(ac_stat));
     
    5353  {
    5454    idx = ac_stat[i].idx;
    55     ac_stat[i].stat[idx] = acasc[i].count;
    56     acasc[i].count=0;
     55    ac_stat[i].stat[idx] = acasc[i].ac_count;
     56    acasc[i].ac_count=0;
    5757    cl_idx = idx_from_ac_idx(i);
    5858
     
    6666      if( client[cl_idx].ac_penalty==2 ) {// banned
    6767        cs_debug("user '%s' banned", client[cl_idx].usr);
    68         acasc[i].deny=1;
     68        acasc[i].ac_deny=1;
    6969      }
    7070      else
     
    7676          exceeds+=(ac_stat[i].stat[j]>client[cl_idx].ac_limit);
    7777        }
    78         prev_deny=acasc[i].deny;
    79         acasc[i].deny = (exceeds >= cfg->ac_denysamples);
     78        prev_deny=acasc[i].ac_deny;
     79        acasc[i].ac_deny = (exceeds >= cfg->ac_denysamples);
    8080       
    8181        cs_debug("%s limit=%d, max=%d, samples=%d, dsamples=%d, ac[ci=%d][si=%d]:",
     
    8686          ac_stat[i].stat[4], ac_stat[i].stat[5], ac_stat[i].stat[6],
    8787          ac_stat[i].stat[7], ac_stat[i].stat[8], ac_stat[i].stat[9]);
    88         if( acasc[i].deny ) {
     88        if( acasc[i].ac_deny ) {
    8989          cs_log("user '%s' exceeds limit", client[cl_idx].usr);
    9090          ac_stat[i].stat[idx] = 0;
     
    9393      }
    9494    }
    95     else if( acasc[i].deny )
     95    else if( acasc[i].ac_deny )
    9696    {
    9797      prev_deny=1;
    98       acasc[i].deny=0;
     98      acasc[i].ac_deny=0;
    9999      if( cl_idx!=-1 )
    100100        cs_log("restored access for inactive user '%s'", client[cl_idx].usr);
     
    103103    }
    104104
    105     if( !acasc[i].deny && !prev_deny )
     105    if( !acasc[i].ac_deny && !prev_deny )
    106106      ac_stat[i].idx = (ac_stat[i].idx + 1) % cfg->ac_samples;
    107107  }
     
    150150  if( level==1 )
    151151  {
    152     if( er->rc==7 ) acasc[client[cs_idx].ac_idx].count++;
     152    if( er->rc==7 ) acasc[client[cs_idx].ac_idx].ac_count++;
    153153    if( er->rc>3 ) return; // not found
    154154    if( memcmp(ac_ecmd5, er->ecmd5, CS_ECMSTORESIZE) != 0 )
    155155    {
    156       acasc[client[cs_idx].ac_idx].count+=ac_dw_weight(er);
     156      acasc[client[cs_idx].ac_idx].ac_count+=ac_dw_weight(er);
    157157      memcpy(ac_ecmd5, er->ecmd5, CS_ECMSTORESIZE);
    158158    }
     
    160160  }
    161161
    162   if( acasc[client[cs_idx].ac_idx].deny )
     162  if( acasc[client[cs_idx].ac_idx].ac_deny )
    163163    if( client[cs_idx].ac_penalty )
    164164    {
  • branches/monitor-improvement/oscam.c

    r928 r959  
    260260}
    261261
    262 static void cs_alarm(int sig)
     262static void cs_alarm()
    263263{
    264264  cs_debug("Got alarm signal");
     
    267267}
    268268
    269 static void cs_master_alarm(int sig)
     269static void cs_master_alarm()
    270270{
    271271  cs_log("PANIC: master deadlock! last location: %s", mloc);
     
    275275}
    276276
    277 static void cs_sigpipe(int sig)
     277static void cs_sigpipe()
    278278{
    279279  if ((cs_idx) && (master_pid!=getppid()))
     
    832832}
    833833
    834 static void cs_client_resolve(void *dummy)
     834static void cs_client_resolve()
    835835{
    836836  while (1)
     
    920920      {
    921921        case PIP_ID_LOG:
    922           cs_write_log(ptr);
     922          cs_write_log((char *)ptr);
    923923          break;
    924924      }
     
    963963  set_signal_handler(SIGHUP, 1, ac_init_stat);
    964964
    965   ac_init_stat(0);
     965  ac_init_stat();
    966966  while(1)
    967967  {
     
    18471847      if ((er->caid==ttab->bt_caidfrom[n]) && ((er->srvid==ttab->bt_srvid[n]) || (ttab->bt_srvid[n])==mask_all))
    18481848      {
    1849         char hack_n3[13]={0x70, 0x51, 0xc7, 0x00, 0x00, 0x00, 0x01, 0x10, 0x10, 0x00, 0x87, 0x12, 0x07};
    1850         char hack_n2[13]={0x70, 0x51, 0xc9, 0x00, 0x00, 0x00, 0x01, 0x10, 0x10, 0x00, 0x48, 0x12, 0x07};
     1849        uchar hack_n3[13]={0x70, 0x51, 0xc7, 0x00, 0x00, 0x00, 0x01, 0x10, 0x10, 0x00, 0x87, 0x12, 0x07};
     1850        uchar hack_n2[13]={0x70, 0x51, 0xc9, 0x00, 0x00, 0x00, 0x01, 0x10, 0x10, 0x00, 0x48, 0x12, 0x07};
    18511851        er->caid=ttab->bt_caidto[n];
    18521852        er->prid=0;
     
    21152115  {
    21162116    case PIP_ID_LOG:
    2117       cs_write_log(ptr);
     2117      cs_write_log((char *)ptr);
    21182118      break;
    21192119    case PIP_ID_HUP:
  • branches/monitor-improvement/reader-common.c

    r885 r959  
    440440      sprintf (token, "%swrite_%s_%s.%s", cs_confdir, (ep->emm[0] == 0x82) ? "UNIQ" : "SHARED", buf, "txt");
    441441      if (!(fp = fopen (token, "w")))
    442     cs_log ("ERROR: Cannot open EMM.txt file '%s' (errno=%d)\n", token, errno);
    443       else {
    444     cs_log ("Succesfully written text EMM to %s.", token);
    445     int emm_length = ((ep->emm[1] & 0x0f) << 8) | ep->emm[2];
    446     fprintf (fp, "%s", cs_hexdump (0, ep->emm, emm_length + 3));
    447     fclose (fp);
     442      {
     443        cs_log ("ERROR: Cannot open EMM.txt file '%s' (errno=%d)\n", token, errno);
     444      }
     445      else
     446      {
     447        cs_log ("Succesfully written text EMM to %s.", token);
     448        int emm_length = ((ep->emm[1] & 0x0f) << 8) | ep->emm[2];
     449        fprintf (fp, "%s", cs_hexdump (0, ep->emm, emm_length + 3));
     450        fclose (fp);
    448451      }
    449452
     
    451454      sprintf (token, "%swrite_%s_%s.%s", cs_confdir, (ep->emm[0] == 0x82) ? "UNIQ" : "SHARED", buf, "emm");
    452455      if (!(fp = fopen (token, "wb")))
    453     cs_log ("ERROR: Cannot open EMM.emm file '%s' (errno=%d)\n", token, errno);
    454       else {
    455     cs_log ("Succesfully written binary EMM to %s.", token);
    456     fwrite (ep, sizeof (*ep), 1, fp);
    457     fclose (fp);
     456      {
     457        cs_log ("ERROR: Cannot open EMM.emm file '%s' (errno=%d)\n", token, errno);
     458      }
     459      else
     460      {
     461        if (fwrite(ep, sizeof (*ep), 1, fp) == 1)
     462        {
     463            cs_log ("Succesfully written binary EMM to %s.", token);
     464        }
     465        else
     466        {
     467            cs_log ("ERROR: Cannot write binary EMM to %s (errno=%d)\n", token, errno);
     468        }
     469        fclose (fp);
    458470      }
    459471    }
  • branches/monitor-improvement/reader-conax.c

    r473 r959  
    259259    while (cta_res[cta_lr-2]==0x98)
    260260    {
    261       insCA[4]=cta_res[1];      // get len
     261      insCA[4]=cta_res[cta_lr-1];       // get len
    262262      read_cmd(insCA, NULL);        // read
    263263      if ((cta_res[cta_lr-2]==0x90) || (cta_res[cta_lr-2]==0x98))
  • branches/monitor-improvement/reader-dre.c

    r885 r959  
    113113    case 0xe2:
    114114      cs_log ("DRECRYPT wrong provider: %s.", cs_hexdump (0, cta_res, cta_lr));
     115      break;
     116    case 0xe3:
     117      cs_log ("DRECRYPT illegal command: %s.", cs_hexdump (0, cta_res, cta_lr)); 
    115118      break;
    116119    case 0xec:
     
    315318    for (i = 0; i < 2; i++) {
    316319      memcpy (emmcmd52 + 1, ep->emm + 5 + 32 + i * 56, 56);
     320      // check for shared address
     321      if(ep->emm[3]!=reader[ridx].sa[0][0])
     322        return 1; // ignore, wrong address
    317323      emmcmd52[0x39] = provider;
    318324      if ((dre_cmd (emmcmd52)))
Note: See TracChangeset for help on using the changeset viewer.