linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jean-François Lessard" <jefflessard3@gmail.com>
To: Andy Shevchenko <andy@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] auxdisplay: linedisp: add num_chars sysfs attribute
Date: Sun, 31 Aug 2025 22:00:27 -0400	[thread overview]
Message-ID: <20250901020033.60196-4-jefflessard3@gmail.com> (raw)
In-Reply-To: <20250901020033.60196-1-jefflessard3@gmail.com>

Add a read-only 'num_chars' sysfs attribute to report display digit count.

The num_chars attribute provides essential capability information to
userspace applications that need to know display dimensions before writing
messages, complementing the existing message and scroll controls.

No functional changes to existing behavior.

Signed-off-by: Jean-François Lessard <jefflessard3@gmail.com>
---
 drivers/auxdisplay/line-display.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c
index ea23c43bb..abeed8812 100644
--- a/drivers/auxdisplay/line-display.c
+++ b/drivers/auxdisplay/line-display.c
@@ -211,6 +211,16 @@ static ssize_t scroll_step_ms_store(struct device *dev,
 
 static DEVICE_ATTR_RW(scroll_step_ms);
 
+static ssize_t num_chars_show(struct device *dev, struct device_attribute *attr,
+			      char *buf)
+{
+	struct linedisp *linedisp = to_linedisp(dev);
+
+	return sysfs_emit(buf, "%u\n", linedisp->num_chars);
+}
+
+static DEVICE_ATTR_RO(num_chars);
+
 static ssize_t map_seg_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct linedisp *linedisp = to_linedisp(dev);
@@ -242,6 +252,7 @@ static DEVICE_ATTR(map_seg14, 0644, map_seg_show, map_seg_store);
 static struct attribute *linedisp_attrs[] = {
 	&dev_attr_message.attr,
 	&dev_attr_scroll_step_ms.attr,
+	&dev_attr_num_chars.attr,
 	&dev_attr_map_seg7.attr,
 	&dev_attr_map_seg14.attr,
 	NULL
-- 
2.43.0


  parent reply	other threads:[~2025-09-01  2:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  2:00 [PATCH 0/5] auxdisplay: linedisp: support attribute attachment to auxdisplay devices Jean-François Lessard
2025-09-01  2:00 ` [PATCH 1/5] auxdisplay: linedisp: encapsulate container_of usage within to_linedisp Jean-François Lessard
2025-09-01  2:00 ` [PATCH 2/5] auxdisplay: linedisp: display static message when length <= display size Jean-François Lessard
2025-09-02 10:03   ` Andy Shevchenko
2025-09-02 17:12     ` Jean-François Lessard
2025-09-01  2:00 ` Jean-François Lessard [this message]
2025-09-02 10:04   ` [PATCH 3/5] auxdisplay: linedisp: add num_chars sysfs attribute Andy Shevchenko
2025-09-02 17:15     ` Jean-François Lessard
2025-09-01  2:00 ` [PATCH 4/5] auxdisplay: linedisp: support attribute attachment to auxdisplay devices Jean-François Lessard
2025-09-02 10:18   ` Andy Shevchenko
2025-09-02 17:37     ` Jean-François Lessard
2025-09-03 10:18       ` Andy Shevchenko
2025-09-03 11:31         ` Jean-François Lessard
2025-09-01  2:00 ` [PATCH 5/5] docs: ABI: auxdisplay: document linedisp library sysfs attributes Jean-François Lessard
2025-09-02 10:59   ` Andy Shevchenko
2025-09-02 17:42     ` Jean-François Lessard
2025-09-02 11:00 ` [PATCH 0/5] auxdisplay: linedisp: support attribute attachment to auxdisplay devices Andy Shevchenko
2025-09-02 17:44   ` Jean-François Lessard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250901020033.60196-4-jefflessard3@gmail.com \
    --to=jefflessard3@gmail.com \
    --cc=andy@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).