kernel mode termios API's
Muni Sekhar
munisekharrms at gmail.com
Thu Mar 31 07:13:09 EDT 2016
On Wed, Mar 30, 2016 at 11:32 PM, Greg KH <greg at kroah.com> wrote:
> On Wed, Mar 30, 2016 at 09:23:00PM +0530, Muni Sekhar wrote:
>> Hi,
>>
>> We are having customized serial port driver, it always sets the baud
>> to 9600 (by configuring UART BAUD_RATE register) on device file open,
>> but not updating the termios structure.
>
> Please fix your driver. You do have the source for it, so this
> shouldn't be a problem, right?
>
> thanks,
>
> greg k-h
Yes, I am having the source code. It is a tiny TTY driver.
It sets the baud rate in three different functions [
tty_operations->open(), tty_operations->set_termios (),
tty_operations->ioctl() ]
It sets the fixed hard coded baud rate 9600 in tty_operations->open()
, in other places sets baud rate as user-space function requested.
I don’t know why it uses fixed baud rate in open. If a user-space
function queries baud (cfgetospeed() API) after open, it gets the
wrong value.
Can I update the termios structure before setting the baud rate as
mentioned below in tty_operations->open()?
tiny_tty_driver->init_termios = tty_std_termios;
tiny_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
In LINUX DEVICE DRIVERS book, TTY divers chapter says “When the port
is opened for the first time, any needed hardware initialization and
memory allocation can be done”, I would like to know what kind of
hardware initialization might be needed for the first time?
--
Thanks,
Sekhar
More information about the Kernelnewbies
mailing list