Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3504846imm; Sun, 13 May 2018 12:57:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpmeYBmnu3LLsLvP/Awcmil8hAN7HDSsbK44gEXj3gxLhqman+sl3ly8ZxTG+cW6/P4SK2D X-Received: by 2002:a17:902:c5:: with SMTP id a63-v6mr6897162pla.149.1526241478389; Sun, 13 May 2018 12:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526241478; cv=none; d=google.com; s=arc-20160816; b=r1pCa5BMwqrgD3lLAIJVsFrDjHx1WJURndl+HgX1DKuVmT5D6oGOnjHljF5wxiSDsY 8/rtpVto14ONEmh1yPUbae9sEIPUL9Te9LaUSsE/orUrcihZ5EBAZ/r0f1YMgViECBas AslZV0ATTs1hUD0jp5bQLUFFyFHH7Y9h+6+pFuM0WXY5x0uoDmKpne6W3eTvkZ8uo5KF JvDdg/E9Hv83Hw8rHZ785C2sk/ZamxRreF/mTEg8Jkbeeaf+0CpWzIl/aA0GH9RSdRZY S8oQTdw2MXjdaw7d23ms2ckUWgx2ZVcRmhTDPckoSiK/rlk5YsAfR9lvvacHocjJ/k3a ZvFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=bmrclvwnk20Nyi8/v3XrnNDie2pGk4E80MAjom1gDiI=; b=wQcDUZpg6sDFZPgF81gR8RfMQGFLU8mnWhD51ALl6up/bCzWXDH0veMgfge4dDbhfN spkyz/npkLlj7Q5a61kRODbIzDSMRC9E2okdu6AeSxRvtd3iT6Ix9NzQflQtQwhyrBig UfDVZiWs8wFvqqjcQCi26BR4ZRay6wRyAgIIf6j7d8pfEj06hHtkr2iSm2pdXlC8kwgc NfFV6/nAKV2zaKH+QjP2diHaL9giygSJDo1mP5xZ5brVm6tOzXgR9hIy5iH34FPs12zq hx279wIFhgkKM3LLz3sUXUjzsl+CMynx/zStyx2Tb+qjDR8uqh44v0L4e1o6cPl4YMAK 24Sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z25-v6si5318008pge.483.2018.05.13.12.57.43; Sun, 13 May 2018 12:57:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751981AbeEMT5a (ORCPT + 99 others); Sun, 13 May 2018 15:57:30 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:52936 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751295AbeEMT52 (ORCPT ); Sun, 13 May 2018 15:57:28 -0400 Received: from alans-desktop (82-70-14-226.dsl.in-addr.zen.co.uk [82.70.14.226]) by fuzix.org (8.15.2/8.15.2) with ESMTP id w4DJvQJe008151; Sun, 13 May 2018 20:57:26 +0100 Date: Sun, 13 May 2018 20:57:26 +0100 From: Alan Cox To: Grant Edwards Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: serial: custom baud rate Message-ID: <20180513205726.5029c88a@alans-desktop> In-Reply-To: References: Organization: Intel Corporation X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 May 2018 18:27:14 +0000 (UTC) Grant Edwards wrote: > 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] That shouldn't be true - all devices get passed ispeed/ospeed and everything in tree was using the correct fields as far as I could tell last time I checked this Alan