Changeset 1205
- Timestamp:
- 01/13/10 14:47:15 (14 years ago)
- Location:
- trunk/csctapi
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/Makefile
r1171 r1205 15 15 $(LIBFILE1)(ifd_towitoko.o) \ 16 16 $(LIBFILE1)(ifd_cool.o) \ 17 $(LIBFILE1)(ifd_sci.o) \ 17 18 $(LIBFILE1)(io_serial.o) \ 18 19 $(LIBFILE1)(pps.o) \ -
trunk/csctapi/icc_async.c
r1183 r1205 78 78 return ICC_ASYNC_IFD_ERROR; 79 79 /* Reset ICC */ 80 #ifdef SCI_DEV 81 if (ifd->io->com == RTYP_SCI) { 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 91 if (ifd->io->com == RTYP_SCI) { -
trunk/csctapi/ifd_towitoko.c
r1203 r1205 358 358 if(ifd->io->com==RTYP_SCI) 359 359 { 360 if( ioctl(ifd->io->fd, IOCTL_GET_IS_CARD_PRESENT, &in)<0)360 if(!Sci_GetStatus(ifd->io->fd, &in)) 361 361 return IFD_TOWITOKO_IO_ERROR; 362 362 } … … 541 541 #endif 542 542 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 619 if ((buf[0] !=0x3B) && (buf[0] != 0x3F) && (n>9 && !memcmp(buf+4, "IRDETO", 6))) //irdeto S02 reports FD as first byte on dreambox SCI, not sure about SH4 or phoenix620 buf[0] = 0x3B;621 #endif622 623 if(n==0)624 return IFD_TOWITOKO_IO_ERROR;625 626 627 (*atr) = ATR_New ();628 if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK)629 {630 struct timespec req_ts;631 req_ts.tv_sec = 0;632 req_ts.tv_nsec = 50000000;633 nanosleep (&req_ts, NULL);634 if (ioctl(ifd->io->fd, IOCTL_SET_ATR_READY)<0)635 return IFD_TOWITOKO_IO_ERROR;636 return IFD_TOWITOKO_OK;637 }638 else639 {640 ATR_Delete (*atr);641 (*atr) = NULL;642 return IFD_TOWITOKO_IO_ERROR;643 }644 }645 else646 #endif647 {648 543 int ret; 649 544 int parity; … … 735 630 736 631 return ret; 737 }738 632 } 739 633
Note:
See TracChangeset
for help on using the changeset viewer.