[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libftdi-git
Subject:    port libftdi to libusb-1.0 branch, master, updated. v0.17-54-ga3886df
From:       libftdi-git () developer ! intra2net ! com
Date:       2011-01-21 8:30:38
Message-ID: 20110121083038.A03AE278227 () developer ! intra2net ! com
[Download RAW message or body]

The branch, master has been updated
       via  a3886df38983951eb4b0abffd17aaf1a9018d42b (commit)
      from  889d9bb6786a03dfcd881a793beeb35c70590434 (commit)


- Log -----------------------------------------------------------------
commit a3886df38983951eb4b0abffd17aaf1a9018d42b
Author: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Date:   Thu Jan 20 16:51:21 2011 +0100

    Safer initialisation of ftdi_readstream
    
    Applies to both branches
    
    --
    Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

-----------------------------------------------------------------------

Summary of changes:
 src/ftdi_stream.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

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
      */


hooks/post-receive
-- 
port libftdi to libusb-1.0

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@developer.intra2net.com   

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic