X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=src%2Fftdi_stream.c;h=6b5b61ce3ff79be503d44757e57cd1b81a722b07;hp=6c40327b93f3252e3f46a23d700e0e4f28dea824;hb=3a55cda4af2de515d7c83738a12ffc95f8865091;hpb=e6ac34c8096624d5b982a30c40eb626fbe12429d diff --git a/src/ftdi_stream.c b/src/ftdi_stream.c index 6c40327..6b5b61c 100644 --- a/src/ftdi_stream.c +++ b/src/ftdi_stream.c @@ -153,6 +153,20 @@ ftdi_readstream(struct ftdi_context *ftdi, int xferIndex; int err = 0; + /* We don't know in what state we are, switch to reset*/ + if (ftdi_set_bitmode(ftdi, 0xff, BITMODE_RESET) < 0) + { + fprintf(stderr,"Can't reset mode\n"); + return 1; + } + + /* Purge anything remaining in the buffers*/ + if (ftdi_usb_purge_buffers(ftdi) < 0) + { + fprintf(stderr,"Can't Purge\n"); + return 1; + } + /* * Set up all transfers */