The branch, master has been updated
via fd42de6914bde2916588bef3a08db3bd1302700f (commit)
via 8915c23ffcb58104256db934d332895de209759c (commit)
via fdb93a5e53a9fb8e7789be800d05b588e4c4ff79 (commit)
from 41fdb68d8ae4f556492addeae8366087e3576480 (commit)
- Log -----------------------------------------------------------------
commit fd42de6914bde2916588bef3a08db3bd1302700f
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date: Mon Sep 25 09:17:25 2017 +0200
Start ChangeLog for next version
commit 8915c23ffcb58104256db934d332895de209759c
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date: Mon Sep 25 09:16:13 2017 +0200
Add Pawel Jewstafjew to AUTHORS
commit fdb93a5e53a9fb8e7789be800d05b588e4c4ff79
Author: Pawel Jewstafjew <pawel.jewstafjew@xxxxxxxxx>
Date: Wed Sep 20 19:38:54 2017 +0100
fix support for XON/XOFF flow control
-----------------------------------------------------------------------
Summary of changes:
AUTHORS | 1 +
ChangeLog | 4 ++++
src/ftdi.c | 29 ++++++++++++++++++++++++++++-
src/ftdi.h | 1 +
4 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 43e5218..a621def 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -54,6 +54,7 @@ see Changelog for full details:
Nathan Fraser <ndf@xxxxxxxxxxxxxxx>
Oleg Seiljus <oseiljus@xxxxxxxxxx>
Paul Fertser <fercerpav@xxxxxxxxx>
+ Pawel Jewstafjew <pawel.jewstafjew@xxxxxxxxx>
Peter Holik <peter@xxxxxxxx>
Raphael Assenat <raph@xxxxxx>
Robert Cox <Robert.cox@xxxxxxxxxxxxxxx>
diff --git a/ChangeLog b/ChangeLog
index 04acd31..4c48fea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+New in 1.x - 2018-xx-xx
+-----------------------
+* Added ftdi_setflowctrl_xonxoff()
+
New in 1.4 - 2017-08-07
-----------------------
* New ftdi_usb_open_bus_addr() open function
diff --git a/src/ftdi.c b/src/ftdi.c
index b336c80..675f8ca 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -2263,9 +2263,11 @@ int ftdi_poll_modem_status(struct ftdi_context *ftdi,
unsigned short *status)
/**
Set flowcontrol for ftdi chip
+ Note: Do not use this function to enable XON/XOFF mode, use
ftdi_setflowctrl_xonxoff() instead.
+
\param ftdi pointer to ftdi_context
\param flowctrl flow control to use. should be
- SIO_DISABLE_FLOW_CTRL, SIO_RTS_CTS_HS, SIO_DTR_DSR_HS or
SIO_XON_XOFF_HS
+ SIO_DISABLE_FLOW_CTRL, SIO_RTS_CTS_HS, SIO_DTR_DSR_HS
\retval 0: all fine
\retval -1: set flow control failed
@@ -2285,6 +2287,31 @@ int ftdi_setflowctrl(struct ftdi_context *ftdi, int
flowctrl)
}
/**
+ Set XON/XOFF flowcontrol for ftdi chip
+
+ \param ftdi pointer to ftdi_context
+ \param xon character code used to resume transmission
+ \param xoff character code used to pause transmission
+
+ \retval 0: all fine
+ \retval -1: set flow control failed
+ \retval -2: USB device unavailable
+*/
+int ftdi_setflowctrl_xonxoff(struct ftdi_context *ftdi, unsigned char xon,
unsigned char xoff)
+{
+ if (ftdi == NULL || ftdi->usb_dev == NULL)
+ ftdi_error_return(-2, "USB device unavailable");
+
+ uint16_t xonxoff = xon | (xoff << 8);
+ if (libusb_control_transfer(ftdi->usb_dev, FTDI_DEVICE_OUT_REQTYPE,
+ SIO_SET_FLOW_CTRL_REQUEST, xonxoff,
(SIO_XON_XOFF_HS | ftdi->index),
+ NULL, 0, ftdi->usb_write_timeout) < 0)
+ ftdi_error_return(-1, "set flow control failed");
+
+ return 0;
+}
+
+/**
Set dtr line
\param ftdi pointer to ftdi_context
diff --git a/src/ftdi.h b/src/ftdi.h
index de02adf..b3e596e 100644
--- a/src/ftdi.h
+++ b/src/ftdi.h
@@ -546,6 +546,7 @@ extern "C"
/* flow control */
int ftdi_setflowctrl(struct ftdi_context *ftdi, int flowctrl);
+ int ftdi_setflowctrl_xonxoff(struct ftdi_context *ftdi, unsigned char xon,
unsigned char xoff);
int ftdi_setdtr_rts(struct ftdi_context *ftdi, int dtr, int rts);
int ftdi_setdtr(struct ftdi_context *ftdi, int state);
int ftdi_setrts(struct ftdi_context *ftdi, int state);
hooks/post-receive
--
A library to talk to FTDI chips
--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|