libftdi Archives

Subject: C++ flush() Never Flushes RX

From: "Eric S." <eric@xxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 16 Jan 2017 14:46:23 -0500
The file ftdi.hpp contains
     enum Direction
     {
         Input,
         Output
     };
 
The file ftdi.cpp contains
  int Context::flush(int mask)
  {
      int ret = 1;

      if (mask & Input)
          ret &= ftdi_usb_purge_rx_buffer(d->ftdi);
      if (mask & Output)
         ret &= ftdi_usb_purge_tx_buffer(d->ftdi);

     return ret;
  }

Since the enumeration assigns the value "0" to Input, the input queue is
never flushed.
The enumeration should be something like

The file ftdi.hpp contains
     enum Direction
     {
         Input  = 0x1,
         Output = 0x2
     };


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

Current Thread