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).
This commit is contained in:
parent
cd3752a0a3
commit
0096beb078
@ -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 @@ 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));
|
||||
|
||||
@ -522,6 +522,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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user