Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Add code to setup hardware or software flow cont...
details: https://anonhg.NetBSD.org/src/rev/b7f45dee2435
branches: trunk
changeset: 534150:b7f45dee2435
user: scw <scw%NetBSD.org@localhost>
date: Thu Jul 18 14:44:10 2002 +0000
description:
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:
sys/dev/usb/uftdi.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diffs (52 lines):
diff -r 959c76d336d1 -r b7f45dee2435 sys/dev/usb/uftdi.c
--- a/sys/dev/usb/uftdi.c Thu Jul 18 13:31:58 2002 +0000
+++ b/sys/dev/usb/uftdi.c Thu Jul 18 14:44:10 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uftdi.c,v 1.11 2002/07/11 21:14:27 augustss Exp $ */
+/* $NetBSD: uftdi.c,v 1.12 2002/07/18 14:44:10 scw Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.11 2002/07/11 21:14:27 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.12 2002/07/18 14:44:10 scw Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -426,7 +426,7 @@
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));
@@ -522,6 +522,24 @@
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);
}
Home |
Main Index |
Thread Index |
Old Index