Re: [PATCH v2 2/6] serial: core: add sysfs attribute to suppress ready signalling on open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 31. 05. 22, 6:36, Mychaela N. Falconia wrote:
From: Johan Hovold <johan@xxxxxxxxxx>

Add a nordy sysfs attribute to suppress raising the modem-control lines
on open to signal DTE readiness.

This can be used to prevent undesirable side-effects on open for
applications where the DTR and RTS lines are used for non-standard
purposes such as generating power-on and reset pulses.

Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
Signed-off-by: Mychaela N. Falconia <falcon@xxxxxxxxxxxxxxx>
---
  Documentation/ABI/testing/sysfs-tty |  7 +++++++
  drivers/tty/serial/serial_core.c    | 26 ++++++++++++++++++++++++++
  2 files changed, 33 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-tty b/Documentation/ABI/testing/sysfs-tty
index 820e412d38a8..98cb5cf0af75 100644
--- a/Documentation/ABI/testing/sysfs-tty
+++ b/Documentation/ABI/testing/sysfs-tty
@@ -161,3 +161,10 @@ Contact:	Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
  Description:
  		 Allows user to detach or attach back the given device as
  		 kernel console. It shows and accepts a boolean variable.
+
+What:		/sys/class/tty/ttyS0/nordy

s@ttyS0@ttyS<x>@

+Date:		November 2020
+Contact:	Johan Hovold <johan@xxxxxxxxxx>
+Description:
+		 Show and store the port NORDY flag which suppresses raising
+		 the modem-control lines on open to signal DTE readiness.
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 9a85b41caa0a..a17ac4efaceb 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2870,6 +2870,30 @@ static ssize_t console_store(struct device *dev,
  	return ret < 0 ? ret : count;
  }
+static ssize_t nordy_show(struct device *dev, struct device_attribute *attr,
+				char *buf)
+{
+	struct tty_port *port = dev_get_drvdata(dev);
+
+	return sprintf(buf, "%d\n", tty_port_nordy(port));

sysfs_emit()? (Even if I know %d won't overflow PAGE_SIZE :P.)


thanks,
--
js
suse labs



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux