Changeset 70 for trunk/module-serial.c


Ignore:
Timestamp:
05/12/09 05:25:27 (12 years ago)
Author:
rorothetroll
Message:

csctapi/io_serial.c : fix the serial port read/write wait routine to use select instead of poll

This make them compatible with Mac OS X and now oscamd works on OS X. The same code off course
still works on linux and other unix platforms. I let that code ran for 24h before commiting this code.
If you have any issue let me know and I'llr evert to poll for non compatible machines.

all the others : fix all the warning due to sign difference (mostly uchar versus char). This make the code compile

with -Werror on the more strict version of gcc (which is the case on OS X). I also noticed that in a lot of places
the code use a buffer defined as an uchar * ... and use strings functions (strnXXXX) where some memcpy/memcmp .. function
would have been preferable as we're suposedly manipulation a binary buffer. Anyway I fixed all of them and it now compile
without any warning or error on linux and OS X (and also probably on all the other unices but we will have to try before
adding -Werror on the other platform).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module-serial.c

    r56 r70  
    378378                           {
    379379                             uchar b;
    380                              if (cs_atob(&b, buf+17, 1)<0)
     380                             if (cs_atob(&b, (char *)buf+17, 1)<0)
    381381                               p=(-2);
    382382                             else {
     
    429429            if( oscam_ser_selrec(buf, 2, l, &n) )
    430430            {
    431               if( cs_atoi(buf+n-2, 1, 1)==0xFFFFFFFF )
     431              if( cs_atoi((char *)buf+n-2, 1, 1)==0xFFFFFFFF )
    432432              {
    433433                switch( (buf[n-2]<<8)|buf[n-1] )
     
    439439              }else{
    440440                if( oscam_ser_selrec(buf, 2, l, &n) )
    441                   if( cs_atoi(buf+n-2, 1, 1)==0xFFFFFFFF )
     441                  if( cs_atoi((char *)buf+n-2, 1, 1)==0xFFFFFFFF )
    442442                    dsr9500type=P_DSR_UNKNOWN;
    443443                  else
     
    746746    case P_DSR95:
    747747      buf[l]='\0';  // prepare for trim
    748       trim(buf+13); // strip spc, nl, cr ...
    749       er->l=strlen(buf+13)>>1;
    750       er->prid=cs_atoi(buf+3, 3, 0);    // ignore errors
    751       er->caid=cs_atoi(buf+9, 2, 0);    // ignore errors
    752       if (cs_atob(er->ecm, buf+13, er->l)<0)
     748      trim((char *)buf+13); // strip spc, nl, cr ...
     749      er->l=strlen((char *)buf+13)>>1;
     750      er->prid=cs_atoi((char *)buf+3, 3, 0);    // ignore errors
     751      er->caid=cs_atoi((char *)buf+9, 2, 0);    // ignore errors
     752      if (cs_atob(er->ecm, (char *)buf+13, er->l)<0)
    753753      {
    754754        cs_log("illegal characters in ecm-request");
     
    758758      {
    759759        er->l-=2;
    760         er->srvid=cs_atoi(buf+13+(er->l<<1), 2, 0);
     760        er->srvid=cs_atoi((char *)buf+13+(er->l<<1), 2, 0);
    761761      }
    762762      break;
     
    932932      if( dsr9500type==P_DSR_WITHSID )
    933933      {
    934         sprintf(buf, "%c%08lX%04X%s%04X\n\r",
     934        sprintf((char *)buf, "%c%08lX%04X%s%04X\n\r",
    935935          3, er->prid, er->caid, cs_hexdump(0, er->ecm, er->l), er->srvid);
    936936        oscam_ser_send(buf, (er->l<<1)+19); // 1 + 8 + 4 + l*2 + 4 + 2
     
    938938      else
    939939      {
    940         sprintf(buf, "%c%08lX%04X%s\n\r",
     940        sprintf((char *)buf, "%c%08lX%04X%s\n\r",
    941941          3, er->prid, er->caid, cs_hexdump(0, er->ecm, er->l));
    942942        oscam_ser_send(buf, (er->l<<1)+15); // 1 + 8 + 4 + l*2 + 2
Note: See TracChangeset for help on using the changeset viewer.