Changeset 1185
- Timestamp:
- 01/11/10 17:52:36 (14 years ago)
- Location:
- trunk/csctapi
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/io_serial.c
r1179 r1185 520 520 521 521 /* Set the bitrate */ 522 if(io->reader_type==RTYP_SMART)523 {524 #ifdef DEBUG_IO525 printf("IO: SMARTREADER .. switching to frequency to %2.2fMHz\n", (float)io->mhz/100.0);526 #endif527 if(!IO_Serial_Set_Smartreader_Freq(io))528 {529 #ifdef DEBUG_IO530 printf("IO: SMARTREADER .. ERROR switching to 6MHz\n");531 #endif532 return FALSE;533 }534 }535 536 522 #ifdef OS_LINUX 537 523 if (io->mhz == io->cardmhz) … … 1064 1050 return TRUE; 1065 1051 } 1066 1067 1068 bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io)1069 {1070 struct termios term;1071 struct termios orig;1072 int freq = io->mhz;1073 unsigned char fi_di[4]={0x01, 0x01, 0x74, 0x01};1074 unsigned char fr[3]={0x02, 0x00, 0x00};1075 unsigned char nn[2]={0x03, 0x00};1076 unsigned char pr[2]={0x04, 0x00};1077 unsigned char in[2]={0x05, 0x00};1078 1079 orig=term;1080 1081 /* set smartreader in CMD mode */1082 tcgetattr(io->fd, &term);1083 1084 term.c_cflag &= ~CSIZE;1085 term.c_cflag |= CS5;1086 cfsetospeed(&term, 9600);1087 cfsetispeed(&term, 9600);1088 tcsetattr(io->fd, TCSANOW, &term);1089 1090 // our freq comes in as 358, 357 or 600 so it needs this to be in KHz for the FR command1091 freq*=10;1092 fr[1]=(unsigned char)((freq & 0xff00)>>8);1093 fr[2]=(unsigned char)(freq & 0x00ff);1094 1095 // Irdeto card supposedly need NN set to 1 .. to be confirmed1096 if(io->cardmhz == 600)1097 nn[1]=0x01;1098 1099 // send the commands1100 IO_Serial_Write (io, 0, 4, fi_di);1101 IO_Serial_Flush(io);1102 1103 IO_Serial_Write (io, 0, 3, fr);1104 IO_Serial_Flush(io);1105 1106 IO_Serial_Write (io, 0, 2, nn);1107 IO_Serial_Flush(io);1108 1109 IO_Serial_Write (io, 0, 2, pr);1110 IO_Serial_Flush(io);1111 1112 IO_Serial_Write (io, 0, 2, in);1113 IO_Serial_Flush(io);1114 1115 /* set smartreader in DATA mode */1116 tcgetattr(io->fd, &orig);1117 orig.c_cflag &= ~CSIZE;1118 orig.c_cflag |= CS8;1119 tcsetattr(io->fd, TCSANOW, &orig);1120 1121 return TRUE;1122 }1123 1052 -
trunk/csctapi/io_serial.h
r1125 r1185 108 108 extern void IO_Serial_GetPnPId (IO_Serial * io, BYTE * pnp_id, unsigned *length); 109 109 110 /* smartreader Frequency set */111 extern bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io);112 113 110 #endif /* IO_SERIAL */
Note:
See TracChangeset
for help on using the changeset viewer.