Changeset 6398
- Timestamp:
- 02/15/12 21:28:55 (12 years ago)
- Location:
- branches/sc8in1
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sc8in1/csctapi/icc_async.c
r6332 r6398 55 55 #define PPS_HAS_PPS3(block) ((block[1] & 0x40) == 0x40) 56 56 57 #define LOCK_SC8IN1 \58 { \59 if (reader->typ == R_SC8in1) { \60 cs_writelock(&reader->sc8in1_config->sc8in1_lock); \61 cs_debug_mask(D_ATR, "SC8in1: locked for access of slot %i", reader->slot); \62 Sc8in1_Selectslot(reader, reader->slot); \63 } \64 }65 66 #define UNLOCK_SC8IN1 \67 { \68 if (reader->typ == R_SC8in1) { \69 cs_writeunlock(&reader->sc8in1_config->sc8in1_lock); \70 cs_debug_mask(D_ATR, "SC8in1: unlocked for access of slot %i", reader->slot); \71 } \72 }73 74 57 /* 75 58 * Not exported functions declaration … … 339 322 case R_DB2COM2: 340 323 case R_SC8in1: 341 call (SC8in1_Reset(reader, atr));342 break;343 324 case R_MOUSE: 344 call (Phoenix_Reset(reader, atr)); 325 LOCK_SC8IN1 326 int32_t retval = Phoenix_Reset(reader, atr); 327 UNLOCK_SC8IN1 328 if (retval) { 329 cs_debug_mask(D_TRACE, "ERROR, function call Phoenix_Reset returns error."); 330 return ERROR; 331 } 345 332 break; 346 333 #if defined(LIBUSB) -
branches/sc8in1/csctapi/ifd_sc8in1.c
r6384 r6398 25 25 #include "icc_async.h" 26 26 27 #define LOCK_SC8IN1 \28 { \29 if (reader->typ == R_SC8in1) { \30 cs_writelock(&reader->sc8in1_config->sc8in1_lock); \31 cs_debug_mask(D_ATR, "SC8in1: locked for access of slot %i", reader->slot); \32 Sc8in1_Selectslot(reader, reader->slot); \33 } \34 }35 36 #define UNLOCK_SC8IN1 \37 { \38 if (reader->typ == R_SC8in1) { \39 cs_writeunlock(&reader->sc8in1_config->sc8in1_lock); \40 cs_debug_mask(D_ATR, "SC8in1: unlocked for access of slot %i", reader->slot); \41 } \42 }43 44 27 #ifdef WITH_DEBUG 45 28 int32_t Sc8in1_DebugSignals(struct s_reader *reader, uint16_t slot, const char *extra); … … 54 37 int32_t Sc8in1_NeedBaudrateChange(struct s_reader * reader, uint32_t desiredBaudrate, struct termios *current, struct termios *new, uint8_t cmdMode); 55 38 static int32_t sc8in1_tcdrain(struct s_reader *reader); 56 39 int32_t Sc8in1_SetSlotForReader(struct s_reader *reader); 40 int32_t Sc8in1_Card_Changed (struct s_reader * reader); 57 41 58 42 static int32_t sc8in1_command(struct s_reader * reader, unsigned char * buff, … … 527 511 } 528 512 529 int32_t SC8in1_Reset (struct s_reader * reader, ATR * atr)530 {531 LOCK_SC8IN1532 cs_debug_mask (D_IFD, "IFD: Resetting card:\n");533 int32_t ret;534 int32_t i;535 unsigned char buf[ATR_MAX_SIZE];536 int32_t parity[3] = {PARITY_EVEN, PARITY_ODD, PARITY_NONE};537 538 if ( ! reader->ins7e11_fast_reset ) {539 if (Sc8in1_SetBaudrate(reader, DEFAULT_BAUDRATE, NULL, 0)) {540 UNLOCK_SC8IN1541 #ifdef WITH_DEBUG542 cs_debug_mask(D_TRACE, "ERROR, function call %s returns error.","Phoenix_SetBaudrate (reader, DEFAULT_BAUDRATE)");543 #endif544 return ERROR;545 }546 }547 else {548 cs_log("Doing fast reset");549 }550 551 for(i=0; i<3; i++) {552 IO_Serial_Flush(reader);553 if (IO_Serial_SetParity (reader, parity[i])) {554 UNLOCK_SC8IN1555 #ifdef WITH_DEBUG556 cs_debug_mask(D_TRACE, "ERROR, function call %s returns error.","IO_Serial_SetParity (reader, parity[i])");557 #endif558 return ERROR;559 }560 561 ret = ERROR;562 IO_Serial_Ioctl_Lock(reader, 1);563 #ifdef USE_GPIO564 if (reader->detect>4)565 set_gpio(reader, 0);566 else567 #endif568 IO_Serial_RTS_Set(reader);569 cs_sleepms(200);570 #ifdef USE_GPIO //felix: set card reset hi (inactive)571 if (reader->detect>4) {572 set_gpio_input(reader);573 }574 else575 #endif576 IO_Serial_RTS_Clr(reader);577 578 cs_sleepms(50);579 IO_Serial_Ioctl_Lock(reader, 0);580 581 int32_t n=0;582 while(n<ATR_MAX_SIZE && !IO_Serial_Read(reader, ATR_TIMEOUT, 1, buf+n))583 n++;584 if(n==0)585 continue;586 if (ATR_InitFromArray (atr, buf, n) == ATR_OK)587 ret = OK;588 // Succesfully retrieve ATR589 if (ret == OK)590 break;591 }592 IO_Serial_Flush(reader);593 UNLOCK_SC8IN1594 595 return ret;596 }597 598 513 int32_t Sc8in1_NeedBaudrateChange(struct s_reader * reader, uint32_t desiredBaudrate, struct termios *current, struct termios *new, uint8_t cmdMode) { 599 514 // Returns 1 if we need to change the baudrate … … 699 614 // check for a MCR device and how many slots it has. 700 615 unsigned char mcrType[1]; mcrType[0] = 0; 701 //mhh.. fritzbox7170 sends some unknown bytes when 702 // the ftdi driver is first used. this is a test. 616 // at least fritzbox7170 needs to issue this twice 703 617 mcrReadType(reader, &mcrType[0]); 704 618 mcrType[0] = 0; … … 846 760 Sc8in1_Selectslot(reader, reader->slot); 847 761 848 //IO_Serial_Flush(reader); //FIXME somehow ATR is generated and must be flushed849 762 i = -1; //Flag for GetStatus init 850 763 Sc8in1_GetStatus(reader, &i); //Initialize cardstatus -
branches/sc8in1/csctapi/ifd_sc8in1.h
r6304 r6398 17 17 */ 18 18 19 #include <pthread.h>20 21 19 int32_t Sc8in1_Init (struct s_reader * reader); 22 20 int32_t Sc8in1_GetStatus (struct s_reader * reader, int32_t * status); 23 int32_t Sc8in1_Card_Changed (struct s_reader * reader);24 21 int32_t Sc8in1_Selectslot(struct s_reader * reader, uint16_t slot); 25 22 int32_t Sc8in1_GetActiveHandle(struct s_reader *reader, uint8_t onlyEnabledReaders); 26 23 int32_t Sc8in1_Close(struct s_reader *reader); 27 24 int32_t Sc8in1_InitLocks(struct s_reader * reader); 28 int32_t Sc8in1_SetSlotForReader(struct s_reader *reader);29 int32_t SC8in1_Reset (struct s_reader * reader, ATR * atr);30 25 int32_t MCR_DisplayText(struct s_reader *reader, char* text, uint16_t text_len, uint16_t time, uint8_t blocking); -
branches/sc8in1/globals.h
r6384 r6398 1018 1018 1019 1019 //sc8in1 1020 #define LOCK_SC8IN1 \ 1021 { \ 1022 if (reader->typ == R_SC8in1) { \ 1023 cs_writelock(&reader->sc8in1_config->sc8in1_lock); \ 1024 cs_debug_mask(D_ATR, "SC8in1: locked for access of slot %i", reader->slot); \ 1025 Sc8in1_Selectslot(reader, reader->slot); \ 1026 } \ 1027 } 1028 1029 #define UNLOCK_SC8IN1 \ 1030 { \ 1031 if (reader->typ == R_SC8in1) { \ 1032 cs_writeunlock(&reader->sc8in1_config->sc8in1_lock); \ 1033 cs_debug_mask(D_ATR, "SC8in1: unlocked for access of slot %i", reader->slot); \ 1034 } \ 1035 } 1020 1036 struct s_sc8in1_display { 1021 1037 char *text;
Note:
See TracChangeset
for help on using the changeset viewer.