Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2008 15:20:29 -0600 (MDT)
From:      Mike Durian <durian@shadetreesoftware.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   usb/128324: Unrestricted baud rates on PL2303X chips
Message-ID:  <200810232120.m9NLKT9m002611@carwash.boogie.com>
Resent-Message-ID: <200810232130.m9NLU2ns078401@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         128324
>Category:       usb
>Synopsis:       Unrestricted baud rates on PL2303X chips
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 23 21:30:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Mike Durian
>Release:        FreeBSD 7.1-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD carwash.boogie.com 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #14: Thu Oct 23 14:37:33 MDT 2008 root@carwash.boogie.com:/usr/obj/usr/src/sys/BOOGIE i386


	
>Description:
	A comment in the list off acceptable baud rates in the uplcom
	driver states that the PL2303X can set any rate.  If this is
	the case, then the check for standardized rates can be removed
	for this chip type.

	I don't know if the PL2303X can really set any baud rate, but
	with the patch below, I can at least set the rate to 10400, which
	is not one of the rates listed in uplcom_rates.
>How-To-Repeat:
	
>Fix:

--- uplcom.c.orig	2008-10-23 14:25:07.000000000 -0600
+++ uplcom.c	2008-10-23 14:29:21.000000000 -0600
@@ -810,13 +810,22 @@
 
 	DPRINTF(("uplcom_param: sc = %p\n", sc));
 
-	/* Check requested baud rate */
-	for (i = 0; i < N_UPLCOM_RATES; i++)
-		if (uplcom_rates[i] == t->c_ospeed)
-			break;
-	if (i == N_UPLCOM_RATES) {
-		DPRINTF(("uplcom_param: bad baud rate (%d)\n", t->c_ospeed));
-		return (EIO);
+	/*
+	 * Given the comment found in the uplcom_rates definition,
+	 * we do not need to verify the baud rate is a "common" rate
+	 * when using 2303X chips.  They support any baud rate, so
+	 * we can just accept what we are passed.
+	 */
+	if (sc->sc_chiptype != TYPE_PL2303X) {
+		/* Check requested baud rate */
+		for (i = 0; i < N_UPLCOM_RATES; i++)
+			if (uplcom_rates[i] == t->c_ospeed)
+				break;
+		if (i == N_UPLCOM_RATES) {
+			DPRINTF(("uplcom_param: bad baud rate (%d)\n",
+			    t->c_ospeed));
+			return (EIO);
+		}
 	}
 
 	USETDW(ls.dwDTERate, t->c_ospeed);

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810232120.m9NLKT9m002611>