RE: [PATCH] BlueZ line discipline baud rate setting update

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

 



Hi Marcel,

________________________________________
From: Marcel Holtmann [marcel@xxxxxxxxxxxx]
Sent: Wednesday, June 17, 2015 9:16 AM
To: Ilya Faenson
Cc: linux-bluetooth@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] BlueZ line discipline baud rate setting update

Hi Ilya,

> Bring the tty into a known 8 bits, 1 start bit, 1 stop bit,
> hardware flow control state with a given baud rate.
>
> Signed-off-by: Ilya Faenson <ifaenson@xxxxxxxxxxxx>
> ---
> drivers/bluetooth/hci_ldisc.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
> index ac87346..606cc5a 100644
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -271,9 +271,16 @@ void hci_uart_set_baudrate(struct hci_uart *hu, unsigned int speed)
>       struct tty_struct *tty = hu->tty;
>       struct ktermios ktermios;
>
> +     /* Bring the UART into a known state with a given baud rate */
>       ktermios = tty->termios;
>       ktermios.c_cflag &= ~CBAUD;
> -     ktermios.c_cflag |= BOTHER;
> +     ktermios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
> +                         IGNCR | ICRNL | IXON);
> +     ktermios.c_oflag &= ~OPOST;
> +     ktermios.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
> +     ktermios.c_cflag &= ~(CSIZE | PARENB | CBAUD);
> +     ktermios.c_cflag |= CS8;
> +     ktermios.c_cflag |= CRTSCTS;
>       tty_termios_encode_baud_rate(&ktermios, speed, speed);

with the questions raised by the others, I think for now we just want to change the baud rate and leave the rest to a more generic function. I am fine if the kernel side wants to enforce the settings on the UART. That seems fully reasonable. However we need to give drivers a chance to let it come from userspace as well and honor whatever they configured there.

So we need to clear CBAUD and then encode the baud rate. Do we need to bother with BOTHER or is that just not needed at all. I really like to get this detail fixed as soon as possible since we are close to the merge window.

IF: The BOTHER is not needed. Okay: if this function deals with the baud rate only, I will then introduce a separate function to bring the UART into a reasonable default state for Bluetooth as part of the next Broadcom patch set. I'll try publishing them today if my other duties do not interfere.

Regards

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



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux