Changeset 969 for trunk/src/ifd


Ignore:
Timestamp:
06/21/07 09:41:53 (5 years ago)
Author:
aj
Message:

Chaskiel M Grundman:
add ccid char support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ifd/ifd-ccid.c

    r964 r969  
    450450        unsigned char recvbuf[CCID_MAX_MSG_LEN + 1]; 
    451451        int r; 
     452        unsigned char ctlbuf[3], *ctlptr=0; 
     453 
     454        ctlptr=NULL; 
     455        if (st->reader_type == TYPE_CHAR) { 
     456                ctlbuf[0] = 0; 
     457                ctlbuf[1] = rlen & 0xff; 
     458                ctlbuf[2] = (rlen >> 8) & 0xff; 
     459                ctlptr = ctlbuf; 
     460        } 
    452461 
    453462        r = ccid_prepare_cmd(reader, sendbuf, st->maxmsg, 
    454                              slot, CCID_CMD_XFRBLOCK, NULL, sbuf, slen); 
     463                             slot, CCID_CMD_XFRBLOCK, ctlptr, sbuf, slen); 
    455464        if (r < 0) 
    456465                return r; 
     
    695704        st->ifsd = ccid.dwMaxIFSD; 
    696705 
    697         if (st->reader_type == TYPE_CHAR) { 
    698                 ct_error("ccid: Character mode readers not supported"); 
    699                 free(st); 
    700                 ifd_device_close(dev); 
    701                 return -1; 
    702         } 
    703  
    704706        /* must provide AUTO or at least one of 5/3.3/1.8 */ 
    705707        if (st->voltage_support == 0) { 
     
    11191121                } 
    11201122                r = ccid_exchange(reader, s, pts, ptslen, ptsret, 
    1121                                   sizeof(ptsret)); 
     1123                                  ptslen); 
    11221124                if (r < 0) 
    11231125                        return r; 
     
    11311133        memset(&parambuf[r], 0, sizeof(parambuf) - r); 
    11321134        if (proto == IFD_PROTOCOL_T0) { 
    1133                 p = ifd_protocol_new(IFD_PROTOCOL_TRANSPARENT, 
    1134                                      reader, slot->dad); 
     1135                if (st->reader_type == TYPE_CHAR) { 
     1136                        p = ifd_protocol_new(proto, 
     1137                                             reader, slot->dad); 
     1138                } else { 
     1139                        p = ifd_protocol_new(IFD_PROTOCOL_TRANSPARENT, 
     1140                                             reader, slot->dad); 
     1141                } 
    11351142        } else { 
    11361143                p = ifd_protocol_new(proto, reader, slot->dad); 
     
    11561163                return -1; 
    11571164        } 
     1165        /* ccid_recv needs to know the exact expected data length */ 
     1166        if (st->reader_type == TYPE_CHAR) 
     1167                ifd_protocol_set_parameter(p, IFD_PROTOCOL_BLOCK_ORIENTED, 0); 
    11581168        if (slot->proto) { 
    11591169                ifd_protocol_free(slot->proto); 
     
    12381248        st->sbuf[dad] = NULL; 
    12391249        st->slen[dad] = 0; 
     1250        if (r < 0) 
     1251                ifd_debug(3, "failed: %d", r); 
    12401252        return r; 
    12411253} 
Note: See TracChangeset for help on using the changeset viewer.