--- src/ftdi.c	2005-08-24 21:00:25.000000000 +0200
+++ src/ftdi.c	2005-12-09 11:47:08.000000000 +0100
@@ -1022,3 +1022,47 @@
 {
     return ftdi->error_str;
 }
+
+int ftdi_setflowctrl(struct ftdi_context *dev, int flowctrl)
+{
+    char buf;
+    int rv;
+
+    rv = usb_control_msg(dev->usb_dev, SIO_SET_FLOW_CTRL_REQUEST_TYPE, 
+            SIO_SET_FLOW_CTRL_REQUEST, 0, (flowctrl | dev->interface), &buf, 0, 5000);
+    return rv;
+}
+
+int ftdi_setdtr(struct ftdi_context *dev, int state)
+{
+    char buf;
+    unsigned ftdi_high_or_low;
+    int rv;
+
+    if (state) 
+        ftdi_high_or_low = SIO_SET_DTR_HIGH;
+    else
+        ftdi_high_or_low = SIO_SET_DTR_LOW;
+    
+    rv = usb_control_msg(dev->usb_dev, SIO_SET_MODEM_CTRL_REQUEST_TYPE, 
+            SIO_SET_MODEM_CTRL_REQUEST, ftdi_high_or_low, dev->interface, &buf, 0, 5000);
+    return rv;
+}
+
+int ftdi_setrts(struct ftdi_context *dev, int state)
+{
+    char buf;
+    unsigned ftdi_high_or_low;
+    int rv;
+
+    if (state) 
+        ftdi_high_or_low = SIO_SET_RTS_HIGH;
+    else
+        ftdi_high_or_low = SIO_SET_RTS_LOW;
+    
+    rv = usb_control_msg(dev->usb_dev, SIO_SET_MODEM_CTRL_REQUEST_TYPE, 
+            SIO_SET_MODEM_CTRL_REQUEST, ftdi_high_or_low, dev->interface, &buf, 0, 5000);
+    return rv;
+}
+
+
diff -aur ./src/ftdi.h ../../libftdi-0.7/src/ftdi.h
--- src/ftdi.h	2005-06-12 13:12:27.000000000 +0200
+++ src/ftdi.h	2005-12-09 11:52:58.000000000 +0100
@@ -82,6 +82,36 @@
 /* Address High */
 /* Address Low  */
 
+/* Definitions for flow control */
+/*
+ * Flow control code adapted from Linux kernel sources
+ * by Lorenz Moesenlechner (lorenz@hcilab.org) and 
+ * Matthias Kranz  (matthias@hcilab.org)
+ * */
+#define SIO_MODEM_CTRL     1 /* Set the modem control register */
+#define SIO_SET_FLOW_CTRL  2 /* Set flow control register */
+
+#define SIO_SET_FLOW_CTRL_REQUEST_TYPE 0x40
+#define SIO_SET_FLOW_CTRL_REQUEST SIO_SET_FLOW_CTRL
+
+#define SIO_DISABLE_FLOW_CTRL 0x0 
+#define SIO_RTS_CTS_HS (0x1 << 8)
+#define SIO_DTR_DSR_HS (0x2 << 8)
+#define SIO_XON_XOFF_HS (0x4 << 8)
+
+#define SIO_SET_MODEM_CTRL_REQUEST_TYPE 0x40
+#define SIO_SET_MODEM_CTRL_REQUEST SIO_MODEM_CTRL
+
+#define SIO_SET_DTR_MASK 0x1
+#define SIO_SET_DTR_HIGH ( 1 | ( SIO_SET_DTR_MASK  << 8))
+#define SIO_SET_DTR_LOW  ( 0 | ( SIO_SET_DTR_MASK  << 8))
+#define SIO_SET_RTS_MASK 0x2
+#define SIO_SET_RTS_HIGH ( 2 | ( SIO_SET_RTS_MASK << 8 ))
+#define SIO_SET_RTS_LOW ( 0 | ( SIO_SET_RTS_MASK << 8 ))
+
+#define SIO_RTS_CTS_HS (0x1 << 8)
+
+
 struct ftdi_context {
     // USB specific
     struct usb_dev_handle *usb_dev;
@@ -194,6 +224,34 @@
 
     char *ftdi_get_error_string(struct ftdi_context *ftdi);
 
+    /*
+     * Flow control code adapted from Linux kernel sources
+     * by Lorenz Moesenlechner (lorenz@hcilab.org) and 
+     * Matthias Kranz  (matthias@hcilab.org)
+     * */
+    
+    /**
+     * Set flowcontrol for ftdi chip
+     * \param dev device context of ftdi
+     * \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   
+     */
+    int ftdi_setflowctrl(struct ftdi_context *dev, int flowctrl);
+
+    /**
+     * Set dtr line
+     * \param dev device context of ftdi
+     * \param state state to set line to (1 or 0)
+     */
+    int ftdi_setdtr(struct ftdi_context *dev, int state);
+    
+    /**
+     * Set rts line
+     * \param dev device context of ftdi
+     * \param state state to set line to (1 or 0)
+     */
+    int ftdi_setrts(struct ftdi_context *dev, int state);
+     
 #ifdef __cplusplus
 }
 #endif
