- Timestamp:
- 01/13/10 19:52:44 (14 years ago)
- Location:
- branches/smartreader
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/smartreader/csctapi/cardterminal.c
r1186 r1211 71 71 } 72 72 73 char CardTerminal_Init (CardTerminal * ct, unsigned short pn,int reader_type, int mhz, int cardmhz)73 char CardTerminal_Init (CardTerminal * ct, int reader_type, int mhz, int cardmhz) 74 74 { 75 75 char ret; 76 76 int i; 77 bool usbserial;78 77 79 78 /* Create a new IO_Serial */ 80 ct->io = IO_Serial_New ( reader_type,mhz, cardmhz);79 ct->io = IO_Serial_New (mhz, cardmhz); 81 80 82 81 /* Memory error */ … … 84 83 return ERR_MEMORY; 85 84 86 /*87 * Handle USB port numbers: first USB serial port starts at 0x8000,88 * 0x8001 if CTAPI_WIN32_COM is set89 */90 if ((pn & 0x8000) == 0x8000)91 {92 usbserial = TRUE;93 pn &= 0x7FFF;94 }95 else96 {97 usbserial = FALSE;98 }99 100 85 /* Initialise serial port */ 101 if (!IO_Serial_Init (ct->io, pn + 1, usbserial))86 if (!IO_Serial_Init (ct->io, reader_type)) 102 87 { 103 88 free (ct->io); -
branches/smartreader/csctapi/cardterminal.h
r1186 r1211 68 68 /* Intialice a CardTerminal in a given port */ 69 69 extern char 70 CardTerminal_Init (CardTerminal * ct, unsigned short pn,int reader_type, int mhz, int cardmhz);70 CardTerminal_Init (CardTerminal * ct, int reader_type, int mhz, int cardmhz); 71 71 72 72 /* Send a CT-BCS command to a CardTerminal */ -
branches/smartreader/csctapi/ctapi.c
r636 r1211 50 50 */ 51 51 52 char CT_init (unsigned short ctn, unsigned short pn,int reader_type, int mhz, int cardmhz)52 char CT_init (unsigned short ctn, int reader_type, int mhz, int cardmhz) 53 53 { 54 54 CardTerminal *ct; … … 69 69 { 70 70 /* Initialize CardTerminal */ 71 ret = CardTerminal_Init (ct, pn,reader_type, mhz, cardmhz);71 ret = CardTerminal_Init (ct, reader_type, mhz, cardmhz); 72 72 73 73 /* Add CardTerminal to list */ -
branches/smartreader/csctapi/ctapi.h
r636 r1211 21 21 extern char CT_init ( 22 22 unsigned short Ctn, /* Terminal Number */ 23 unsigned short pn, /* Port Number */24 23 int reader_type, /* reader type (mouse, smartreader) */ 25 24 int mhz, … … 49 48 #define ERR_HTSI -128 /* HTSI Error */ 50 49 51 #define PORT_COM1 0 /* COM 1 */52 #define PORT_COM2 1 /* COM 2 */53 #define PORT_COM3 2 /* COM 3 */54 #define PORT_COM4 3 /* COM 4 */55 #define PORT_Printer 4 /* Printer Port (MAC) */56 #define PORT_Modem 5 /* Modem Port (MAC) */57 #define PORT_LPT1 6 /* LPT 1 */58 #define PORT_LPT2 7 /* LPT 2 */59 60 50 /* #define DAD */ 61 51 #define CARD 0 62 52 #define CT 1 63 53 #define HOST 2 64 65 /* #define port-types */66 #define PORT_STD PORT_COM167 #define PORT_SCI PORT_COM268 #define PORT_DB2COM1 PORT_COM369 #define PORT_DB2COM2 PORT_COM470 54 71 55 #ifdef __cplusplus -
branches/smartreader/csctapi/defines.h
r958 r1211 89 89 #endif 90 90 91 #define RTYP_STD 192 #define RTYP_SCI 293 #define RTYP_DB2COM1 394 #define RTYP_DB2COM2 495 #define RTYP_SMART 596 91 #endif /* DEFINES_H */ -
branches/smartreader/csctapi/icc_async.c
r1186 r1211 78 78 return ICC_ASYNC_IFD_ERROR; 79 79 /* Reset ICC */ 80 #ifdef SCI_DEV 81 if (ifd->io->reader_type == R_INTERNAL) { 82 if (!Sci_Reset(ifd, &(icc->atr))) 83 { 84 icc->atr = NULL; 85 return ICC_ASYNC_IFD_ERROR; 86 } 87 } 88 else 89 #endif 80 90 #ifdef COOL 81 if (ifd->io-> com == RTYP_SCI) {91 if (ifd->io->reader_type == R_INTERNAL) { 82 92 if (!Cool_Reset(&(icc->atr))) 83 93 { … … 149 159 } 150 160 #ifdef COOL 151 if (icc->ifd->io-> com != RTYP_SCI)161 if (icc->ifd->io->reader_type != R_INTERNAL) 152 162 #endif 153 163 IO_Serial_Flush(ifd->io); … … 174 184 #include "sci_global.h" 175 185 #include "sci_ioctl.h" 176 if (icc->ifd->io-> com == RTYP_SCI) {186 if (icc->ifd->io->reader_type == R_INTERNAL) { 177 187 SCI_PARAMETERS params; 178 188 if (ioctl(icc->ifd->io->fd, IOCTL_GET_PARAMETERS, ¶ms) < 0 ) … … 213 223 icc->baudrate = baudrate; 214 224 /*#ifdef COOL 215 if (icc->ifd->io-> com==RTYP_SCI) {225 if (icc->ifd->io->reader_type==R_INTERNAL) { 216 226 typedef unsigned long u_int32; 217 227 u_int32 clk; … … 271 281 IFD_Timings timings; 272 282 273 if (icc->convention == ATR_CONVENTION_INVERSE && icc->ifd->io-> com!=RTYP_SCI)283 if (icc->convention == ATR_CONVENTION_INVERSE && icc->ifd->io->reader_type != R_INTERNAL) 274 284 { 275 285 buffer = (BYTE *) calloc(sizeof (BYTE), size); … … 287 297 288 298 #ifdef COOL 289 if (icc->ifd->io-> com == RTYP_SCI) {299 if (icc->ifd->io->reader_type == R_INTERNAL) { 290 300 if (!Cool_Transmit(sent, size)) 291 301 return ICC_ASYNC_IFD_ERROR; … … 310 320 311 321 #ifdef COOL 312 if (icc->ifd->io-> com == RTYP_SCI) {322 if (icc->ifd->io->reader_type == R_INTERNAL) { 313 323 if (!Cool_Receive(data, size)) 314 324 return ICC_ASYNC_IFD_ERROR; … … 320 330 #endif 321 331 322 if (icc->convention == ATR_CONVENTION_INVERSE && icc->ifd->io-> com!=RTYP_SCI)332 if (icc->convention == ATR_CONVENTION_INVERSE && icc->ifd->io->reader_type!=R_INTERNAL) 323 333 ICC_Async_InvertBuffer (size, data); 324 334 -
branches/smartreader/csctapi/ifd_towitoko.c
r1197 r1211 48 48 #include "sci_ioctl.h" 49 49 #include "ifd.h" 50 #include "../globals.h" 50 51 51 52 /* … … 163 164 164 165 #ifdef DEBUG_IFD 165 printf ("IFD: Initializing slot number %d, com=%d\n", slot, io-> com);166 printf ("IFD: Initializing slot number %d, com=%d\n", slot, io->reader_type); 166 167 #endif 167 168 … … 170 171 return IFD_TOWITOKO_PARAM_ERROR; 171 172 172 if(io-> com==RTYP_SCI)173 if(io->reader_type==R_INTERNAL) 173 174 { 174 175 ifd->io = io; … … 259 260 int IFD_Towitoko_SetBaudrate (IFD * ifd, unsigned long baudrate) 260 261 { 261 if(ifd->io-> com==RTYP_SCI)262 if(ifd->io->reader_type==R_INTERNAL) 262 263 { 263 264 return IFD_TOWITOKO_OK; … … 295 296 int IFD_Towitoko_GetBaudrate (IFD * ifd, unsigned long *baudrate) 296 297 { 297 if(ifd->io-> com==RTYP_SCI)298 if(ifd->io->reader_type==R_INTERNAL) 298 299 { 299 300 return IFD_TOWITOKO_OK; … … 311 312 extern int IFD_Towitoko_SetParity (IFD * ifd, BYTE parity) 312 313 { 313 if(ifd->io-> com==RTYP_SCI)314 if(ifd->io->reader_type==R_INTERNAL) 314 315 { 315 316 return IFD_TOWITOKO_OK; … … 356 357 357 358 #ifdef SCI_DEV 358 if(ifd->io-> com==RTYP_SCI)359 { 360 if( ioctl(ifd->io->fd, IOCTL_GET_IS_CARD_PRESENT, &in)<0)359 if(ifd->io->reader_type==R_INTERNAL) 360 { 361 if(!Sci_GetStatus(ifd->io->fd, &in)) 361 362 return IFD_TOWITOKO_IO_ERROR; 362 363 } 363 364 else 364 365 #elif COOL 365 if(ifd->io-> com==RTYP_SCI)366 if(ifd->io->reader_type==R_INTERNAL) 366 367 { 367 368 if (!Cool_GetStatus(&in)) … … 372 373 373 374 #if defined(TUXBOX) && defined(PPC) 374 if ((ifd->io-> com==RTYP_DB2COM1) || (ifd->io->com==RTYP_DB2COM2))375 if ((ifd->io->reader_type==R_DB2COM1) || (ifd->io->reader_type==R_DB2COM2)) 375 376 { 376 377 ushort msr=1; … … 378 379 IO_Serial_Ioctl_Lock(ifd->io, 1); 379 380 ioctl(fdmc, GET_PCDAT, &msr); 380 if (ifd->io-> com==RTYP_DB2COM2)381 if (ifd->io->reader_type==R_DB2COM2) 381 382 in=(!(msr & 1)); 382 383 else … … 458 459 459 460 #ifdef DEBUG_IFD 460 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");461 printf ("IFD: com%d Status = %s / %s\n", ifd->io->reader_type, IFD_TOWITOKO_CARD(status[0])? "card": "no card", IFD_TOWITOKO_CHANGE(status[0])? "change": "no change"); 461 462 #endif 462 463 … … 470 471 #endif 471 472 #ifdef SCI_DEV 472 if(ifd->io-> com==RTYP_SCI)473 if(ifd->io->reader_type==R_INTERNAL) 473 474 { 474 475 int in; … … 508 509 509 510 #ifdef SCI_DEV 510 if(ifd->io-> com==RTYP_SCI)511 if(ifd->io->reader_type==R_INTERNAL) 511 512 { 512 513 int in; … … 541 542 #endif 542 543 543 #ifdef SCI_DEV544 if(ifd->io->com==RTYP_SCI)545 {546 unsigned char buf[SCI_MAX_ATR_SIZE];547 int n = 0;548 SCI_PARAMETERS params;549 #ifdef SH4550 struct timeval tv, tv_spent;551 int atr_size = 2, TDi_exists = 0;552 #endif553 554 (*atr) = NULL;555 556 #ifdef SH4557 memset(¶ms,0,sizeof(SCI_PARAMETERS));558 559 params.ETU = 372;560 params.EGT = 3;561 params.fs = 9;562 params.T = 0;563 564 if(ioctl(ifd->io->fd, IOCTL_SET_PARAMETERS, ¶ms)!=0)565 return IFD_TOWITOKO_IO_ERROR;566 #endif567 568 if(ioctl(ifd->io->fd, IOCTL_SET_RESET)<0)569 return IFD_TOWITOKO_IO_ERROR;570 571 #ifdef SH4572 gettimeofday(&tv,0);573 memcpy(&tv_spent,&tv,sizeof(struct timeval));574 575 while(n<atr_size && (tv_spent.tv_sec-tv.tv_sec)<10)576 {577 if(IO_Serial_Read(ifd->io, IFD_TOWITOKO_ATR_TIMEOUT, 1, buf+n))578 n++;579 gettimeofday(&tv_spent,0);580 if(n==2) // format character581 {582 // high nibble = TA1 , TB1 , TC1 , TD1583 if(buf[n-1] & 0x10)584 atr_size++;585 if(buf[n-1] & 0x20)586 atr_size++;587 if(buf[n-1] & 0x40)588 atr_size++;589 if(buf[n-1] & 0x80)590 {591 atr_size++;592 TDi_exists=atr_size;593 }594 atr_size+=(buf[n-1] & 0x0F); // historical bytes595 }596 if( (TDi_exists>0) && (n==TDi_exists) )597 {598 TDi_exists=0;599 // high nibble = TA1 , TB1 , TC1 , TD1600 if(buf[n-1] & 0x10)601 atr_size++;602 if(buf[n-1] & 0x20)603 atr_size++;604 if(buf[n-1] & 0x40)605 atr_size++;606 if(buf[n-1] & 0x80)607 {608 atr_size++;609 TDi_exists=atr_size;610 }611 }612 }613 #else614 while(n<SCI_MAX_ATR_SIZE && IO_Serial_Read(ifd->io, IFD_TOWITOKO_ATR_TIMEOUT, 1, buf+n))615 {616 n++;617 }618 #endif619 620 if(n==0)621 return IFD_TOWITOKO_IO_ERROR;622 623 if ((buf[0] !=0x3B) && (buf[0] != 0x3F)) //irdeto S02 reports FD as first byte ?!?624 buf[0] = 0x3B;625 626 (*atr) = ATR_New ();627 if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK)628 {629 struct timespec req_ts;630 req_ts.tv_sec = 0;631 req_ts.tv_nsec = 50000000;632 nanosleep (&req_ts, NULL);633 if (ioctl(ifd->io->fd, IOCTL_SET_ATR_READY)<0)634 return IFD_TOWITOKO_IO_ERROR;635 return IFD_TOWITOKO_OK;636 }637 else638 {639 ATR_Delete (*atr);640 (*atr) = NULL;641 return IFD_TOWITOKO_IO_ERROR;642 }643 }644 else645 #endif646 {647 544 int ret; 648 545 int parity; … … 734 631 735 632 return ret; 736 }737 633 } 738 634 -
branches/smartreader/csctapi/io_serial.c
r1186 r1211 79 79 { 80 80 extern int *oscam_sem; 81 if ((io-> com!=RTYP_DB2COM1) && (io->com!=RTYP_DB2COM2)) return;81 if ((io->reader_type!=R_DB2COM1) && (io->reader_type!=R_DB2COM2)) return; 82 82 if (!flag) 83 83 *oscam_sem=0; 84 else while (*oscam_sem!=io-> com)84 else while (*oscam_sem!=io->reader_type) 85 85 { 86 86 while (*oscam_sem) 87 usleep((io-> com)*2000);88 *oscam_sem=io-> com;87 usleep((io->reader_type)*2000); 88 *oscam_sem=io->reader_type; 89 89 usleep(1000); 90 90 } … … 136 136 137 137 #if defined(TUXBOX) && defined(PPC) 138 if ((io-> com==RTYP_DB2COM1) || (io->com==RTYP_DB2COM2))139 return(IO_Serial_DTR_RTS_dbox2(io-> com==RTYP_DB2COM2, dtr, set));138 if ((io->reader_type==R_DB2COM1) || (io->reader_type==R_DB2COM2)) 139 return(IO_Serial_DTR_RTS_dbox2(io->reader_type==R_DB2COM2, dtr, set)); 140 140 #endif 141 141 … … 159 159 */ 160 160 161 IO_Serial * IO_Serial_New (int reader_type, intmhz, int cardmhz)161 IO_Serial * IO_Serial_New (int mhz, int cardmhz) 162 162 { 163 163 IO_Serial *io; … … 168 168 IO_Serial_Clear (io); 169 169 170 io->reader_type=reader_type;171 170 io->mhz=mhz; 172 171 io->cardmhz=cardmhz; … … 175 174 } 176 175 177 bool IO_Serial_Init (IO_Serial * io, unsigned com, bool usbserial)176 bool IO_Serial_Init (IO_Serial * io, int reader_type) 178 177 { 179 178 char filename[IO_SERIAL_FILENAME_LENGTH]; … … 185 184 #endif 186 185 187 if (com < 1) 188 return FALSE; 189 190 io->com = com; 186 io->reader_type = reader_type; 191 187 192 188 #if defined(SCI_DEV) || defined(COOL) 193 if ( com==RTYP_SCI)189 if (reader_type==R_INTERNAL) 194 190 #ifdef SH4 195 191 io->fd = open (filename, O_RDWR|O_NONBLOCK|O_NOCTTY); … … 216 212 217 213 #if defined(TUXBOX) && defined(PPC) 218 if (( com==RTYP_DB2COM1) || (com==RTYP_DB2COM2))214 if ((reader_type == R_DB2COM1) || (reader_type == R_DB2COM2)) 219 215 if ((fdmc = open(DEV_MULTICAM, O_RDWR)) < 0) 220 216 { … … 224 220 #endif 225 221 226 if ( com!=RTYP_SCI)222 if (reader_type != R_INTERNAL) 227 223 IO_Serial_InitPnP (io); 228 224 229 io->usbserial=usbserial; 230 231 if(io->com!=RTYP_SCI) 225 if(io->reader_type!=R_INTERNAL) 232 226 IO_Serial_Flush(io); 233 227 … … 242 236 243 237 #ifdef SCI_DEV 244 if(io-> com==RTYP_SCI)238 if(io->reader_type==R_INTERNAL) 245 239 return FALSE; 246 240 #endif … … 511 505 512 506 #ifdef SCI_DEV 513 if(io-> com==RTYP_SCI)507 if(io->reader_type==R_INTERNAL) 514 508 return FALSE; 515 509 #endif 516 510 517 // printf("IO: Setting properties: com%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->com, io->input_bitrate, io->bits, io->parity == IO_SERIAL_PARITY_EVEN ? "Even" : io->parity == IO_SERIAL_PARITY_ODD ? "Odd" : "None", io->stopbits, io->dtr, io->rts);511 // printf("IO: Setting properties: reader_type%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->reader_type, io->input_bitrate, io->bits, io->parity == IO_SERIAL_PARITY_EVEN ? "Even" : io->parity == IO_SERIAL_PARITY_ODD ? "Odd" : "None", io->stopbits, io->dtr, io->rts); 518 512 memset (&newtio, 0, sizeof (newtio)); 519 513 … … 621 615 622 616 #ifdef DEBUG_IO 623 printf("IO: Setting properties: com%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->com, io->input_bitrate, io->bits, io->parity == IO_SERIAL_PARITY_EVEN ? "Even" : io->parity == IO_SERIAL_PARITY_ODD ? "Odd" : "None", io->stopbits, io->dtr, io->rts);617 printf("IO: Setting properties: reader_type%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->reader_type, io->input_bitrate, io->bits, io->parity == IO_SERIAL_PARITY_EVEN ? "Even" : io->parity == IO_SERIAL_PARITY_ODD ? "Odd" : "None", io->stopbits, io->dtr, io->rts); 624 618 #endif 625 619 return TRUE; … … 641 635 unsigned IO_Serial_GetCom (IO_Serial * io) 642 636 { 643 return io-> com;637 return io->reader_type; 644 638 } 645 639 … … 654 648 #endif 655 649 656 if((io-> com!=RTYP_SCI) && (io->wr>0))650 if((io->reader_type!=R_INTERNAL) && (io->wr>0)) 657 651 { 658 652 BYTE buf[256]; … … 750 744 for (count = 0; count < size; count += to_send) 751 745 { 752 // if(io-> com==RTYP_SCI)746 // if(io->reader_type==R_INTERNAL) 753 747 // to_send = 1; 754 748 // else … … 771 765 fflush (stdout); 772 766 #endif 773 if(io-> com!=RTYP_SCI)767 if(io->reader_type!=R_INTERNAL) 774 768 io->wr += u; 775 769 return FALSE; 776 770 } 777 771 778 if(io-> com!=RTYP_SCI)772 if(io->reader_type!=R_INTERNAL) 779 773 io->wr += to_send; 780 774 … … 951 945 952 946 #ifdef SCI_DEV 953 if(io-> com==RTYP_SCI)947 if(io->reader_type==R_INTERNAL) 954 948 return TRUE; 955 949 #endif … … 1004 998 { 1005 999 io->fd = -1; 1006 io-> com= 0;1000 io->reader_type = 0; 1007 1001 memset (io->PnP_id, 0, IO_SERIAL_PNPID_SIZE); 1008 1002 io->PnP_id_size = 0; 1009 io->usbserial = FALSE;1010 1003 io->wr = 0; 1011 1004 //modifyable properties: … … 1023 1016 extern char oscam_device[]; 1024 1017 snprintf (filename, length, "%s", oscam_device); 1025 // if(com==1)1026 // snprintf (filename, length, "/dev/tts/%d", com - 1);1027 // else1028 // snprintf (filename, length, "/dev/sci%d", com - 2);1029 1018 } 1030 1019 -
branches/smartreader/csctapi/io_serial.h
r1186 r1211 65 65 int rts; 66 66 /* end settings that can be modified */ 67 unsigned com; /* Com port number (1..4) */67 int reader_type; 68 68 BYTE PnP_id[IO_SERIAL_PNPID_SIZE]; /* PnP Id of the serial device */ 69 69 unsigned PnP_id_size; /* Length of PnP Id */ 70 bool usbserial; /* Is serial USB device */71 70 int wr; 72 int reader_type;73 71 int mhz; /* mhz specified in config = actual reader clock speed */ 74 72 int cardmhz; /* mhz specified in config = standard (non overclocked) clock speed of card*/ … … 83 81 //extern void IO_Serial_Reopen (IO_Serial * io); 84 82 extern void IO_Serial_Flush (IO_Serial * io); 85 extern IO_Serial *IO_Serial_New (int reader_type, intmhz, int cardmhz);83 extern IO_Serial *IO_Serial_New (int mhz, int cardmhz); 86 84 extern void IO_Serial_Delete (IO_Serial * io); 87 85 88 86 /* Initialization and closing */ 89 extern bool IO_Serial_Init (IO_Serial * io, unsigned com, bool usbserial);87 extern bool IO_Serial_Init (IO_Serial * io, int reader_type); 90 88 extern bool IO_Serial_Close (IO_Serial * io); 91 89 -
branches/smartreader/csctapi/pps.c
r1197 r1211 31 31 #include <string.h> 32 32 #include "ifd.h" 33 #include "../globals.h" 33 34 34 35 /* … … 138 139 if ((*length) <= 0 || !PPS_success) // If not by command, or PPS Exchange by command failed: Try PPS Exchange by ATR or Get parameters from ATR 139 140 { 140 int numprot = atr->pn-1;//number of protocol lines in ATR 141 int numprot = atr->pn; 142 //if there is a trailing TD, this number is one too high 141 143 BYTE tx; 144 if (ATR_GetInterfaceByte (atr, numprot-1, ATR_INTERFACE_BYTE_TD, &tx) == ATR_OK) 145 if ((tx & 0xF0) == 0) 146 numprot--; 142 147 cs_debug("ATR reports %i protocol lines:",numprot); 143 148 int i,point; … … 427 432 #include "sci_global.h" 428 433 #include "sci_ioctl.h" 429 if(pps->icc->ifd->io-> com==RTYP_SCI)434 if(pps->icc->ifd->io->reader_type == R_INTERNAL) 430 435 { 431 436 int n; … … 461 466 } 462 467 #elif COOL 463 if(pps->icc->ifd->io->com==R TYP_SCI) {468 if(pps->icc->ifd->io->com==R_INTERNAL) { 464 469 int mhz = atr_fs_table[pps->parameters.FI] / 10000; 465 470 if (!Cool_SetBaudrate(mhz)) -
branches/smartreader/csctapi/protocol_t0.c
r1186 r1211 1021 1021 } 1022 1022 1023 if(t14->icc->ifd->io-> com!=RTYP_SCI)1023 if(t14->icc->ifd->io->reader_type!=R_INTERNAL) 1024 1024 { 1025 1025 /* Send 0x01 byte */ -
branches/smartreader/globals.h
r1197 r1211 124 124 #define R_MOUSE 0x1 // Reader smartcard mouse 125 125 #define R_INTERNAL 0x2 // Reader smartcard intern 126 #define R_DB2COM1 0x3 // Reader Dbox2 @ com1 127 #define R_DB2COM2 0x4 // Reader Dbox2 @ com1 126 128 #define R_SMART 0x5 // Smartreader+ 129 #ifdef HAVE_PCSC 130 #define R_PCSC 0x6 // PCSC 131 #endif 127 132 #define R_CAMD35 0x10 // Reader cascading camd 3.5x 128 133 #define R_CAMD33 0x11 // Reader cascading camd 3.3x … … 136 141 #define R_IS_CASCADING 0xF0 137 142 138 #ifdef HAVE_PCSC139 #define R_PCSC 0x6 // PCSC140 #endif141 143 142 144 #define CS_MAX_MOD 12 -
branches/smartreader/reader-common.c
r1146 r1211 20 20 #ifdef TUXBOX 21 21 static int reader_device_type(char *device) 22 #else 23 static int reader_device_type() 24 #endif 25 { 26 int rc=PORT_STD; 27 #ifdef TUXBOX 22 { 23 int rc=reader[ridx].typ; 28 24 struct stat sb; 29 #endif 30 31 switch(reader[ridx].typ) 32 { 33 case R_MOUSE: 34 case R_SMART: 35 rc=PORT_STD; 36 #ifdef TUXBOX 25 if (reader[ridx].typ == R_MOUSE) 26 { 37 27 if (!stat(device, &sb)) 38 28 { … … 45 35 switch(dev_minor & 0x3F) 46 36 { 47 case 0: rc= PORT_DB2COM1; break;48 case 1: rc= PORT_DB2COM2; break;37 case 0: rc=R_DB2COM1; break; 38 case 1: rc=R_DB2COM2; break; 49 39 } 50 40 cs_debug("device is major: %d, minor: %d, typ=%d", dev_major, dev_minor, rc); 51 41 } 52 42 } 53 #endif54 break;55 case R_INTERNAL:56 rc=PORT_SCI;57 break;58 43 } 59 44 return(rc); 60 45 } 46 #endif 61 47 62 48 static void reader_nullcard(void) … … 324 310 snprintf(oscam_device, sizeof(oscam_device), "%s", device); 325 311 #ifdef TUXBOX 326 if ((rc=CT_init(1, reader_device_type(device),reader[ridx]. typ,reader[ridx].mhz,reader[ridx].cardmhz))!=OK)312 if ((rc=CT_init(1, reader_device_type(device),reader[ridx].mhz,reader[ridx].cardmhz))!=OK) 327 313 cs_log("[tuxbox] Cannot open device: %s", device); 328 314 #else 329 if ((rc=CT_init(1, reader _device_type(),reader[ridx].typ,reader[ridx].mhz,reader[ridx].cardmhz))!=OK)315 if ((rc=CT_init(1, reader[ridx].typ,reader[ridx].mhz,reader[ridx].cardmhz))!=OK) 330 316 cs_log("Cannot open device: %s", device); 331 317 #endif
Note:
See TracChangeset
for help on using the changeset viewer.