kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* kernel mode termios API's
@ 2016-03-30 15:53 Muni Sekhar
  2016-03-30 18:02 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Muni Sekhar @ 2016-03-30 15:53 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* kernel mode termios API's
  2016-03-30 15:53 kernel mode termios API's Muni Sekhar
@ 2016-03-30 18:02 ` Greg KH
  2016-03-31 11:13   ` Muni Sekhar
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2016-03-30 18:02 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* kernel mode termios API's
  2016-03-30 18:02 ` Greg KH
@ 2016-03-31 11:13   ` Muni Sekhar
  2016-03-31 16:02     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Muni Sekhar @ 2016-03-31 11:13 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* kernel mode termios API's
  2016-03-31 11:13   ` Muni Sekhar
@ 2016-03-31 16:02     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2016-03-31 16:02 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-31 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 15:53 kernel mode termios API's Muni Sekhar
2016-03-30 18:02 ` Greg KH
2016-03-31 11:13   ` Muni Sekhar
2016-03-31 16:02     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).