File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 88#include < ftdi.h>
99#include < unistd.h>
1010#include < string.h>
11+
1112#include " board.hpp"
13+ #include " display.hpp"
1214#include " ftdipp_mpsse.hpp"
1315#include " ftdispi.hpp"
1416
@@ -203,17 +205,29 @@ int FtdiSpi::ft2232_spi_wr_and_rd(//struct ftdi_spi *spi,
203205 }
204206
205207 ret = mpsse_store (buf, xfer);
206- if (ret)
207- printf (" send_buf failed before read: %i %s\n " , ret, ftdi_get_error_string (_ftdi));
208+ if (ret) {
209+ printError (" send_buf failed before read with error: " +
210+ std::string (ftdi_get_error_string (_ftdi)) + " (" +
211+ std::to_string (ret) + " )" );
212+ return ret;
213+ }
208214 if (readarr) {
209215 ret = mpsse_read (rx_ptr, xfer);
210- if (ret < 0 )
211- printf (" get_buf failed: %i %s\n " , ret, ftdi_get_error_string (_ftdi));
216+ if (ret < 0 ) {
217+ printError (" read failed with error: " +
218+ std::string (ftdi_get_error_string (_ftdi)) + " (" +
219+ std::to_string (ret) + " )" );
220+ return ret;
221+ }
212222 rx_ptr += xfer;
213223 } else {
214224 ret = mpsse_write ();
215- if (ret < 0 )
216- printf (" error: %i %s\n " , ret, ftdi_get_error_string (_ftdi));
225+ if (ret < 0 ) {
226+ printError (" write failed with error: " +
227+ std::string (ftdi_get_error_string (_ftdi)) + " (" +
228+ std::to_string (ret) + " )" );
229+ return ret;
230+ }
217231 }
218232 len -= xfer;
219233
You can’t perform that action at this time.
0 commit comments