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)
MFC after:	2 weeks
This commit is contained in:
Gavin Atkinson 2010-08-08 20:53:00 +00:00
parent ee04083c8a
commit fe0f636233

View File

@ -599,25 +599,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