LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Baud rate and other settings settings for Linux UART drivers through ioctls. (https://www.linuxquestions.org/questions/linux-kernel-70/baud-rate-and-other-settings-settings-for-linux-uart-drivers-through-ioctls-4175432855/)

kauuttt 10-18-2012 04:27 AM

Baud rate and other settings settings for Linux UART drivers through ioctls.
 
Hi All,

I want to write an application for using Linux UART driver. And for the same, I need to set baud rate, number of data bits, parity, stop bits, and hardware flow control.

I am finding the way to do the same through POSIX functions tcgetattr(3) and tcsetattr(3).

But not able to find the way to set it through ioctl().

Any suggestions friends.?

rtmistler 10-18-2012 12:50 PM

The ioctl calls for TTY can be viewed on most systems if you do "man tty_ioctl"; HOWEVER, you should also note that these should also say:

"Use of ioctl makes for non-portable programs. Use the POSIX interface described in termios(3) whenever possible."

And if you do a man on termios, you'll see that it guides you to use tcget/setattr() function calls instead.

Since you said you're accomplishing this using the tcgetattr() tcsetattr() calls, why are you trying to do it differently?


All times are GMT -5. The time now is 07:01 AM.