tty: uart: custom speed

Grant Edwards grant.b.edwards at gmail.com
Mon Mar 4 13:47:42 EST 2019


On 2019-03-04, Subhashini Rao Beerisetty <subhashbeerisetty at gmail.com> wrote:
> On Mon, Mar 4, 2019 at 8:27 PM Greg KH <gregkh at linuxfoundation.org> wrote:
>
>> Have you read the documentation on how to set custom baud rates?  I
>> can't find the link to it at the moment, but it is very possible to do
>> that today, no special ioctls are needed at all.  I think someone was
>> finally working on getting glibc to support it directly, but I do not
>> know if those patches ever got merged, so you would just have to "open
>> code" it in userspace if you want to do this.
>
> I could not find clear documentation on this, I’m very much thankful
> if someone point me on this. I thought of exploring TIOCGSERIAL and
> TIOCSSERIAL Ioctl’s to set custom baud rates. Now it looks like I
> should read the kernel code to understand how to achieve this without
> special ioctls.

You use the termios2 structure and TCGETS2/TCSETS ioctl calls:

    http://www.panix.com/~grante/arbitrary-baud.c

-- 
Grant










More information about the Kernelnewbies mailing list