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/csctapi/ifd_towitoko.c

    r67 r70  
    555555        if(ioctl(ifd->io->fd, IOCTL_SET_ATR_READY)<0)
    556556            return IFD_TOWITOKO_IO_ERROR;
    557 #ifdef OS_MACOSX
    558         while(n<SCI_MAX_ATR_SIZE && IO_Serial_Read_MacOSX(ifd->io, IFD_TOWITOKO_ATR_TIMEOUT, 1, buf+n))
    559 #else           
    560557        while(n<SCI_MAX_ATR_SIZE && IO_Serial_Read(ifd->io, IFD_TOWITOKO_ATR_TIMEOUT, 1, buf+n))
    561 #endif
    562558        {
    563559            n++;
     
    760756        if ((sent == 0) && (block_delay != char_delay))
    761757        {
    762 #ifdef OS_MACOSX
    763             if (!IO_Serial_Write_MacOSX (ifd->io, block_delay, 1, buffer))
    764 #else
    765758            if (!IO_Serial_Write (ifd->io, block_delay, 1, buffer))
    766 #endif
    767759                return IFD_TOWITOKO_IO_ERROR;
    768760           
    769 #ifdef OS_MACOSX
    770             if (!IO_Serial_Write_MacOSX (ifd->io, char_delay, to_send-1, buffer+1))
    771 #else
    772761            if (!IO_Serial_Write (ifd->io, char_delay, to_send-1, buffer+1))
    773 #endif
    774762                return IFD_TOWITOKO_IO_ERROR;
    775763        }
    776764        else
    777765        {
    778 #ifdef OS_MACOSX
    779             if (!IO_Serial_Write_MacOSX (ifd->io, char_delay, to_send, buffer+sent))
    780 #else
    781766            if (!IO_Serial_Write (ifd->io, char_delay, to_send, buffer+sent))
    782 #endif
    783767                return IFD_TOWITOKO_IO_ERROR;
    784768        }
     
    806790    {
    807791        /* Read first byte using block timeout */
    808 #ifdef OS_MACOSX
    809         if (!IO_Serial_Read_MacOSX (ifd->io, block_timeout, 1, buffer))
    810 #else
    811792        if (!IO_Serial_Read (ifd->io, block_timeout, 1, buffer))
    812 #endif
    813793            return IFD_TOWITOKO_IO_ERROR;
    814794       
     
    816796        {
    817797            /* Read remaining data bytes using char timeout */
    818 #ifdef OS_MACOSX
    819             if (!IO_Serial_Read_MacOSX (ifd->io, char_timeout, size - 1, buffer + 1))
    820 #else
    821798            if (!IO_Serial_Read (ifd->io, char_timeout, size - 1, buffer + 1))
    822 #endif
    823799                return IFD_TOWITOKO_IO_ERROR;
    824800        }
     
    827803    {
    828804        /* Read all data bytes with the same timeout */
    829 #ifdef OS_MACOSX
    830         if (!IO_Serial_Read_MacOSX (ifd->io, char_timeout, size, buffer))
    831 #else
    832805        if (!IO_Serial_Read (ifd->io, char_timeout, size, buffer))
    833 #endif
    834806            return IFD_TOWITOKO_IO_ERROR;
    835807    }
Note: See TracChangeset for help on using the changeset viewer.