From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751447AbeECS3o (ORCPT ); Thu, 3 May 2018 14:29:44 -0400 Received: from [195.159.176.226] ([195.159.176.226]:49872 "EHLO blaine.gmane.org" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751075AbeECS3k (ORCPT ); Thu, 3 May 2018 14:29:40 -0400 X-Injected-Via-Gmane: http://gmane.org/ To: linux-kernel@vger.kernel.org From: Grant Edwards Subject: Re: serial: custom baud rate Date: Thu, 3 May 2018 18:27:14 +0000 (UTC) Message-ID: References: X-Complaints-To: usenet@blaine.gmane.org User-Agent: slrn/1.0.2 (Linux) Cc: linux-serial@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-05-03, Muni Sekhar wrote: > If I need to set a custom baud rates(e.g. 14400, 128000, 256000), does > Linux serial framework has any supporting method? Sure, use the termios2 structure instead of the termios structure: #include struct termios2 t; ioctl(fd, TCGETS2, &t) t.c_cflag &= ~CBAUD; t.c_cflag |= BOTHER; t.c_ispeed = baud; t.c_ospeed = baud; ioctl(fd, TCSETS2, &t) [Not all devices/drivers support termios2] -- Grant Edwards grant.b.edwards Yow! Are we live or on at tape? gmail.com