Re: [PATCH v3] USB: pl2303: Rewrite pl2303_encode_baud_rate_divisor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 26, 2015 at 11:14:34AM +0200, Michał Pecio wrote:
> 
> This commit fixes the following issues:
> 
> 1. The 9th bit of buf was believed to be the LSB of divisor's
> exponent, but the hardware interprets it as MSB (9th bit) of the
> mantissa. The exponent is actually one bit shorter and applies
> to base 4, not 2 as previously believed.
> 
> 2. Loop iterations doubled the exponent instead of incrementing.
> 
> 3. The exponent wasn't checked for overflow.
> 
> 4. The function returned requested rate instead of actual rate.
> 
> Due to issue #2, the old code deviated from the wrong formula
> described in #1 and actually yielded correct rates when divisor
> was lower than 4096 by using exponents of 0, 2 or 4 base-2,
> interpreted as 0, 1, 2 base-4 with the 9th mantissa bit clear.
> However, at 93.75 kbaud or less the rate turned out too slow
> due to #2 or too fast due to #2 and #3.
> 
> I tested this patch by sending and validating 0x00,0x01,..,0xff
> to an FTDI dongle at 234, 987, 2401, 9601, 31415, 115199, 250k,
> 500k, 750k, 1M, 1.5M, 3M+1 baud. All rates passed.
> 
> I also used pv to check speed at some rates unsupported by FTDI:
> 45 (the lowest possible), 2M, 4M, 5M and 6M-1. Looked sane.
> 
> Signed-off-by: Michal Pecio <michal.pecio@xxxxxxxxx>

Now applied for 4.3 with stable tag for 3.18+. [ Low, non-standard
baudrates were first enabled by 399aa9a75ad3 ("USB: pl2303: use divisors
for unsupported baud rates" ].

Again, thanks for fixing this.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux