Skip to content

Commit e250634

Browse files
jefflessardandy-shev
authored andcommitted
auxdisplay: linedisp: add num_chars sysfs attribute
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> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 9870334 commit e250634

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Documentation/ABI/testing/sysfs-auxdisplay-linedisp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ Description:
1515
echo "Hello World" > message
1616
cat message # Returns "Hello World\n"
1717

18+
What: /sys/.../num_chars
19+
Date: November 2025
20+
KernelVersion: 6.18
21+
Contact: Jean-François Lessard <jefflessard3@gmail.com>
22+
Description:
23+
Read-only attribute showing the character width capacity of
24+
the line display device. Messages longer than this will scroll.
25+
26+
Example:
27+
cat num_chars # Returns "16\n" for 16-char display
28+
1829
What: /sys/.../scroll_step_ms
1930
Date: October 2021
2031
KernelVersion: 5.16

drivers/auxdisplay/line-display.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@ static ssize_t message_store(struct device *dev, struct device_attribute *attr,
178178

179179
static DEVICE_ATTR_RW(message);
180180

181+
static ssize_t num_chars_show(struct device *dev, struct device_attribute *attr,
182+
char *buf)
183+
{
184+
struct linedisp *linedisp = to_linedisp(dev);
185+
186+
return sysfs_emit(buf, "%u\n", linedisp->num_chars);
187+
}
188+
189+
static DEVICE_ATTR_RO(num_chars);
190+
181191
static ssize_t scroll_step_ms_show(struct device *dev,
182192
struct device_attribute *attr, char *buf)
183193
{
@@ -240,6 +250,7 @@ static DEVICE_ATTR(map_seg14, 0644, map_seg_show, map_seg_store);
240250

241251
static struct attribute *linedisp_attrs[] = {
242252
&dev_attr_message.attr,
253+
&dev_attr_num_chars.attr,
243254
&dev_attr_scroll_step_ms.attr,
244255
&dev_attr_map_seg7.attr,
245256
&dev_attr_map_seg14.attr,

0 commit comments

Comments
 (0)