Index: src/ftdi.c =================================================================== --- src/ftdi.c (revision 3932) +++ src/ftdi.c (working copy) @@ -1173,14 +1173,24 @@ static void ftdi_read_data_cb(struct lib if (actual_length > 2) { - // skip FTDI status bytes. - // Maybe stored in the future to enable modem use + unsigned char byte0; + num_of_chunks = actual_length / packet_size; chunk_remains = actual_length % packet_size; //printf("actual_length = %X, num_of_chunks = %X, chunk_remains = %X, readbuffer_offset = %X\n", actual_length, num_of_chunks, chunk_remains, ftdi->readbuffer_offset); - ftdi->readbuffer_offset += 2; - actual_length -= 2; + // skip FTDI status bytes. + // Maybe stored in the future to enable modem use + // Some Linux distributions, like SuSE 11.0 and 11.1, will return + // multiple FTDI status bytes in one packet. Skipt all of them. + byte0 = (ftdi->type == TYPE_2232H || ftdi->type == TYPE_4232H) ? 0x32 : 0x31; + while (ftdi->readbuffer[ftdi->readbuffer_offset] == byte0 + && ftdi->readbuffer[ftdi->readbuffer_offset + 1] == 0x60 + && actual_length >= tc->size + 2) + { + ftdi->readbuffer_offset += 2; + actual_length -= 2; + } if (actual_length > packet_size - 2) { @@ -1438,7 +1448,9 @@ int ftdi_transfer_data_done(struct ftdi_ } } - if (tc->transfer->status == LIBUSB_TRANSFER_COMPLETED) + if (!tc->transfer) + ret = tc->size; + else if (tc->transfer->status == LIBUSB_TRANSFER_COMPLETED) ret = tc->offset; else ret = -1;