summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uftdi.c
diff options
context:
space:
mode:
authorNathan Binkert <nate@cvs.openbsd.org>2002-07-29 03:01:49 +0000
committerNathan Binkert <nate@cvs.openbsd.org>2002-07-29 03:01:49 +0000
commitfa49780ea82c09c73f6f69b13542101d42845506 (patch)
treee4eb3d561a6a8810e1cfccd6417fd8bc7aec1510 /sys/dev/usb/uftdi.c
parent4086530d708bed9831a330ef620e851147763eee (diff)
Update from NetBSD. Log message:
Add code to setup hardware or software flow control (or none at all, if necessary) depending on the user-specified termios flags. This allows the device to talk to DCEs which don't assert RTS (i.e. dumb, 3-wire serial ports).
Diffstat (limited to 'sys/dev/usb/uftdi.c')
-rw-r--r--sys/dev/usb/uftdi.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c
index f02d9ec0f20..027e63ac443 100644
--- a/sys/dev/usb/uftdi.c
+++ b/sys/dev/usb/uftdi.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: uftdi.c,v 1.8 2002/07/25 02:18:10 nate Exp $ */
-/* $NetBSD: uftdi.c,v 1.10 2002/05/08 18:10:19 scw Exp $ */
+/* $OpenBSD: uftdi.c,v 1.9 2002/07/29 03:01:48 nate Exp $ */
+/* $NetBSD: uftdi.c,v 1.12 2002/07/18 14:44:10 scw Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -425,7 +425,7 @@ uftdi_param(void *vsc, int portno, struct termios *t)
struct uftdi_softc *sc = vsc;
usb_device_request_t req;
usbd_status err;
- int rate, data;
+ int rate, data, flow;
DPRINTF(("uftdi_param: sc=%p\n", sc));
@@ -521,6 +521,24 @@ uftdi_param(void *vsc, int portno, struct termios *t)
if (err)
return (EIO);
+ if (ISSET(t->c_cflag, CRTSCTS)) {
+ flow = FTDI_SIO_RTS_CTS_HS;
+ USETW(req.wValue, 0);
+ } else if (ISSET(t->c_iflag, IXON|IXOFF)) {
+ flow = FTDI_SIO_XON_XOFF_HS;
+ USETW2(req.wValue, t->c_cc[VSTOP], t->c_cc[VSTART]);
+ } else {
+ flow = FTDI_SIO_DISABLE_FLOW_CTRL;
+ USETW(req.wValue, 0);
+ }
+ req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
+ req.bRequest = FTDI_SIO_SET_FLOW_CTRL;
+ USETW2(req.wIndex, flow, portno);
+ USETW(req.wLength, 0);
+ err = usbd_do_request(sc->sc_udev, &req, NULL);
+ if (err)
+ return (EIO);
+
return (0);
}