Re: possible bug in the USB FTDI SIO driver

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

 



On Thu, Dec 15, 2011 at 09:30:04PM +0100, Torbjörn Lofterud wrote:
> 
> Hello.
> 
> I think that i might have found a small bug.
> 
> Im trying to communicate with the ECU in my Volvo Car and those
> people at Volvo figured it would be a smart thing to communicate
> at 10400 baud.
> 
> As a Linux geek I want to hack my car from Linux, so i set out to convince
> the ftdi_sio-driver to run at 10400 baud. As Im sure you are aware of
> custom baud-rates are a bit under-documented.
> 
> Using the custom divisor the value 2308 or 2307 gives me values that is
> reasonably close to 10400, but not 10400. In order to get the quotient of
> the division to be exactly 10400 i need to change the baud_base. But im
> unable to actually change the baud_base value.
> 
> Looking at the source the function set_serial_info() does sanity checking
> on the newly provided value, and im able to provoce the -EINVAL if i give
> it a value below 9600. But the code never actually updates the priv-struct
> with the new value.
> 
> if ((new_serial.baud_base != priv->baud_base) &&
>     (new_serial.baud_base < 9600)) {
>         mutex_unlock(&priv->cfg_lock);
>         return -EINVAL;
>    }
> 
> 
> So, currenly im unable to get 10400 baud :(
> 
> Am I doing it wrong, or is it a bug in the driver?

It is a bug _and_ you're doing it wrong. ;)

It's not possible to change the device specific baud_base so it's only
the above construct which is incorrect.

This seems to be due to a misunderstanding some years back (see
https://lkml.org/lkml/2005/1/20/84).

> Is there a better way to set the device to 10400 baud than to use the
> custom divisor?

AFAIK you're stuck with using a custom divisor.

Thanks,
Johan

 
> --- How to repeat:
> 
> # setserial /dev/ttyUSB0  baud_base 9600
> # setserial /dev/ttyUSB0  -a
> /dev/ttyUSB0, Line 0, UART: unknown, Port: 0x0000, IRQ: 0
>         Baud_base: 24000000, close_delay: 0, divisor: 2306
>         closing_wait: infinite
>         Flags: spd_cust low_latency
> 
> 
> Expected value: 9600
> Recieved value: 24000000
> 
> Kind regards
>  Torbjorn Lofterud
> 
--
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