- Timestamp:
- 05/04/09 11:23:05 (3 years ago)
- File:
-
- 1 edited
-
trunk/src/ifd/ifd-rutoken.c (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ifd/ifd-rutoken.c
r1137 r1152 32 32 ifd_device_params_t params; 33 33 34 ifd_debug( 1, "rutoken_open - %s", device_name);34 ifd_debug(6, "rutoken_open - %s", device_name); 35 35 36 36 reader->name = "Rutoken S driver"; … … 56 56 dev->timeout = 1000; 57 57 58 ifd_debug( 1, "rutoken_open - %s - successful", device_name);58 ifd_debug(6, "rutoken_open - %s - successful", device_name); 59 59 return 0; 60 60 } … … 62 62 static int rutoken_activate(ifd_reader_t * reader) 63 63 { 64 ifd_debug( 1, "called.");64 ifd_debug(6, "called."); 65 65 return 0; 66 66 } … … 68 68 static int rutoken_deactivate(ifd_reader_t * reader) 69 69 { 70 ifd_debug( 1, "called.");70 ifd_debug(6, "called."); 71 71 return -1; 72 72 } … … 102 102 { 103 103 int nLen = 0, i; 104 ifd_debug( 1, "rutoken_card_reset, slot = %X", slot);104 ifd_debug(6, "rutoken_card_reset, slot = %X", slot); 105 105 if(ifd_usb_control(reader->device, 0x41, USB_ICC_POWER_OFF, 0, 0, 0, 0, -1) < 0) 106 106 { 107 ifd_debug( 1, "error poweroff");107 ifd_debug(6, "error poweroff"); 108 108 return -1; 109 109 } … … 111 111 if( rutoken_getstatus(reader, &status) < 0) 112 112 { 113 ifd_debug( 1, "error get status");113 ifd_debug(6, "error get status"); 114 114 return -1; 115 115 } … … 122 122 if( nLen < 0 ) 123 123 { 124 ifd_debug( 1, "error poewron");124 ifd_debug(6, "error poewron"); 125 125 return -1; 126 126 } 127 127 128 ifd_debug( 1, "returned len = %d", nLen);129 for(i = 0; i < OUR_ATR_LEN; i++) ifd_debug( 1, "%c", buf[i]);128 ifd_debug(6, "returned len = %d", nLen); 129 for(i = 0; i < OUR_ATR_LEN; i++) ifd_debug(6, "%c", buf[i]); 130 130 memcpy(atr, buf, nLen); 131 131 return nLen; 132 132 } 133 133 134 ifd_debug( 1, "error bad status");134 ifd_debug(6, "error bad status"); 135 135 return -1; 136 136 } … … 150 150 ifd_protocol_t *p; 151 151 152 ifd_debug( 1, "proto=%d", proto);152 ifd_debug(6, "proto=%d", proto); 153 153 if (proto != IFD_PROTOCOL_T0 && proto != IFD_PROTOCOL_TRANSPARENT) { 154 154 ct_error("%s: protocol %d not supported", reader->name, proto); … … 166 166 } 167 167 slot->proto = p; 168 ifd_debug( 1, "success");168 ifd_debug(6, "success"); 169 169 return 0; 170 170 } … … 189 189 { 190 190 ret = -1; 191 ifd_debug( 1, "error get status");191 ifd_debug(6, "error get status"); 192 192 } 193 193 return ret; … … 205 205 { 206 206 ret = -1; 207 ifd_debug( 1, "error get status, %0x", status);207 ifd_debug(6, "error get status, %0x", status); 208 208 } 209 209 ifd_debug(3, "usd recv %s len %d", ct_hexdump(buffer, ret), ret); … … 216 216 if(rutoken_getstatus(reader, &status) == ICC_STATUS_MUTE) 217 217 { //If device not responsive 218 ifd_debug( 1, "status = ICC_STATUS_MUTE");218 ifd_debug(6, "status = ICC_STATUS_MUTE"); 219 219 return(rutoken_restart(reader)); 220 220 } 221 221 if(status == ICC_STATUS_READY_SW) 222 222 { 223 ifd_debug( 1, "status = ICC_STATUS_READY_SW;");223 ifd_debug(6, "status = ICC_STATUS_READY_SW;"); 224 224 if(rutoken_recv(reader, 0, sw, 2, 10000) < 0) 225 225 return -5; 226 ifd_debug( 1, "Get SW %x %x", sw[0], sw[1]);226 ifd_debug(6, "Get SW %x %x", sw[0], sw[1]); 227 227 return 2; 228 228 } … … 236 236 size_t slen, void *rbuf, size_t rlen, int iscase4) 237 237 { 238 ifd_debug( 1, "send tpdu command %s, len: %d", ct_hexdump(sbuf, slen), slen);238 ifd_debug(6, "send tpdu command %s, len: %d", ct_hexdump(sbuf, slen), slen); 239 239 int rrecv = 0; 240 240 unsigned char status; … … 247 247 case IFD_APDU_CASE_1: 248 248 // {cla, ins, p1, p2, 0}; 249 ifd_debug( 1, "case 1");249 ifd_debug(6, "case 1"); 250 250 break; 251 251 case IFD_APDU_CASE_2S: 252 252 // {cla, ins, p1, p2, le}; 253 253 // Rutoken Bug!!! 254 ifd_debug( 1, "case 2");254 ifd_debug(6, "case 2"); 255 255 if(iso.ins == 0xa4){ 256 256 hdr[4] = 0x20; … … 263 263 case IFD_APDU_CASE_3S: 264 264 // {cla, ins, p1, p2, lc}; 265 ifd_debug( 1, "case 3");265 ifd_debug(6, "case 3"); 266 266 hdr[4] = iso.lc; 267 267 break; … … 281 281 case IFD_APDU_CASE_2S: 282 282 // get answere 283 ifd_debug( 1, "Get Data %d", iso.le);283 ifd_debug(6, "Get Data %d", iso.le); 284 284 if(rutoken_getstatus(reader, &status) == ICC_STATUS_READY_DATA) 285 285 { … … 287 287 if (rrecv < 0) 288 288 return -2; 289 ifd_debug( 1, "Get TPDU Anser %s",289 ifd_debug(6, "Get TPDU Anser %s", 290 290 ct_hexdump(rbuf, iso.le)); 291 291 } … … 306 306 case IFD_APDU_CASE_3S: 307 307 // send data 308 ifd_debug( 1, "Send Data %d", iso.lc);308 ifd_debug(6, "Send Data %d", iso.lc); 309 309 if(rutoken_getstatus(reader, &status) == ICC_STATUS_READY_DATA) 310 310 { 311 ifd_debug( 1, "Send TPDU Data %s",311 ifd_debug(6, "Send TPDU Data %s", 312 312 ct_hexdump(iso.data, iso.lc)); 313 313 if (rutoken_send(reader, 0, iso.data, iso.lc) < 0) … … 358 358 memcpy(((char *)rbuf)+rrecv, sw, 2); 359 359 rrecv+=2; 360 ifd_debug( 1, "Recv %d bytes", rrecv);360 ifd_debug(6, "Recv %d bytes", rrecv); 361 361 return rrecv; 362 362 } … … 368 368 int rrecv = 0; 369 369 ifd_iso_apdu_t iso; 370 ifd_debug( 1, "buffer %s rlen = %d", ct_hexdump(sbuf, slen), rlen);370 ifd_debug(6, "buffer %s rlen = %d", ct_hexdump(sbuf, slen), rlen); 371 371 if ( ifd_iso_apdu_parse(sbuf, slen, &iso) < 0) 372 372 return -1; 373 ifd_debug( 1, "iso.le = %d", iso.le);373 ifd_debug(6, "iso.le = %d", iso.le); 374 374 switch(iso.cse){ 375 375 case IFD_APDU_CASE_1: … … 393 393 static int rutoken_get_eventfd(ifd_reader_t * reader, short *events) 394 394 { 395 ifd_debug( 1, "called.");395 ifd_debug(6, "called."); 396 396 397 397 return ifd_device_get_eventfd(reader->device, events); … … 404 404 (void)status_size; 405 405 406 ifd_debug( 1, "called.");406 ifd_debug(6, "called."); 407 407 408 408 return 0; … … 413 413 (void)reader; 414 414 415 ifd_debug( 1, "called.");415 ifd_debug(6, "called."); 416 416 417 417 return IFD_ERROR_DEVICE_DISCONNECTED;
Note: See TracChangeset
for help on using the changeset viewer.
