Changeset 1946 for trunk/reader-dre.c


Ignore:
Timestamp:
Apr 4, 2010, 10:41:41 AM (10 years ago)
Author:
merek
Message:

Merge from UMP r1973-1979

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/reader-dre.c

    r1926 r1946  
    22#include "reader-common.h"
    33
    4 extern uchar cta_res[];
    5 extern ushort cta_lr;
    64static uchar provider;
    75static short int mode;
     
    1917}
    2018
    21 static int dre_command (struct s_reader * reader, uchar * cmd, int cmdlen)  //attention: inputcommand will be changed!!!! answer will be in cta_res, length cta_lr ; returning 1 = no error, return ERROR = err
    22 {
     19static int dre_command (struct s_reader * reader, uchar * cmd, int cmdlen, unsigned char * cta_res, unsigned short * cta_length)    //attention: inputcommand will be changed!!!! answer will be in cta_res, length cta_lr ; returning 1 = no error, return ERROR = err
     20{
     21  def_resp2;
    2322  static uchar startcmd[] = { 0x80, 0xFF, 0x10, 0x01, 0x05 };   //any command starts with this,
    2423  //last byte is nr of bytes of the command that will be sent
     
    4039  command[cmdlen++] = checksum;
    4140
    42   reader_cmd2icc (reader, command, cmdlen);
     41  reader_cmd2icc (reader, command, cmdlen, cta_res, &cta_lr);
    4342
    4443  if ((cta_lr != 2) || (cta_res[0] != OK_RESPONSE)) {
     
    4847
    4948  reqans[4] = cta_res[1];   //adapt length byte
    50   reader_cmd2icc (reader, reqans, 5);
     49  reader_cmd2icc (reader, reqans, 5, cta_res, &cta_lr);
    5150
    5251  if (cta_res[0] != CMD_BYTE) {
     
    9089#define dre_cmd(cmd) \
    9190{ \
    92     dre_command(reader, cmd, sizeof(cmd)); \
     91    dre_command(reader, cmd, sizeof(cmd),cta_res,&cta_lr); \
    9392}
    9493
    9594static int dre_set_provider_info (struct s_reader * reader)
    9695{
     96  def_resp;
    9797  int i;
    9898  static uchar cmd59[] = { 0x59, 0x14 };    // subscriptions
     
    139139{
    140140    get_atr;
     141  def_resp;
    141142  static uchar ua[] = { 0x43, 0x15 };   // get serial number (UA)
    142143  static uchar providers[] = { 0x49, 0x15 };    // get providers
     
    256257int dre_do_ecm (struct s_reader * reader, ECM_REQUEST * er)
    257258{
     259  def_resp;
    258260  if (mode == 41) {
    259261    static uchar ecmcmd41[] = { 0x41,
     
    321323int dre_do_emm (struct s_reader * reader, EMM_PACKET * ep)
    322324{
    323 
     325  def_resp;
    324326  int emm_length = ((ep->emm[1] & 0x0f) << 8) + ep->emm[2];
    325327
Note: See TracChangeset for help on using the changeset viewer.