Changeset 346
- Timestamp:
- 08/29/09 12:24:21 (15 years ago)
- Location:
- branches/merlin
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/merlin/csctapi/cardterminal.c
r297 r346 72 72 } 73 73 74 char CardTerminal_Init(CardTerminal * ct, char *device, unsigned short reader_type)74 char CardTerminal_Init(CardTerminal * ct, char *device, unsigned long frequency, unsigned short reader_type) 75 75 { 76 76 char ret; … … 85 85 86 86 /* Initialise serial port */ 87 if (!IO_Serial_Init(ct->io, device, reader_type, FALSE)) {87 if (!IO_Serial_Init(ct->io, device, frequency, reader_type, FALSE)) { 88 88 IO_Serial_Delete(ct->io); 89 89 ct->io = NULL; -
branches/merlin/csctapi/cardterminal.h
r297 r346 65 65 66 66 /* Intialice a CardTerminal in a given port */ 67 extern char CardTerminal_Init(CardTerminal * ct, char *device, unsigned short reader_type);67 extern char CardTerminal_Init(CardTerminal * ct, char *device, unsigned long frequency, unsigned short reader_type); 68 68 69 69 /* Send a CT-BCS command to a CardTerminal */ -
branches/merlin/csctapi/ctapi.c
r297 r346 51 51 */ 52 52 53 char CT_init(unsigned short ctn, char *device, unsigned short reader_type)53 char CT_init(unsigned short ctn, char *device, unsigned long frequency, unsigned short reader_type) 54 54 { 55 55 CardTerminal *ct; … … 68 68 if (ct != NULL) { 69 69 /* Initialize CardTerminal */ 70 ret = CardTerminal_Init(ct, device, reader_type);70 ret = CardTerminal_Init(ct, device, frequency, reader_type); 71 71 72 72 /* Add CardTerminal to list */ -
branches/merlin/csctapi/ctapi.h
r335 r346 22 22 extern char CT_init(unsigned short Ctn, /* Terminal Number */ 23 23 char *device, /* Device Path */ 24 unsigned long frequency, /* Frequency */ 24 25 unsigned short reader_type /* Reader Type (phoenix, smartmouse, sci, smartreader+) */ 25 26 ); -
branches/merlin/csctapi/icc_async.c
r257 r346 34 34 */ 35 35 #define ICC_ASYNC_MAX_TRANSMIT 255 36 #define ICC_ASYNC_BAUDRATE 960037 36 38 37 /* … … 70 69 71 70 /* Initialize Baudrate */ 72 // if (IFD_Towitoko_SetBaudrate (ifd, ICC_ASYNC_BAUDRATE)!= IFD_TOWITOKO_OK) 73 if (IFD_Towitoko_SetBaudrate(ifd, 9600) != IFD_TOWITOKO_OK) 74 return ICC_ASYNC_IFD_ERROR; 71 // if (IFD_Towitoko_SetBaudrate(ifd, ICC_ASYNC_BAUDRATE) != IFD_TOWITOKO_OK) 72 // return ICC_ASYNC_IFD_ERROR; 75 73 76 74 /* Activate ICC */ 77 75 if (IFD_Towitoko_ActivateICC(ifd) != IFD_TOWITOKO_OK) 78 76 return ICC_ASYNC_IFD_ERROR; 77 79 78 /* Reset ICC */ 80 79 if (IFD_Towitoko_ResetAsyncICC(ifd, &(icc->atr)) != IFD_TOWITOKO_OK) { … … 117 116 118 117 /* Initialize member variables */ 119 icc->baudrate = ICC_ASYNC_BAUDRATE;120 118 icc->ifd = ifd; 119 120 if (IFD_Towitoko_GetBaudrate(ifd, &icc->baudrate) != IFD_TOWITOKO_OK) 121 return ICC_ASYNC_IFD_ERROR; 121 122 122 123 # ifdef NO_PAR_SWITCH … … 187 188 return ICC_ASYNC_IFD_ERROR; 188 189 } 189 190 /* Setup baudrate for this ICC */191 192 /* if (IFD_Towitoko_SetBaudrate (icc->ifd, icc->baudrate)!= IFD_TOWITOKO_OK)193 return ICC_ASYNC_IFD_ERROR;194 */195 190 #endif 191 192 /* Setup baudrate for this ICC */ 193 if (IFD_Towitoko_SetBaudrate(icc->ifd, icc->baudrate) != IFD_TOWITOKO_OK) 194 return ICC_ASYNC_IFD_ERROR; 195 196 196 return ICC_ASYNC_OK; 197 197 } -
branches/merlin/csctapi/ifd_towitoko.c
r340 r346 55 55 #define IFD_TOWITOKO_TIMEOUT 1000 56 56 #define IFD_TOWITOKO_DELAY 0 57 #define IFD_TOWITOKO_BAUDRATE 960058 57 #define IFD_TOWITOKO_PS 15 59 58 #define IFD_TOWITOKO_MAX_TRANSMIT 255 … … 62 61 #define IFD_TOWITOKO_ATR_TIMEOUT 800 63 62 #define IFD_TOWITOKO_ATR_MIN_LENGTH 1 64 #define IFD_TOWITOKO_CLOCK_RATE (625L * 9600L)65 //#define IFD_TOWITOKO_CLOCK_RATE (372L * 9600L)66 63 67 64 #define HI(a) (((a) & 0xff00) >> 8) … … 164 161 165 162 #ifdef DEBUG_IFD 166 printf("IFD: Initialicing slot number %d, com=%d\n", slot, io->com);163 printf("IFD: Initialicing slot number %d, device=%s\n", slot, io->device); 167 164 #endif 168 165 … … 178 175 } 179 176 180 181 177 /* Default serial port settings */ 182 props.input_bitrate = IFD_TOWITOKO_BAUDRATE;183 props.output_bitrate = IFD_TOWITOKO_BAUDRATE;178 props.input_bitrate = io->frequency / 372; 179 props.output_bitrate = io->frequency / 372; 184 180 props.bits = 8; 185 181 props.stopbits = 2; … … 203 199 ifd->type = IFD_TOWITOKO_MULTICAM; 204 200 205 ret = IFD_Towitoko_SetBaudrate(ifd, IFD_TOWITOKO_BAUDRATE);201 ret = IFD_Towitoko_SetBaudrate(ifd, io->frequency / 372); 206 202 207 203 if (ret != IFD_TOWITOKO_OK) { … … 278 274 if (props.output_bitrate == baudrate) 279 275 return IFD_TOWITOKO_OK; 280 281 276 282 277 /* Set serial device bitrate */ … … 440 435 441 436 #ifdef DEBUG_IFD 442 printf("IFD: com%d Status = %s / %s\n", ifd->io->com, IFD_TOWITOKO_CARD(status[0]) ? "card" : "no card", IFD_TOWITOKO_CHANGE(status[0]) ? "change" : "no change");437 printf("IFD: device=%s Status = %s / %s\n", ifd->io->device, IFD_TOWITOKO_CARD(status[0]) ? "card" : "no card", IFD_TOWITOKO_CHANGE(status[0]) ? "change" : "no change"); 443 438 #endif 444 439 … … 852 847 unsigned long IFD_Towitoko_GetClockRate(IFD * ifd) 853 848 { 854 return IFD_TOWITOKO_CLOCK_RATE;849 return ifd->io->frequency; 855 850 } 856 851 -
branches/merlin/csctapi/io_serial.c
r342 r346 71 71 static void IO_Serial_ClearPropertiesCache(IO_Serial * io); 72 72 73 extern int reader_serial_mhz; 74 extern int reader_serial_irdeto_mode; 73 static bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io); 75 74 76 75 static int _in_echo_read = 0; … … 89 88 *oscam_sem = 0; 90 89 else 91 while (*oscam_sem != io-> com) {90 while (*oscam_sem != io->reader_type) { 92 91 while (*oscam_sem) 93 usleep(( io->com) * 2000);94 *oscam_sem = io-> com;92 usleep(() * 2000); 93 *oscam_sem = io->reader_type; 95 94 usleep(1000); 96 95 } … … 174 173 } 175 174 176 bool IO_Serial_Init(IO_Serial * io, char *device, unsigned short reader_type, bool pnp)177 { 178 #ifdef DEBUG_IO 179 printf("IO: Opening serial port %s\n", io->device);175 bool IO_Serial_Init(IO_Serial * io, char *device, unsigned long frequency, unsigned short reader_type, bool pnp) 176 { 177 #ifdef DEBUG_IO 178 printf("IO: Opening serial port %s\n", device); 180 179 #endif 181 180 182 181 memcpy(io->device, device, sizeof(io->device)); 182 io->frequency = frequency; 183 183 io->reader_type = reader_type; 184 184 … … 206 206 #endif 207 207 208 if (reader_type != RTYP_SCI) 209 IO_Serial_InitPnP(io); 210 211 if (reader_type != RTYP_SCI) 212 IO_Serial_Flush(io); 208 if (reader_type != RTYP_SCI) { 209 if (pnp) 210 IO_Serial_InitPnP(io); 211 } 213 212 214 213 return TRUE; … … 437 436 break; 438 437 } 438 439 /* Check for custom bitrate */ 440 #ifdef OS_LINUX 441 if (props->input_bitrate == 38400 && props->output_bitrate == 38400) { 442 struct serial_struct s; 443 if (ioctl(io->fd, TIOCGSERIAL, &s) >= 0) { 444 if ((s.flags & ASYNC_SPD_CUST) != 0) { 445 unsigned long effective_bitrate = (unsigned long) s.baud_base / s.custom_divisor; 446 props->input_bitrate = effective_bitrate; 447 props->output_bitrate = effective_bitrate; 448 } 449 } 450 } 451 #endif 439 452 440 453 switch (currtio.c_cflag & CSIZE) { … … 485 498 { 486 499 struct termios newtio; 487 // unsigned int modembits;488 500 489 501 #ifdef SCI_DEV … … 492 504 #endif 493 505 494 // printf("IO: Setting properties: com%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->com, props->input_bitrate, props->bits, props->parity == IO_SERIAL_PARITY_EVEN ? "Even" : props->parity == IO_SERIAL_PARITY_ODD ? "Odd" : "None", props->stopbits, props->dtr, props->rts);495 506 memset(&newtio, 0, sizeof (newtio)); 507 496 508 /* Set the bitrate */ 509 #ifdef DEBUG_IO 510 printf("IO: Optimal bitrate should be = %lu\n", props->output_bitrate); 511 #endif 512 #ifdef OS_LINUX 513 /* Check if the bitrate is not a standard value */ 514 if (props->output_bitrate != props->input_bitrate || (props->output_bitrate == 230400 || props->output_bitrate == 115200 || props->output_bitrate == 57600 || props->output_bitrate == 38400 || props->output_bitrate == 19200 || props->output_bitrate == 9600 || props->output_bitrate == 4800 || props->output_bitrate == 2400 || props->output_bitrate == 1800 || props->output_bitrate == 1200 || props->output_bitrate == 600 || props->output_bitrate == 300 || props->output_bitrate == 200 || props->output_bitrate == 150 || props->output_bitrate == 134 || props->output_bitrate == 110 || props->output_bitrate == 75 || props->output_bitrate == 50 || props->output_bitrate == 0)) { 515 # ifdef DEBUG_IO 516 printf("IO: Using standard bitrate of %lu\n", props->output_bitrate); 517 # endif 518 #endif 519 /* Standard bitrate */ 520 cfsetospeed(&newtio, IO_Serial_Bitrate(props->output_bitrate)); 521 cfsetispeed(&newtio, IO_Serial_Bitrate(props->input_bitrate)); 522 #ifdef OS_LINUX 523 } else { 524 /* Special bitrate : these structures are only available on linux as fas as we know so limit this code to OS_LINUX */ 525 unsigned long standard_bitrate = props->output_bitrate; 526 527 struct serial_struct s; 528 if (ioctl(io->fd, TIOCGSERIAL, &s) >= 0) { 529 unsigned long wanted_bitrate = props->output_bitrate; 530 unsigned long custom_divisor = ((unsigned long) s.baud_base + (wanted_bitrate / 2)) / wanted_bitrate; 531 unsigned long effective_bitrate = (unsigned long) s.baud_base / custom_divisor; 532 533 /* Check if a custom_divisor is needed */ 534 if (effective_bitrate == 230400 || effective_bitrate == 115200 || effective_bitrate == 57600 || effective_bitrate == 38400 || effective_bitrate == 19200 || effective_bitrate == 9600 || effective_bitrate == 4800 || effective_bitrate == 2400 || effective_bitrate == 1800 || effective_bitrate == 1200 || effective_bitrate == 600 || effective_bitrate == 300 || effective_bitrate == 200 || effective_bitrate == 150 || effective_bitrate == 134 || effective_bitrate == 110 || effective_bitrate == 75 || effective_bitrate == 50 || effective_bitrate == 0) { 535 /* Use standard bitrate value */ 536 if ((s.flags & ASYNC_SPD_CUST) != 0) { 537 s.flags |= ASYNC_SPD_MASK; 538 s.flags &= ~ASYNC_SPD_CUST; 539 ioctl(io->fd, TIOCSSERIAL, &s); 540 } 541 standard_bitrate = effective_bitrate; 542 #ifdef DEBUG_IO 543 printf("IO: Using standard bitrate of %lu (baud_base too small)\n", standard_bitrate); 544 #endif 545 } else { 546 /* Use custom divisor */ 547 s.custom_divisor = custom_divisor; 548 s.flags &= ~ASYNC_SPD_MASK; 549 s.flags |= ASYNC_SPD_CUST; 550 if (ioctl(io->fd, TIOCSSERIAL, &s) >= 0) { 551 standard_bitrate = 38400; 552 } 553 #ifdef DEBUG_IO 554 printf("IO: Using special bitrate of = %lu (%+.2f%% off)\n", effective_bitrate, ((double) (effective_bitrate - wanted_bitrate)) / wanted_bitrate); 555 #endif 556 } 557 } 558 559 /* Set the standard bitrate value */ 560 cfsetospeed(&newtio, IO_Serial_Bitrate(standard_bitrate)); 561 cfsetispeed(&newtio, IO_Serial_Bitrate(standard_bitrate)); 562 } 563 #endif 497 564 498 565 if (io->reader_type == RTYP_SMARTREADER) { 499 566 #ifdef DEBUG_IO 500 printf("IO: SMARTREADER .. switching to frequency to %2.2fMHz\n", (float) reader_serial_mhz / 100.0);501 #endif 502 if (!IO_Serial_Set_Smartreader_Freq(io , reader_serial_mhz, reader_serial_irdeto_mode)) {503 #ifdef DEBUG_IO 504 printf("IO: SMARTREADER .. ERROR switching to %2.2fMHz\n", (float) reader_serial_mhz / 100.0);567 printf("IO: SMARTREADER .. switching to frequency to %2.2fMHz\n", (float) io->frequency / 1000000); 568 #endif 569 if (!IO_Serial_Set_Smartreader_Freq(io)) { 570 #ifdef DEBUG_IO 571 printf("IO: SMARTREADER .. ERROR switching to %2.2fMHz\n", (float) io->frequency / 1000000); 505 572 #endif 506 573 return FALSE; 507 574 } 508 }509 510 if (reader_serial_mhz == 600) {511 /* for 6MHz */512 if (reader_serial_irdeto_mode) {513 cfsetospeed(&newtio, IO_Serial_Bitrate(props->output_bitrate));514 cfsetispeed(&newtio, IO_Serial_Bitrate(props->input_bitrate));515 } else {516 #ifdef OS_LINUX517 /* these structures are only available on linux as fas as we know so limit this code to OS_LINUX */518 struct serial_struct nuts;519 520 ioctl(io->fd, TIOCGSERIAL, &nuts);521 nuts.custom_divisor = nuts.baud_base / (9600 * 6 / 3.57);522 nuts.flags &= ~ASYNC_SPD_MASK;523 nuts.flags |= ASYNC_SPD_CUST;524 ioctl(io->fd, TIOCSSERIAL, &nuts);525 cfsetospeed(&newtio, IO_Serial_Bitrate(38400));526 cfsetispeed(&newtio, IO_Serial_Bitrate(38400));527 #else528 cfsetospeed(&newtio, IO_Serial_Bitrate(props->output_bitrate));529 cfsetispeed(&newtio, IO_Serial_Bitrate(props->input_bitrate));530 #endif531 }532 } else if (reader_serial_mhz == 357 || reader_serial_mhz == 358) {533 /* for 3.57 MHz */534 if (reader_serial_irdeto_mode) {535 #ifdef OS_LINUX536 /* these structures are only available on linux as fas as we know so limit this code to OS_LINUX */537 struct serial_struct nuts;538 539 ioctl(io->fd, TIOCGSERIAL, &nuts);540 nuts.custom_divisor = nuts.baud_base / (9600 * 3.57 / 6);541 nuts.flags &= ~ASYNC_SPD_MASK;542 nuts.flags |= ASYNC_SPD_CUST;543 ioctl(io->fd, TIOCSSERIAL, &nuts);544 cfsetospeed(&newtio, IO_Serial_Bitrate(38400));545 cfsetispeed(&newtio, IO_Serial_Bitrate(38400));546 #else547 cfsetospeed(&newtio, IO_Serial_Bitrate(props->output_bitrate));548 cfsetispeed(&newtio, IO_Serial_Bitrate(props->input_bitrate));549 #endif550 } else {551 cfsetospeed(&newtio, IO_Serial_Bitrate(props->output_bitrate));552 cfsetispeed(&newtio, IO_Serial_Bitrate(props->input_bitrate));553 }554 } else if (reader_serial_mhz == 1000) {555 /* for 10 MHz */556 if (reader_serial_irdeto_mode) {557 cfsetospeed(&newtio, IO_Serial_Bitrate(props->output_bitrate));558 cfsetispeed(&newtio, IO_Serial_Bitrate(props->input_bitrate));559 } else {560 #ifdef OS_LINUX561 /* these structures are only available on linux as fas as we know so limit this code to OS_LINUX */562 struct serial_struct nuts;563 564 ioctl(io->fd, TIOCGSERIAL, &nuts);565 nuts.custom_divisor = nuts.baud_base / (9600 * 10 / 6);566 nuts.flags &= ~ASYNC_SPD_MASK;567 nuts.flags |= ASYNC_SPD_CUST;568 ioctl(io->fd, TIOCSSERIAL, &nuts);569 cfsetospeed(&newtio, IO_Serial_Bitrate(38400));570 cfsetispeed(&newtio, IO_Serial_Bitrate(38400));571 #else572 cfsetospeed(&newtio, IO_Serial_Bitrate(props->output_bitrate));573 cfsetispeed(&newtio, IO_Serial_Bitrate(props->input_bitrate));574 #endif575 }576 } else {577 /* invalid */578 return FALSE;579 575 } 580 576 … … 654 650 655 651 #ifdef DEBUG_IO 656 printf("IO: Setting properties: com%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->com, props->input_bitrate, props->bits, props->parity == IO_SERIAL_PARITY_EVEN ? "Even" : props->parity == IO_SERIAL_PARITY_ODD ? "Odd" : "None", props->stopbits, props->dtr, 657 props->rts); 652 printf("IO: Setting properties: device=%s, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->device, props->input_bitrate, props->bits, props->parity == IO_SERIAL_PARITY_EVEN ? "Even" : props->parity == IO_SERIAL_PARITY_ODD ? "Odd" : "None", props->stopbits, props->dtr, props->rts); 658 653 #endif 659 654 return TRUE; … … 1068 1063 int i = 0; 1069 1064 1070 props.input_bitrate = 9600;1071 props.output_bitrate = 9600;1065 props.input_bitrate = io->frequency / 372; 1066 props.output_bitrate = io->frequency / 372; 1072 1067 props.parity = IO_SERIAL_PARITY_NONE; 1073 1068 props.bits = 8; … … 1092 1087 } 1093 1088 1094 1095 bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io, int freq, int irdeto_mode) 1089 static bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io) 1096 1090 { 1097 1091 struct termios term; … … 1114 1108 tcsetattr(io->fd, TCSANOW, &term); 1115 1109 1116 // our freq comes in as 358, 357 or 600 soit needs this to be in KHz for the FR command1117 freq *= 10;1110 // our freq comes in as Hz and it needs this to be in KHz for the FR command 1111 unsigned long freq = io->frequency / 1000; 1118 1112 fr[1] = (unsigned char) ((freq & 0xff00) >> 8); 1119 1113 fr[2] = (unsigned char) (freq & 0x00ff); 1120 1114 1121 1115 // Irdeto card supposedly need NN set to 1 .. to be confirmed 1122 if (irdeto_mode) 1116 // if (irdeto_mode) TODO: use NN from ATR 1123 1117 nn[1] = 0x01; 1124 1118 -
branches/merlin/csctapi/io_serial.h
r297 r346 67 67 /* IO_Serial exported datatype */ 68 68 typedef struct { 69 int fd; /* Handle of the serial device */69 int fd; /* Handle of the serial device */ 70 70 IO_Serial_Properties *props; 71 71 BYTE PnP_id[IO_SERIAL_PNPID_SIZE]; /* PnP Id of the serial device */ 72 unsigned PnP_id_size; /* Length of PnP Id */ 73 char device[128]; /* Device path */ 74 int reader_type; /* Reader type */ 72 unsigned PnP_id_size; /* Length of PnP Id */ 73 char device[128]; /* Device path */ 74 int reader_type; /* Reader type */ 75 unsigned long frequency; /* Frequency (Hz) */ 75 76 int wr; 76 77 } IO_Serial; … … 87 88 88 89 /* Initialization and closing */ 89 extern bool IO_Serial_Init(IO_Serial * io, char *device, unsigned short reader_type, bool pnp);90 extern bool IO_Serial_Init(IO_Serial * io, char *device, unsigned long frequency, unsigned short reader_type, bool pnp); 90 91 extern bool IO_Serial_Close(IO_Serial * io); 91 92 … … 108 109 extern void IO_Serial_GetPnPId(IO_Serial * io, BYTE * pnp_id, unsigned *length); 109 110 110 /* smartreader Frequency set */111 extern bool IO_Serial_Set_Smartreader_Freq(IO_Serial * io, int freq, int irdeto_mode);112 113 111 #endif /* IO_SERIAL */ -
branches/merlin/include/globals.h
r335 r346 320 320 321 321 int detect; 322 int mhz; 323 int custom_speed; 322 unsigned long frequency; 324 323 325 324 int online; -
branches/merlin/src/CAM/videoguard.c
r337 r346 4 4 5 5 #include "log.h" 6 7 #include <fcntl.h>8 #include <termios.h>9 #include <sys/ioctl.h>10 11 #ifdef OS_LINUX12 # include <linux/serial.h> // ULGY : to be merged into csctapi13 #endif14 6 15 7 #define MAX_ATR_LEN 33 // max. ATR length … … 623 615 } 624 616 625 #ifdef OS_LINUX626 # ifndef TUXBOX627 int bconst = B38400;628 int baud = 64516;629 int fd = open(reader[ridx].device, O_RDWR | O_NONBLOCK | O_NOCTTY);630 631 struct termios tio;632 633 memset(&tio, 0, sizeof (tio));634 tio.c_cflag = (CS8 | CREAD | HUPCL | CLOCAL);635 tio.c_cflag |= CSTOPB;636 tio.c_iflag = (INPCK | BRKINT);637 tio.c_cc[VMIN] = 1;638 cfsetispeed(&tio, bconst);639 cfsetospeed(&tio, bconst);640 tio.c_cflag |= (PARENB | PARODD);641 642 struct serial_struct s;643 644 if (ioctl(fd, TIOCGSERIAL, &s) < 0) {645 cs_log("%s: get serial failed: %s", reader[ridx].device, strerror(errno));646 return 0;647 }648 if (!tcsetattr(fd, TCSANOW, &tio)) {649 if (reader[ridx].custom_speed) {650 s.custom_divisor = (s.baud_base + (baud / 2)) / baud;651 s.flags = (s.flags & ~ASYNC_SPD_MASK) | ASYNC_SPD_CUST;652 cs_log("%s: custom: baud_base=%d baud=%d divisor=%d -> effective baudrate %d (%+.2f%% off)", reader[ridx].device, s.baud_base, baud, s.custom_divisor, s.baud_base / s.custom_divisor, (float) (s.baud_base / s.custom_divisor - baud) / (float) baud);653 } else {654 s.flags &= ~ASYNC_SPD_CUST;655 cs_log("%s: baud=%d", reader[ridx].device, 38400);656 }657 if (ioctl(fd, TIOCSSERIAL, &s) < 0) {658 cs_log("%s: set serial failed: %s", reader[ridx].device, strerror(errno));659 return 0;660 }661 } else {662 cs_log("%s: tcsetattr failed: %s", reader[ridx].device, strerror(errno));663 return 0;664 }665 # endif666 #endif667 668 617 unsigned char ins7401[5] = { 0xD0, 0x74, 0x01, 0x00, 0x00 }; 669 618 int l; -
branches/merlin/src/config.c
r335 r346 1107 1107 rdr->detect = i | 0x80; 1108 1108 } 1109 if (!strcmp(token, "mhz")) { 1110 if (!strcmp(value, "1000")) 1111 rdr->mhz = 1000; 1112 if (!strcmp(value, "600")) 1113 rdr->mhz = 600; 1114 if (!strcmp(value, "357")) 1115 rdr->mhz = 357; 1116 if (!strcmp(value, "358")) 1117 rdr->mhz = 358; 1118 } 1119 if (!strcmp(token, "customspeed")) { 1120 if (!strcmp(value, "0")) 1121 rdr->custom_speed = 0; 1122 if (!strcmp(value, "1")) 1123 rdr->custom_speed = 1; 1109 if (!strcmp(token, "frequency")) { 1110 char *endptr; 1111 double mhz = strtod(value, &endptr); 1112 if (*endptr == '\0') { 1113 rdr->frequency = mhz * 1000000; 1114 } 1124 1115 } 1125 1116 if (!strcmp(token, "protocol")) { … … 1223 1214 reader[nr].show_cls = 10; 1224 1215 reader[nr].maxqlen = CS_MAXQLEN; 1225 reader[nr].mhz = 357; 1226 reader[nr].custom_speed = 1; 1216 reader[nr].frequency = 3571200; 1227 1217 strcpy(reader[nr].pincode, "none"); 1228 1218 for (i = 1; i < CS_MAXCAIDTAB; reader[nr].ctab.mask[i++] = 0xffff); -
branches/merlin/src/oscam.c
r341 r346 572 572 else { 573 573 if (reader[ridx].type == R_PHOENIX || reader[ridx].type == R_SMARTMOUSE || reader[ridx].type == R_SMARTREADER) 574 cs_log("reader started (pid=%d, device=%s, detect=%s%s, mhz=%d)", pid, reader[ridx].device, reader[ridx].detect & 0x80 ? "!" : "", RDR_CD_TXT[reader[ridx].detect & 0x7f], reader[ridx].mhz);574 cs_log("reader started (pid=%d, device=%s, detect=%s%s, frequency=%2.2fMHz)", pid, reader[ridx].device, reader[ridx].detect & 0x80 ? "!" : "", RDR_CD_TXT[reader[ridx].detect & 0x7f], (float) reader[ridx].frequency / 1000000); 575 575 else 576 576 cs_log("reader started (pid=%d, device=%s)", pid, reader[ridx].device); -
branches/merlin/src/reader/serial.c
r337 r346 12 12 #define CTAPI_CTN 1 13 13 14 int reader_serial_irdeto_mode; // UGLY : to be removed15 14 int reader_serial_card_detect; // UGLY : to be removed 16 int reader_serial_mhz; // UGLY : to be removed17 15 int reader_serial_need_dummy_char; // UGLY : to be removed 18 16 … … 115 113 // Set some extern variables to be used by CT-API 116 114 reader_serial_card_detect = reader->detect; 117 reader_serial_mhz = reader->mhz;118 115 119 116 // Save and Change cs_ptyp … … 123 120 // Lookup Port Number 124 121 ushort reader_type = reader_serial_get_reader_type(reader); 125 if ((ret = CT_init(CTAPI_CTN, reader->device, reader _type)) != OK) {122 if ((ret = CT_init(CTAPI_CTN, reader->device, reader->frequency, reader_type)) != OK) { 126 123 cs_log("Reader: Cannot open device \"%s\" (%d) !", reader->device, ret); 127 124 } … … 189 186 /* Try to get ATR from card */ 190 187 for (i = 0; i < 3; i++) { 191 reader_serial_irdeto_mode = (i % 2);192 193 188 /* Request ICC */ 194 189 cmd[0] = CTBCS_CLA;
Note:
See TracChangeset
for help on using the changeset viewer.