svn commit: r213051 - stable/8/sys/dev/usb/serial
Gavin Atkinson
gavin at FreeBSD.org
Thu Sep 23 09:52:28 UTC 2010
Author: gavin
Date: Thu Sep 23 09:52:27 2010
New Revision: 213051
URL: http://svn.freebsd.org/changeset/base/213051
Log:
Merge r211083 from head:
The PL2302X can support any baud rate <= 6Mbps, allow any rate to be set.
PR: usb/128324
Submitted by: Mike Durian <durian shadetreesoftware.com> (original patch)
Modified:
stable/8/sys/dev/usb/serial/uplcom.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/dev/usb/serial/uplcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 09:05:40 2010 (r213050)
+++ stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 09:52:27 2010 (r213051)
@@ -597,25 +597,33 @@ static const int32_t uplcom_rates[] = {
static int
uplcom_pre_param(struct ucom_softc *ucom, struct termios *t)
{
+ struct uplcom_softc *sc = ucom->sc_parent;
uint8_t i;
DPRINTF("\n");
- /* check requested baud rate */
-
- for (i = 0;; i++) {
-
- if (i != N_UPLCOM_RATES) {
- if (uplcom_rates[i] == t->c_ospeed) {
- break;
- }
- } else {
- DPRINTF("invalid baud rate (%d)\n", t->c_ospeed);
- return (EIO);
+ /**
+ * Check requested baud rate.
+ *
+ * The PL2303 can only set specific baud rates, up to 1228800 baud.
+ * The PL2303X can set any baud rate up to 6Mb.
+ * The PL2303HX rev. D can set any baud rate up to 12Mb.
+ *
+ * XXX: We currently cannot identify the PL2303HX rev. D, so treat
+ * it the same as the PL2303X.
+ */
+ if (sc->sc_chiptype == TYPE_PL2303) {
+ for (i = 0; i < N_UPLCOM_RATES; i++) {
+ if (uplcom_rates[i] == t->c_ospeed)
+ return (0);
}
+ } else {
+ if (t->c_ospeed <= 6000000)
+ return (0);
}
- return (0);
+ DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed);
+ return (EIO);
}
static void
More information about the svn-src-stable-8
mailing list