Changeset 1254


Ignore:
Timestamp:
01/16/10 17:31:59 (11 years ago)
Author:
rorothetroll
Message:

resync with trunk

Location:
branches/smartreader
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/smartreader/Distribution/doc/example/oscam.srvid

    r1239 r1254  
     1#
     2# Sky Deutschland
     3#
     4
    151702,1722,1833,1834,09C4:000C|Sky|Nat Geo Wild|TV|Sky Welt
    261702,1722,1833,1834,09C4:000D|Sky|National Geographic Channel|TV|Sky Welt
     
    19231702,1722,1833,1834,09C4:00A8|Sky|Motorvision TV|TV|Sky Welt
    20241702,1722,1833,1834,09C4:0206|Sky|Goldstar TV|TV|Sky Welt
     25
    21261702,1722,1833,1834,09C4:0096|Sky|Deutsche Charts|Radio|Sky MCE
    22271702,1722,1833,1834,09C4:0097|Sky|Rock Hymnen|Radio|Sky MCE
     
    26311702,1722,1833,1834,09C4:009B|Sky|R&B/Hip Hop|Radio|Sky MCE
    27321702,1722,1833,1834,09C4:009C|Sky|Country|Radio|Sky MCE
     33
    28341702,1722,1833,1834,09C4:0008|Sky|Sky Comedy|TV|Sky Film
    29351702,1722,1833,1834,09C4:0009|Sky|Sky Action|TV|Sky Film
     
    36421702,1722,1833,1834,09C4:0203|Sky|MGM|TV|Sky Film
    37431702,1722,1833,1834,09C4:0204|Sky|Sky Nostalgie|TV|Sky Film
     44
    38451702,1722,1833,1834,09C4:0011|Sky|Sky Sport Info|TV|Sky Sport
    39461702,1833,09C4:0035|Sky|Sky Sport Austria|TV|Sky Sport
     
    51581702,1722,1833,1834,09C4:016B|Sky|Sky Sport 016B|TV|Sky Sport
    52591702,1722,1833,1834,09C4:0175|Sky|Sky Sport 0175|TV|Sky Sport
     60
    53611702,1722,1833,1834,09C4:00DF|Sky|Sky Bundesliga|TV|Sky Bundesliga
    54621702,1722,1833,1834,09C4:00FC|Sky|Sky Bundesliga 00FC|TV|Sky Bundesliga
     
    63711702,1722,1833,1834,09C4:0156|Sky|Sky Bundesliga 0156|TV|Sky Bundesliga
    64721702,1722,1833,1834,09C4:0160|Sky|Sky Bundesliga 0160|TV|Sky Bundesliga
     73
    65741702,1722,1833,1834,09C4:00FB|Sky|Sky Select 00FB|TV|Sky Select
    66751702,1722,1833,1834,09C4:00FE|Sky|Sky Select 00FE|TV|Sky Select
     
    74831702,1722,1833,1834,09C4:0141|Sky|Sky Select 0141|TV|Sky Select
    75841702,1722,1833,1834,09C4:014B|Sky|Sky Select 014B|TV|Sky Select
     85
    76861702,1722,1833,1834,09C4:007E|Sky|Disney Cinemagic HD|TV|Sky HD
    77871702,1722,1833,1834,09C4:007F|Sky|National Geographic HD|TV|Sky HD
     
    81911702,1722,1833,1834,09C4:0083|Sky|Sky Cinema HD|TV|Sky HD
    82921702,1722,1833,1834,09C4:0084|Sky|Eurosport HD|TV|Sky HD
     93
    83941702,1833,09C4:003C|Sky|Kinowelt TV|TV|Sky Welt Extra
    84951702,1833,09C4,0D22:003D|Sky|TNT Film (TCM)|TV|Sky Welt Extra
     
    991101702,1833,09C4,0D00:7009|Sky|MTV Entertainment|TV|Sky Welt Extra
    1001111702,1833,09C4,0D00:700A|Sky|Nick Premium|TV|Sky Welt Extra
     112
    1011131702,1722,1833,1834,09C4:000F|Sky|BigBrother|TV|Sky sonstige
     114
    1021151702,1722,1833,1834,1836,09C4:0201|Sky|Blue Movie Info|TV|Sky Erotik
    1031161702,1722,1833,1834,1836,09C4:0159|Sky|Blue Movie 1|TV|Sky Erotik
    1041171702,1722,1833,1834,1836,09C4:0163|Sky|Blue Movie 2|TV|Sky Erotik
    1051181702,1722,1833,1834,1836,09C4:016D|Sky|Blue Movie 3|TV|Sky Erotik
     119
     120#
     121# Kabel Deutschland
     122#
     123
    1061241722,1801:C3B5|KD|Fashion TV|TV|
    1071251722,1801:C3B6|KD|Motors TV|TV|
     
    2823001722,1801:CFD3|KD|ATV Avrupa|TV|turkish
    2833011722,1801:CFD5|KD|Euro D|TV|turkish
     302
     303#
     304# ORF
     305#
     306
    2843070D05:32C9|ORF|ORF1|TV|
    2853080D05:32CA|ORF|ORF2|TV|
     
    2933160D05:32D2|ORF|ORF2 St|TV|
    2943170D05:32D3|ORF|ORF2 K|TV|
     318
    2953190D05:32D4|ORF|ATV+|TV|
    2963200D05:3332|ORF|Austria 9 TV|TV|
    2973210D05:4E27|ORF|Puls 4 Austria|TV|
     322
    2983230D05:132F|ORF|ORF1 HD|TV|
    2993240D05:1330|ORF|ORF2 HD|TV|
     325
     326#
     327# MTV Unlimited
     328#
     329
    3003300B00:6FF3|MTV Unlimited|MTV TWO|TV|
    3013310B00:6FEE|MTV Unlimited|MTV Hits|TV|
     
    3043340B00:6FF0|MTV Unlimited|VH1 Europe|TV|
    3053350B00:6FFF|MTV Unlimited|MTV Music|TV|
     336
     337#
     338# Schweizer Fernsehen
     339#
     340
    3063410500:0385|Schweizer Fernsehen|SF1|TV|
    3073420500:038F|Schweizer Fernsehen|SF info|TV|
    3083430500:038B|Schweizer Fernsehen|SF zwei|TV|
     344
    3093450500:03DE|Schweizer Fernsehen|HD suisse|TV|
     346
    3103470500&023800:36B2|Television Suisse Romande|TSR1|TV|
    3113480500&023800:36B8|Television Suisse Romande|TSR2|TV|
     349
    3123500500&023800:36B3|Televisione svizzera di lingua italiana|TSI1|TV|
    3133510500&023800:36B9|Televisione svizzera di lingua italiana|TSI1|TV|
     352
     353#
     354# Astra HD+
     355#
     356
    3143571830:EF10|Astra HD+|RTL HD|TV|
    3153581830:EF11|Astra HD+|VOX HD|TV|
    3163591830:277E|Astra HD+|. (SD)|TV|
     360
     361#
     362# Unity Media
     363#
     364
    3173651722:71ad|UM|Record Internacional Europa|TV|
    3183661722:71ae|UM|Tkshow TV|TV|
  • branches/smartreader/Distribution/doc/man/oscam.srvid.5

    r1239 r1254  
    1111mapping between CAID, service ID, provider, name, type and description of service
    1212.RE
     13.SH ANNONTATIONS
     14\fIPlease use Unix text file format only.\fR
    1315
    14 \fIEmpty lines are not allowed in \fBoscam.srvid\fP.\fR
     16You only need the \fBoscam.srvid\fR when using the monitor or the web interface.
     17For saving memory consumption only insert the service IDs you really need. Some
     18external programs use their own \fBoscam.srvid\fR and do not need the \fBoscam.srvid\fR of OSCam.
    1519.SH EXAMPLES
    1620 0001,0002,0003:000a|my provider 1|tv name 1|tv|my tv package
  • branches/smartreader/Distribution/doc/txt/oscam.srvid.txt

    r1239 r1254  
    1515      tion of service
    1616
    17        Empty lines are not allowed in oscam.srvid.
     17ANNONTATIONS
     18       Please use Unix text file format only.
     19
     20       You only need the oscam.srvid when using the monitor or the web  inter
     21       face.   For  saving  memory consumption only insert the service IDs you
     22       really need. Some external programs use their own  oscam.srvid  and  do
     23       not need the oscam.srvid of OSCam.
    1824
    1925EXAMPLES
  • branches/smartreader/csctapi/icc_async.c

    r1239 r1254  
    211211
    212212    /* Initialize Baudrate */
    213     if (IFD_Towitoko_SetBaudrate (ifd, ICC_ASYNC_BAUDRATE)!= IFD_TOWITOKO_OK)
     213    if (!Phoenix_SetBaudrate (ICC_ASYNC_BAUDRATE))
    214214        return ICC_ASYNC_IFD_ERROR;
    215215   
     
    277277        if (!IO_Serial_SetParity (PARITY_ODD))
    278278            return ICC_ASYNC_IFD_ERROR;
     279        icc->ifd->io->parity = PARITY_ODD;
    279280    }
    280281    else if(icc->protocol_type == ATR_PROTOCOL_TYPE_T14)
     
    282283        if (!IO_Serial_SetParity (PARITY_NONE))
    283284            return ICC_ASYNC_IFD_ERROR;     
     285        icc->ifd->io->parity = PARITY_NONE;
    284286    }
    285287    else
     
    287289        if (!IO_Serial_SetParity (PARITY_EVEN))
    288290            return ICC_ASYNC_IFD_ERROR;     
     291        icc->ifd->io->parity = PARITY_EVEN;
    289292    }
    290293#ifdef COOL
     
    351354{
    352355    icc->baudrate = baudrate;
    353     if (IFD_Towitoko_SetBaudrate (icc->ifd, baudrate) !=  IFD_TOWITOKO_OK)
     356    if (!Phoenix_SetBaudrate (baudrate))
    354357      return ICC_ASYNC_IFD_ERROR;
    355358   
  • branches/smartreader/csctapi/ifd_phoenix.c

    r1226 r1254  
    1111#include "atr.h"
    1212#include "ifd_towitoko.h" //FIXME
     13#include <termios.h>
    1314
    1415#define OK      1
     
    143144}
    144145
    145 int Phoenix_SetBaudrate (int mhz)
     146int Phoenix_SetBaudrate (unsigned long baudrate)
    146147{
     148    if(reader[ridx].typ == R_INTERNAL)
     149        return OK;
     150
     151#ifdef DEBUG_IFD
     152    printf ("IFD: Setting baudrate to %lu\n", baudrate);
     153#endif
     154    if (reader[ridx].baudrate   == baudrate)
     155        return OK;
     156
     157    /* Get current settings */
     158    struct termios tio;
     159    if (tcgetattr (reader[ridx].handle, &tio) != 0)
     160        return ERROR;
     161   
     162    //write baudrate here!
     163    if (!IO_Serial_SetBitrate (baudrate, &tio))
     164        return ERROR;
     165   
     166    if (!IO_Serial_SetProperties(tio))
     167        return ERROR;
     168   
     169    reader[ridx].baudrate = baudrate;
     170   
    147171    return OK;
    148172}
  • branches/smartreader/csctapi/ifd_towitoko.c

    r1239 r1254  
    181181   
    182182    /* Default serial port settings */
    183     io->input_bitrate = IFD_TOWITOKO_BAUDRATE;
    184     io->output_bitrate = IFD_TOWITOKO_BAUDRATE;
    185     io->bits = 8;
    186     io->stopbits = 2;
    187     io->parity = PARITY_EVEN;
    188     io->dtr = IO_SERIAL_HIGH;
    189 //  io->dtr = IO_SERIAL_LOW;
    190 //  io->rts = IO_SERIAL_HIGH;
    191     io->rts = IO_SERIAL_LOW;
    192    
    193        
    194     if (!IO_Serial_SetPropertiesOld (io))
    195         return IFD_TOWITOKO_IO_ERROR;
     183    if (!IO_Serial_SetParams (IFD_TOWITOKO_BAUDRATE, 8, PARITY_EVEN, 2, IO_SERIAL_HIGH, IO_SERIAL_LOW))
     184        return FALSE;
    196185       
    197186    /* Default ifd settings */
     
    201190    ifd->type = IFD_TOWITOKO_MULTICAM;
    202191   
    203     ret = IFD_Towitoko_SetBaudrate (ifd, IFD_TOWITOKO_BAUDRATE);
    204    
    205     if (ret != IFD_TOWITOKO_OK)
     192    if (!Phoenix_SetBaudrate(IFD_TOWITOKO_BAUDRATE))
    206193    {
    207194        IFD_Towitoko_Clear (ifd);
    208         return ret;
     195        return IFD_TOWITOKO_IO_ERROR;
    209196    }
    210197   
     
    251238    IFD_Towitoko_Clear (ifd);
    252239   
    253    
    254     return IFD_TOWITOKO_OK;
    255 }
    256 
    257 int IFD_Towitoko_SetBaudrate (IFD * ifd, unsigned long baudrate)
    258 {
    259     if(reader[ridx].typ == R_INTERNAL)
    260     {
    261         return IFD_TOWITOKO_OK;
    262     }
    263 #ifdef DEBUG_IFD
    264     printf ("IFD: Setting baudrate to %lu\n", baudrate);
    265 #endif
    266     /* Get current settings */
    267     if (!IO_Serial_GetPropertiesOld (ifd->io))
    268         return IFD_TOWITOKO_IO_ERROR;
    269    
    270     if (ifd->io->output_bitrate == baudrate)
    271         return IFD_TOWITOKO_OK;
    272 
    273    
    274     /* Set serial device bitrate */
    275     ifd->io->output_bitrate = baudrate;
    276     ifd->io->input_bitrate = baudrate;
    277    
    278     if (!IO_Serial_SetPropertiesOld (ifd->io))
    279         return IFD_TOWITOKO_IO_ERROR;
    280    
    281     return IFD_TOWITOKO_OK;
    282 }
    283 
    284 int IFD_Towitoko_GetBaudrate (IFD * ifd, unsigned long *baudrate)
    285 {
    286     if(reader[ridx].typ == R_INTERNAL)
    287     {
    288         return IFD_TOWITOKO_OK;
    289     }
    290    
    291     /* Get current settings */
    292     if (!IO_Serial_GetPropertiesOld (ifd->io))
    293         return IFD_TOWITOKO_IO_ERROR;
    294    
    295     (*baudrate) = ifd->io->output_bitrate;
    296240   
    297241    return IFD_TOWITOKO_OK;
  • branches/smartreader/csctapi/ifd_towitoko.h

    r1239 r1254  
    116116/* Handling of this IFD */
    117117extern int IFD_Towitoko_SetBaudrate (IFD * ifd, unsigned long baudrate);
    118 extern int IFD_Towitoko_GetBaudrate (IFD * ifd, unsigned long *baudrate);
    119118
    120119/* General handling of ICC inserted in this IFD */
  • branches/smartreader/csctapi/io_serial.c

    r1239 r1254  
    180180}
    181181
    182 bool IO_Serial_GetPropertiesOld (IO_Serial * io)
    183 {
    184     struct termios currtio;
    185     speed_t i_speed, o_speed;
    186     unsigned int mctl;
    187 
    188 #ifdef SCI_DEV
    189     if(reader[ridx].typ == R_INTERNAL)
    190         return FALSE;
    191 #endif
    192 
    193     if (io->input_bitrate != 0 && io->output_bitrate != 0) //properties are already filled
    194       return TRUE;
    195    
    196     if (tcgetattr (reader[ridx].handle, &currtio) != 0)
    197         return FALSE;
    198 
    199     o_speed = cfgetospeed (&currtio);
    200    
    201     switch (o_speed)
    202     {
    203 #ifdef B0
    204         case B0:
    205             io->output_bitrate = 0;
    206             break;
    207 #endif
    208 #ifdef B50
    209         case B50:
    210             io->output_bitrate = 50;
    211             break;
    212 #endif
    213 #ifdef B75
    214         case B75:
    215             io->output_bitrate = 75;
    216             break;
    217 #endif
    218 #ifdef B110
    219         case B110:
    220             io->output_bitrate = 110;
    221             break;
    222 #endif
    223 #ifdef B134
    224         case B134:
    225             io->output_bitrate = 134;
    226             break;
    227 #endif
    228 #ifdef B150
    229         case B150:
    230             io->output_bitrate = 150;
    231             break;
    232 #endif
    233 #ifdef B200
    234         case B200:
    235             io->output_bitrate = 200;
    236             break;
    237 #endif
    238 #ifdef B300
    239         case B300:
    240             io->output_bitrate = 300;
    241             break;
    242 #endif
    243 #ifdef B600
    244         case B600:
    245             io->output_bitrate = 600;
    246             break;
    247 #endif
    248 #ifdef B1200
    249         case B1200:
    250             io->output_bitrate = 1200;
    251             break;
    252 #endif
    253 #ifdef B1800
    254         case B1800:
    255             io->output_bitrate = 1800;
    256             break;
    257 #endif
    258 #ifdef B2400
    259         case B2400:
    260             io->output_bitrate = 2400;
    261             break;
    262 #endif
    263 #ifdef B4800
    264         case B4800:
    265             io->output_bitrate = 4800;
    266             break;
    267 #endif
    268 #ifdef B9600
    269         case B9600:
    270             io->output_bitrate = 9600;
    271             break;
    272 #endif
    273 #ifdef B19200
    274         case B19200:
    275             io->output_bitrate = 19200;
    276             break;
    277 #endif
    278 #ifdef B38400
    279         case B38400:
    280             io->output_bitrate = 38400;
    281             break;
    282 #endif
    283 #ifdef B57600
    284         case B57600:
    285             io->output_bitrate = 57600;
    286             break;
    287 #endif
    288 #ifdef B115200
    289         case B115200:
    290             io->output_bitrate = 115200;
    291             break;
    292 #endif
    293 #ifdef B230400
    294         case B230400:
    295             io->output_bitrate = 230400;
    296             break;
    297 #endif
    298         default:
    299             io->output_bitrate = 1200;
    300             break;
    301     }
    302 
    303     i_speed = cfgetispeed (&currtio);
    304    
    305     switch (i_speed)
    306     {
    307 #ifdef B0
    308         case B0:
    309             io->input_bitrate = 0;
    310             break;
    311 #endif
    312 #ifdef B50
    313         case B50:
    314             io->input_bitrate = 50;
    315             break;
    316 #endif
    317 #ifdef B75
    318         case B75:
    319             io->input_bitrate = 75;
    320             break;
    321 #endif
    322 #ifdef B110
    323         case B110:
    324             io->input_bitrate = 110;
    325             break;
    326 #endif
    327 #ifdef B134
    328         case B134:
    329             io->input_bitrate = 134;
    330             break;
    331 #endif
    332 #ifdef B150
    333         case B150:
    334             io->input_bitrate = 150;
    335             break;
    336 #endif
    337 #ifdef B200
    338         case B200:
    339             io->input_bitrate = 200;
    340             break;
    341 #endif
    342 #ifdef B300
    343         case B300:
    344             io->input_bitrate = 300;
    345             break;
    346 #endif
    347 #ifdef B600
    348         case B600:
    349             io->input_bitrate = 600;
    350             break;
    351 #endif
    352 #ifdef B1200
    353         case B1200:
    354             io->input_bitrate = 1200;
    355             break;
    356 #endif
    357 #ifdef B1800
    358         case B1800:
    359             io->input_bitrate = 1800;
    360             break;
    361 #endif
    362 #ifdef B2400
    363         case B2400:
    364             io->input_bitrate = 2400;
    365             break;
    366 #endif
    367 #ifdef B4800
    368         case B4800:
    369             io->input_bitrate = 4800;
    370             break;
    371 #endif
    372 #ifdef B9600
    373         case B9600:
    374             io->input_bitrate = 9600;
    375             break;
    376 #endif
    377 #ifdef B19200
    378         case B19200:
    379             io->input_bitrate = 19200;
    380             break;
    381 #endif
    382 #ifdef B38400
    383         case B38400:
    384             io->input_bitrate = 38400;
    385             break;
    386 #endif
    387 #ifdef B57600
    388         case B57600:
    389             io->input_bitrate = 57600;
    390             break;
    391 #endif
    392 #ifdef B115200
    393         case B115200:
    394             io->input_bitrate = 115200;
    395             break;
    396 #endif
    397 #ifdef B230400
    398         case B230400:
    399             io->input_bitrate = 230400;
    400             break;
    401 #endif
    402         default:
    403             io->input_bitrate = 1200;
    404             break;
    405     }
    406    
    407     switch (currtio.c_cflag & CSIZE)
    408     {
    409         case CS5:
    410             io->bits = 5;
    411             break;
    412         case CS6:
    413             io->bits = 6;
    414             break;
    415         case CS7:
    416             io->bits = 7;
    417             break;
    418         case CS8:
    419             io->bits = 8;
    420             break;
    421     }
    422    
    423     if (((currtio.c_cflag) & PARENB) == PARENB)
    424     {
    425         if (((currtio.c_cflag) & PARODD) == PARODD)
    426             io->parity = PARITY_ODD;
    427         else
    428             io->parity = PARITY_EVEN;
    429     }
    430     else
    431     {
    432         io->parity = PARITY_NONE;
    433     }
    434    
    435     if (((currtio.c_cflag) & CSTOPB) == CSTOPB)
    436         io->stopbits = 2;
    437     else
    438         io->stopbits = 1;
    439    
    440     if (ioctl (reader[ridx].handle, TIOCMGET, &mctl) < 0)
    441         return FALSE;
    442    
    443     io->dtr = ((mctl & TIOCM_DTR) ? IO_SERIAL_HIGH : IO_SERIAL_LOW);
    444     io->rts = ((mctl & TIOCM_RTS) ? IO_SERIAL_HIGH : IO_SERIAL_LOW);
    445    
    446 #ifdef DEBUG_IO
    447     printf("IO: Getting properties: %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", io->input_bitrate, io->bits, io->parity == PARITY_EVEN ? "Even" : io->parity == PARITY_ODD ? "Odd" : "None", io->stopbits, io->dtr, io->rts);
    448 #endif
    449    
    450     return TRUE;
    451 }
    452 
    453 bool IO_Serial_SetPropertiesOld (IO_Serial * io)
    454 {
    455    struct termios newtio;
    456    
    457 #ifdef SCI_DEV
    458    if(reader[ridx].typ == R_INTERNAL)
    459       return FALSE;
    460 #endif
    461    
    462    //   printf("IO: Setting properties: reader_type%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", reader[ridx].typ, io->input_bitrate, io->bits, io->parity == PARITY_EVEN ? "Even" : io->parity == PARITY_ODD ? "Odd" : "None", io->stopbits, io->dtr, io->rts);
    463    memset (&newtio, 0, sizeof (newtio));
    464 
    465 
     182bool IO_Serial_SetBitrate (unsigned long bitrate, struct termios * tio)
     183{
    466184   /* Set the bitrate */
    467185#ifdef OS_LINUX
    468186   if (reader[ridx].mhz == reader[ridx].cardmhz)
    469187#endif
    470    { //no overclocking
    471      cfsetospeed(&newtio, IO_Serial_Bitrate(io->output_bitrate));
    472      cfsetispeed(&newtio, IO_Serial_Bitrate(io->input_bitrate));
    473      cs_debug("standard baudrate: cardmhz=%d mhz=%d -> effective baudrate %lu", reader[ridx].cardmhz, reader[ridx].mhz, io->output_bitrate);
     188   { //no overcloking
     189     cfsetospeed(tio, IO_Serial_Bitrate(bitrate));
     190     cfsetispeed(tio, IO_Serial_Bitrate(bitrate));
     191     cs_debug("standard baudrate: cardmhz=%d mhz=%d -> effective baudrate %lu", reader[ridx].cardmhz, reader[ridx].mhz, bitrate);
    474192   }
    475193#ifdef OS_LINUX
     
    478196    struct serial_struct nuts;
    479197    ioctl(reader[ridx].handle, TIOCGSERIAL, &nuts);
    480     int custom_baud = io->output_bitrate * reader[ridx].mhz / reader[ridx].cardmhz;
     198    int custom_baud = bitrate * reader[ridx].mhz / reader[ridx].cardmhz;
    481199    nuts.custom_divisor = (nuts.baud_base + (custom_baud/2))/ custom_baud;
    482200    cs_debug("custom baudrate: cardmhz=%d mhz=%d custom_baud=%d baud_base=%d divisor=%d -> effective baudrate %d",
     
    485203    nuts.flags |= ASYNC_SPD_CUST;
    486204    ioctl(reader[ridx].handle, TIOCSSERIAL, &nuts);
    487     cfsetospeed(&newtio, IO_Serial_Bitrate(38400));
    488     cfsetispeed(&newtio, IO_Serial_Bitrate(38400));
     205    cfsetospeed(tio, IO_Serial_Bitrate(38400));
     206    cfsetispeed(tio, IO_Serial_Bitrate(38400));
    489207   }
    490208#endif
    491        
    492    /* Set the character size */
    493    switch (io->bits)
    494    {
     209    return TRUE;
     210}
     211
     212bool IO_Serial_SetParams (unsigned long bitrate, unsigned bits, int parity, unsigned stopbits, int dtr, int rts)
     213{
     214     struct termios newtio;
     215   
     216     if(reader[ridx].typ == R_INTERNAL)
     217            return FALSE;
     218     
     219     // printf("IO: Setting properties: reader_type%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", reader[ridx].typ, bitrate, bits, parity == PARITY_EVEN ? "Even" : parity == PARITY_ODD ? "Odd" : "None", stopbits, dtr, rts);
     220     memset (&newtio, 0, sizeof (newtio));
     221
     222    if (!IO_Serial_SetBitrate (bitrate, & newtio))
     223        return FALSE;
     224               
     225     /* Set the character size */
     226     switch (bits)
     227     {
    495228        case 5:
    496229            newtio.c_cflag |= CS5;
     
    511244   
    512245    /* Set the parity */
    513     switch (io->parity)
     246    switch (parity)
    514247    {
    515248        case PARITY_ODD:
     
    529262   
    530263    /* Set the number of stop bits */
    531     switch (io->stopbits)
     264    switch (stopbits)
    532265    {
    533266        case 1:
     
    553286    newtio.c_cc[VTIME] = 0;
    554287
    555 //  tcdrain(reader[ridx].handle);
    556     if (tcsetattr (reader[ridx].handle, TCSANOW, &newtio) < 0)
    557         return FALSE;
    558 //  tcflush(reader[ridx].handle, TCIOFLUSH);
    559 //  if (tcsetattr (reader[ridx].handle, TCSAFLUSH, &newtio) < 0)
    560 //      return FALSE;
    561 
    562     IO_Serial_Ioctl_Lock(1);
    563     IO_Serial_DTR_RTS(0, io->rts == IO_SERIAL_HIGH);
    564     IO_Serial_DTR_RTS(1, io->dtr == IO_SERIAL_HIGH);
    565     IO_Serial_Ioctl_Lock(0);
    566    
    567 #ifdef DEBUG_IO
    568     printf("IO: Setting properties: reader_type%d, %ld bps; %d bits/byte; %s parity; %d stopbits; dtr=%d; rts=%d\n", reader[ridx].typ, io->input_bitrate, io->bits, io->parity == PARITY_EVEN ? "Even" : io->parity == PARITY_ODD ? "Odd" : "None", io->stopbits, io->dtr, io->rts);
    569 #endif
    570     return TRUE;
    571 }
    572 
    573 bool IO_Serial_SetProperties (struct termios newtio)
    574 {
    575    if(reader[ridx].typ == R_INTERNAL)
    576       return FALSE;
    577 
    578     if (tcsetattr (reader[ridx].handle, TCSANOW, &newtio) < 0)
    579         return FALSE;
    580 //  tcflush(reader[ridx].handle, TCIOFLUSH);
    581 //  if (tcsetattr (reader[ridx].handle, TCSAFLUSH, &newtio) < 0)
    582 //      return FALSE;
    583 
    584     unsigned int mctl;
    585     if (ioctl (reader[ridx].handle, TIOCMGET, &mctl) < 0)
    586         return FALSE;
    587    
    588     int dtr = ((mctl & TIOCM_DTR) ? IO_SERIAL_HIGH : IO_SERIAL_LOW);
    589     int rts = ((mctl & TIOCM_RTS) ? IO_SERIAL_HIGH : IO_SERIAL_LOW);
     288    if (!IO_Serial_SetProperties(newtio))
     289        return FALSE;
     290
     291    reader[ridx].baudrate = bitrate;
    590292
    591293    IO_Serial_Ioctl_Lock(1);
     
    594296    IO_Serial_Ioctl_Lock(0);
    595297
     298    return TRUE;
     299}
     300
     301bool IO_Serial_SetProperties (struct termios newtio)
     302{
     303   if(reader[ridx].typ == R_INTERNAL)
     304      return FALSE;
     305
     306    if (tcsetattr (reader[ridx].handle, TCSANOW, &newtio) < 0)
     307        return FALSE;
     308//  tcflush(reader[ridx].handle, TCIOFLUSH);
     309//  if (tcsetattr (reader[ridx].handle, TCSAFLUSH, &newtio) < 0)
     310//      return FALSE;
     311
     312    unsigned int mctl;
     313    if (ioctl (reader[ridx].handle, TIOCMGET, &mctl) < 0)
     314        return FALSE;
     315   
    596316#ifdef DEBUG_IO
    597317    printf("IO: Setting properties\n");
     
    1032752static void IO_Serial_Clear (IO_Serial * io)
    1033753{
    1034     reader[ridx].handle = -1;
    1035     reader[ridx].typ = 0;
    1036754    memset (io->PnP_id, 0, IO_SERIAL_PNPID_SIZE);
    1037755    io->PnP_id_size = 0;
     
    1050768{
    1051769    int i = 0;
    1052     io->input_bitrate = 1200;
    1053     io->output_bitrate = 1200;
    1054     io->parity = PARITY_NONE;
    1055     io->bits = 7;
    1056     io->stopbits = 1;
    1057     io->dtr = IO_SERIAL_HIGH;
    1058     io->rts = IO_SERIAL_LOW;
    1059    
    1060     if (!IO_Serial_SetPropertiesOld (io))
     770  if (!IO_Serial_SetParams (1200, 7, PARITY_NONE, 1, IO_SERIAL_HIGH, IO_SERIAL_LOW))
    1061771        return FALSE;
    1062772
  • branches/smartreader/csctapi/io_serial.h

    r1239 r1254  
    8686
    8787/* Transmission properties */
    88 extern bool IO_Serial_SetPropertiesOld (IO_Serial * io);
    89 extern bool IO_Serial_GetPropertiesOld (IO_Serial * io);
    9088extern bool IO_Serial_DTR_RTS(int, int);
    9189#if defined(TUXBOX) && defined(PPC)
  • branches/smartreader/globals.h

    r1239 r1254  
    411411  int       card_status; //highlevel status
    412412  unsigned short status; //lowlevel status: states whether card inserted and/or change of status FIXME look at integration with pcsc_has_card/detect/card_status
    413     unsigned long baudrate; //we are storing baudrate to prevent unnecessary conversions from/to termios structure
     413    unsigned long baudrate; //we are storing the (for overclocking uncorrected) baudrate to prevent unnecessary conversions from/to termios structure
    414414  struct    s_module ph;
    415415  uchar     ncd_key[16];
  • branches/smartreader/oscam-config.c

    r1239 r1254  
    10331033        int l;
    10341034        void *ptr;
    1035         if ((l=strlen(trim(token))) < 6) continue;
     1035                char *tmp;
     1036                tmp = trim(token);
     1037
     1038                if (tmp[0] == '#') continue;
     1039                if ((l=strlen(tmp)) < 6) continue;
    10361040        if (!(payload=strchr(token, '|'))) continue;
    10371041        *payload++ = '\0';
    1038         //if (strlen(token)!=4) continue;
    10391042
    10401043        if (!(ptr = malloc(sizeof(struct s_srvid)))) {
Note: See TracChangeset for help on using the changeset viewer.