Re: usb : serial : ch341 : set tty baud speed according to tty struct

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

 



On Tue, Feb 17, 2015 at 10:11:55AM -0500, Nicolas PLANEL wrote:
>     Hi,
> 
> 
> According to git log your are currently the two maintainer of the ch341 usb
> serial driver.
> 
> Thanks to pyserial, that did not initialize the serial port speed like
> minicom.
> Basically pyserial only set the port speed (calling TIOCSSERIAL ioctl) if
> the user request a different value different currently used. (TIOCGSERIAL)
> 
> A long sentence in short code :
> 
> if ser.baudrate != user_requested_baudrate:
>    ser.baudrate = user_requested_baudrate
> 
> In short, if the python code open a serial port at a speed of 57600 baud,
> the hw speed line will be in reality at 9600 baud. (driver default speed)
> 
> 
> Regards,
> 
> Nicolas PLANEL
> 
> ===
> From 16df0d507a653c48f757635f717f2ba886f8c5ff Mon Sep 17 00:00:00 2001
> From: Nicolas PLANEL <nicolas.planel@xxxxxxxxxxxx>
> Date: Tue, 17 Feb 2015 00:59:14 -0500
> Subject: [PATCH] USB: ch341: set tty baud speed according to tty struct
> 
> The ch341_set_baudrate() function initialize the device baud speed according
> to the value on priv->baud_rate. By default the ch341_open() set it to a
> hardcoded value (DEFAULT_BAUD_RATE 9600). Unfortunately, the tty_struct is
> not initialized with the same default value. (usually 56700)
> 
> This means that the tty_struct and the device baud rate generator are not
> synchronized after opening the port.
> 
> Fixup is elementary simple by calling tty_get_baud_rate() and
> tty_encode_baud_rate() helper to sync up the baud rate during the
> ch341_open() call.
> ---
>  drivers/usb/serial/ch341.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Thanks for the patch, but in order to accept it we need a signed-off-by
line as the file Documentation/SubmittingPatches describes.

Also, just send the patch like this, without the text above, as we can't
hand-edit all emails for patches.

> 
> diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
> index 2d72aa3..2dbbbf6 100644
> --- a/drivers/usb/serial/ch341.c
> +++ b/drivers/usb/serial/ch341.c
> @@ -307,9 +307,13 @@ static int ch341_open(struct tty_struct *tty, struct
> usb_serial_port *port)
>  {
>      struct usb_serial *serial = port->serial;
>      struct ch341_private *priv = usb_get_serial_port_data(port);
> +    unsigned baud;
>      int r;

Also, your email client turned all tabs into spaces, making this patch
unable to be applied.  It also line-wrapped the patch :(

Can you fix this up and resend?

thanks,

greg k-h
--
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