Changeset 1208
- Timestamp:
- 01/13/10 16:47:27 (11 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/cardterminal.c
r1160 r1208 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); -
trunk/csctapi/cardterminal.h
r1160 r1208 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 */ -
trunk/csctapi/ctapi.c
r615 r1208 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 */ -
trunk/csctapi/ctapi.h
r615 r1208 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 -
trunk/csctapi/defines.h
r957 r1208 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 */ -
trunk/csctapi/icc_async.c
r1205 r1208 79 79 /* Reset ICC */ 80 80 #ifdef SCI_DEV 81 if (ifd->io-> com == RTYP_SCI) {81 if (ifd->io->reader_type == R_INTERNAL) { 82 82 if (!Sci_Reset(ifd, &(icc->atr))) 83 83 { … … 89 89 #endif 90 90 #ifdef COOL 91 if (ifd->io-> com == RTYP_SCI) {91 if (ifd->io->reader_type == R_INTERNAL) { 92 92 if (!Cool_Reset(&(icc->atr))) 93 93 { … … 159 159 } 160 160 #ifdef COOL 161 if (icc->ifd->io-> com != RTYP_SCI)161 if (icc->ifd->io->reader_type != R_INTERNAL) 162 162 #endif 163 163 IO_Serial_Flush(ifd->io); … … 184 184 #include "sci_global.h" 185 185 #include "sci_ioctl.h" 186 if (icc->ifd->io-> com == RTYP_SCI) {186 if (icc->ifd->io->reader_type == R_INTERNAL) { 187 187 SCI_PARAMETERS params; 188 188 if (ioctl(icc->ifd->io->fd, IOCTL_GET_PARAMETERS, ¶ms) < 0 ) … … 223 223 icc->baudrate = baudrate; 224 224 /*#ifdef COOL 225 if (icc->ifd->io-> com==RTYP_SCI) {225 if (icc->ifd->io->reader_type==R_INTERNAL) { 226 226 typedef unsigned long u_int32; 227 227 u_int32 clk; … … 281 281 IFD_Timings timings; 282 282 283 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) 284 284 { 285 285 buffer = (BYTE *) calloc(sizeof (BYTE), size); … … 297 297 298 298 #ifdef COOL 299 if (icc->ifd->io-> com == RTYP_SCI) {299 if (icc->ifd->io->reader_type == R_INTERNAL) { 300 300 if (!Cool_Transmit(sent, size)) 301 301 return ICC_ASYNC_IFD_ERROR; … … 320 320 321 321 #ifdef COOL 322 if (icc->ifd->io-> com == RTYP_SCI) {322 if (icc->ifd->io->reader_type == R_INTERNAL) { 323 323 if (!Cool_Receive(data, size)) 324 324 return ICC_ASYNC_IFD_ERROR; … … 330 330 #endif 331 331 332 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) 333 333 ICC_Async_InvertBuffer (size, data); 334 334 -
trunk/csctapi/ifd_towitoko.c
r1205 r1208 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 if(ifd->io->reader_type==R_INTERNAL) 359 360 { 360 361 if(!Sci_GetStatus(ifd->io->fd, &in)) … … 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; -
trunk/csctapi/io_serial.c
r1185 r1208 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==R TYP_SCI)189 if (com==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: com%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: com%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: -
trunk/csctapi/io_serial.h
r1185 r1208 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 -
trunk/csctapi/pps.c
r1204 r1208 431 431 #include "sci_global.h" 432 432 #include "sci_ioctl.h" 433 if(pps->icc->ifd->io->com==R TYP_SCI)433 if(pps->icc->ifd->io->com==R_INTERNAL) 434 434 { 435 435 int n; … … 465 465 } 466 466 #elif COOL 467 if(pps->icc->ifd->io->com==R TYP_SCI) {467 if(pps->icc->ifd->io->com==R_INTERNAL) { 468 468 int mhz = atr_fs_table[pps->parameters.FI] / 10000; 469 469 if (!Cool_SetBaudrate(mhz)) -
trunk/csctapi/protocol_t0.c
r1179 r1208 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 */ -
trunk/globals.h
r1196 r1208 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 -
trunk/reader-common.c
r1145 r1208 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 == RMOUSE) 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.