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. The python code(pySerial) reads the termios parameter for baud rate and only sets the baud rate if it needs to. So pySerial fails to work with this driver. Is there any kernel API to update termios structure about 9600 baud on driver device open? -- Thanks, Sekhar
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
On Wed, Mar 30, 2016 at 11:32 PM, Greg KH <greg@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
On Thu, Mar 31, 2016 at 04:43:09PM +0530, Muni Sekhar wrote:
On Wed, Mar 30, 2016 at 11:32 PM, Greg KH <greg@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.
Great, can you post it here so we can help out with it? What hardware is it for? thanks, greg k-h
participants (2)
-
Greg KH -
Muni Sekhar