Changeset 1964


Ignore:
Timestamp:
04/06/10 09:47:17 (12 years ago)
Author:
merek
Message:

Merge from UMP r1996

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/csctapi/ifd_sc8in1.c

    r1963 r1964  
    3838static int sc8in1_command(struct s_reader * reader, unsigned char * buff, unsigned short lenwrite, unsigned short lenread)
    3939{
     40  int res,i;
    4041  struct termios termio, termiobackup;
    4142
     
    5758  }
    5859  cs_ddump_mask (D_DEVICE, buff, lenwrite, "IO: Sending: ");
    59 
    60   if(!write(reader->handle, buff, lenwrite)) {
     60  if(!write(reader->handle, buff, lenwrite)); { //dont use IO_Serial_Write since mcr commands dont echo back
    6161    cs_log("ERROR: SC8in1 Command write error");
    62     return ERROR; //dont use IO_Serial_Write since mcr commands dont echo back
    63   }
    64 
     62    return ERROR;
     63  }
    6564  tcdrain(reader->handle);
    6665  if (IO_Serial_Read (reader, 1000, lenread, buff) == ERROR) {
    67     cs_log("SC8in1 Command read error");
     66    cs_log("ERROR: SC8in1 Command read error");
    6867    return ERROR;
    6968  }
     
    160159        //init all stored termios to default comm settings after device init, before ATR
    161160        memcpy(&stored_termio[i],&termio,sizeof(termio));
    162         unsigned char buff[] = { 0x74 };
    163         sc8in1_command(reader, buff, 1, 1);
    164         if (buff[0] == 4 || buff[0] == 8) {
    165             is_mcr = (unsigned short) buff[0];
    166             cs_log("SC8in1: device MCR%i detected", is_mcr);
    167         }
    168         else
    169             is_mcr = 0;
    170         tcflush(reader->handle, TCIOFLUSH); // a non MCR reader might give longer answer
     161    unsigned char buff[] = { 0x74 };
     162    sc8in1_command(reader, buff, 1, 1);
     163    if (buff[0] == 4 || buff[0] == 8) {
     164        is_mcr = (unsigned short) buff[0];
     165        cs_log("SC8in1: device MCR%i detected", is_mcr);
     166    }
     167    else
     168        is_mcr = 0;
     169    tcflush(reader->handle, TCIOFLUSH); // a non MCR reader might give longer answer
     170    int fd = reader->handle;
     171    for (i=0; i<CS_MAXREADER; i++) //copy handle to other slots, FIXME change this if multiple sc8in1 readers
     172        if (reader[i].typ == R_SC8in1)
     173            reader[i].handle = fd;
     174
    171175    return OK;
    172176}
     
    239243        sc8in1_clock[1] |= speed;
    240244    }
    241     return OK;
    242 }
     245}
     246
  • trunk/oscam.c

    r1956 r1964  
    552552            reader[ridx].slot=(int)reader[ridx].device[pos+1] - 0x30;//FIXME test boundaries
    553553            reader[ridx].device[pos]= 0; //slot 1 reader now gets correct physicalname
    554                         if (reader[ridx].handle == 0) {
     554                        if (reader[ridx].handle == 0)
    555555                reader_device_init(&reader[ridx]);
    556                 int fd = reader[ridx].handle;
    557                 int i;
    558                 for (i=0; i<CS_MAXREADER; i++) //copy handle to other slots, FIXME change this if multiple sc8in1 readers 
    559                     if (reader[i].typ == R_SC8in1)
    560                         reader[i].handle = fd;
    561             }
    562556            cs_log("creating thread for device %s slot %i with ridx %i=%i", reader[ridx].device, reader[ridx].slot, reader[ridx].ridx, ridx);
    563557            int rc;
Note: See TracChangeset for help on using the changeset viewer.