[Patch] ioctl/ TCGETS etc: Decode the line properities bits, parity and stop bits
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Thu Sep 27 16:17:22 UTC 2012
Hello,
please consider including following patch. It prints out the uart line
parameters with the appropriate ioctl.
Bye
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>From 15b0863a71f5d435ab975211c6bc3fa72a2c2d45 Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon at elektron.ikp.physik.tu-darmstadt.de>
Date: Wed, 26 Sep 2012 14:34:53 +0200
Subject: ioctl/ TCGETS etc: Decode the line properities bits, parity and
stop bits
---
term.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/term.c b/term.c
index 7b7de74..fefb1a4 100644
--- a/term.c
+++ b/term.c
@@ -164,6 +164,27 @@ static const struct xlat modem_flags[] = {
{ 0, NULL, },
};
+static const struct xlat parity_options[] = {
+ { PARENB|PARODD,"O" },
+ { PARENB, "E" },
+ { 0, "N" },
+ { 0, NULL },
+};
+
+static const struct xlat bit_options[] = {
+ { CS8, "8" },
+ { CS7, "7" },
+ { CS6, "6" },
+ { 0, "8" },
+ { 0, NULL },
+};
+
+static const struct xlat sbit_options[] = {
+ { CSTOPB, "2" },
+ { 0, "1" },
+ { 0, NULL },
+};
+
int term_ioctl(struct tcb *tcp, long code, long arg)
{
struct termios tios;
@@ -193,6 +214,10 @@ int term_ioctl(struct tcb *tcp, long code, long arg)
if (abbrev(tcp)) {
tprints(", {");
printxval(baud_options, tios.c_cflag & CBAUD, "B???");
+ tprints(" ");
+ printxval(bit_options, tios.c_cflag & CSIZE, "???");
+ printxval(parity_options, tios.c_cflag & (PARENB|PARODD), "???");
+ printxval(sbit_options, tios.c_cflag & CSTOPB, "???");
tprintf(" %sopost %sisig %sicanon %secho ...}",
(tios.c_oflag & OPOST) ? "" : "-",
(tios.c_lflag & ISIG) ? "" : "-",
--
1.7.7
More information about the Strace-devel
mailing list