tme
Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
January 16, 2023 01:23AM
The Netgear ReadyNAS RN104 has a 2 by 16 character display. It's a Winstar WH1602G LCD. Pictures here. U-boot (v2011.12) writes "NETGEAR Storage Welcome" on the display when it starts, and "Booting.." before booting Linux. This latter text sticks since Linux makes no effort to change it.

The display is defined like this in the dts file:
	auxdisplay {
		compatible = "hit,hd44780";
		data-gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>,
				<&gpio1 26 GPIO_ACTIVE_HIGH>,
				<&gpio1 27 GPIO_ACTIVE_HIGH>,
				<&gpio1 29 GPIO_ACTIVE_HIGH>;
		enable-gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
		rs-gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
		rw-gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
		backlight-gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
		display-height-chars = <2>;
		display-width-chars = <16>;
	};

There is no '/dev/fs*' framebuffer in the root file system, but '/dev/char/2:16' exist:
root@rn104:~# ls -alF /dev/char/2:16
lrwxrwxrwx 1 root root 8 Jan 14 19:04 /dev/char/2:16 -> ../ptyq0

root@rn104:~# ls -alF /dev/ptyq0
crw------- 1 root root 2, 16 Jan 14 21:00 /dev/ptyq0
root@drodle:~#

I hoped being able to send characters to this device. Tried
root@rn104:~# echo Hello world > /dev/char/2:16
but it does nothing:

Can anyone please give a hint on how to proceed?

Regards,
Trond Melen
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
January 16, 2023 09:47PM
First suggestion would be to ensure that the driver has actually loaded. Initialization of the charlcd driver has the following:
 charlcd_puts(lcd, "\x1b[Lc\x1b[Lb\x1b[L*Linux-" UTS_RELEASE "\n");
This should print the linux version on the display if the module loaded correctly.

The (un)official LCD4Linux Wiki could be another source for answers to your question.
tme
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
January 17, 2023 02:44AM
Thanks raynight, for your hints!

'lcd4linux' may become useful:
tme@rn102:~$ sudo apt install -y lcd4linux

tme@rn102:~$ sudo lcd4linux -l | egrep -i 'Winstar|WH1602G|hd44780|hit'
   BWCT                : BWCT USB to HD44780 interface
   HD44780             : generic Noritake Soekris HD66712 LCM-162 
   LCD2USB             : LCD2USB homebrew USB interface for HD44780 text displays
   LCDTerm             : LCDTerm serial-to-HD44780 adapter board
   PHAnderson          : PHAnderson serial-to-HD44780 adapter
   RouterBoard         : HD44780 HD66712

Linux prints nothing on the display, and LCD is not mentioned in the boot log:
tme@rn102:~$ sudo dmesg | grep -i lcd
tme@rn102:~$

Here some possibly relevant kernel configurations:
tme@rn102:~$ egrep -i 'lcd|backlight' /boot/config-5.19.2-mvebu-370xp-tld-1 

# CONFIG_MFD_ATMEL_HLCDC is not set
# CONFIG_DRM_HDLCD is not set
# CONFIG_DRM_TILCDC is not set
# CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO is not set
CONFIG_FB_BACKLIGHT=m
# Backlight & LCD device support
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_KTD253 is not set
# CONFIG_BACKLIGHT_PWM is not set
# CONFIG_BACKLIGHT_QCOM_WLED is not set
# CONFIG_BACKLIGHT_ADP8860 is not set
# CONFIG_BACKLIGHT_ADP8870 is not set
# CONFIG_BACKLIGHT_PCF50633 is not set
# CONFIG_BACKLIGHT_LM3630A is not set
# CONFIG_BACKLIGHT_LM3639 is not set
# CONFIG_BACKLIGHT_LP855X is not set
# CONFIG_BACKLIGHT_GPIO is not set
# CONFIG_BACKLIGHT_LV5207LP is not set
# CONFIG_BACKLIGHT_BD6107 is not set
# CONFIG_BACKLIGHT_ARCXCNN is not set
# CONFIG_BACKLIGHT_LED is not set
# end of Backlight & LCD device support
CONFIG_HID_PICOLCD=m
CONFIG_HID_PICOLCD_FB=y
CONFIG_HID_PICOLCD_BACKLIGHT=y
CONFIG_HID_PICOLCD_LEDS=y
# CONFIG_HID_PICOLCD_CIR is not set
CONFIG_USB_LCD=m
CONFIG_LEDS_TRIGGER_BACKLIGHT=m
CONFIG_FB_TFT_TINYLCD=m

Maybe I should I try to load the modules corresponding to HID_PICOLCD or CONFIG_FB_TFT_TINYLCD?

Reagards,
Trond Melen
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
January 17, 2023 09:08PM
Based on the DTS file I believe you need to include the following config options:

CONFIG_AUXDISPLAY=y
CONFIG_HD44780=y

Ray



Edited 1 time(s). Last edit at 01/18/2023 12:16AM by rayknight.
tme
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 08:32AM
bodhi has kindly added the driver for the 16 by 2 character LCD display on the front of the Netgear RN104 in his latest Armada 370XP kernel:
root@rn104:~# egrep 'AUXDISPLAY|44780' /boot/config-6.1.8-mvebu-370xp-tld-1 
CONFIG_AUXDISPLAY=y
CONFIG_HD44780_COMMON=y
CONFIG_HD44780=y

I can't find anything about the driver in the boot log, but the display is supported. It says "Linux-6.1.8-mveb" for about 3 seconds early in the boot process. Picture attached. Then it turns dark until it says "Power off." for about 1 second just before the box is shutting down.

Asking the kernel for it's device tree, it says:
root@rn104:~# for i in /proc/device-tree/auxdisplay/*; do echo $i; hexdump -C $i; done
/proc/device-tree/auxdisplay/backlight-gpios
00000000  00 00 00 17 00 00 00 15  00 00 00 01              |............|
0000000c
/proc/device-tree/auxdisplay/compatible
00000000  68 69 74 2c 68 64 34 34  37 38 30 00              |hit,hd44780.|
0000000c
/proc/device-tree/auxdisplay/data-gpios
00000000  00 00 00 17 00 00 00 19  00 00 00 00 00 00 00 17  |................|
00000010  00 00 00 1a 00 00 00 00  00 00 00 17 00 00 00 1b  |................|
00000020  00 00 00 00 00 00 00 17  00 00 00 1d 00 00 00 00  |................|
00000030
/proc/device-tree/auxdisplay/display-height-chars
00000000  00 00 00 02                                       |....|
00000004
/proc/device-tree/auxdisplay/display-width-chars
00000000  00 00 00 10                                       |....|
00000004
/proc/device-tree/auxdisplay/enable-gpios
00000000  00 00 00 17 00 00 00 18  00 00 00 00              |............|
0000000c
/proc/device-tree/auxdisplay/name
00000000  61 75 78 64 69 73 70 6c  61 79 00                 |auxdisplay.|
0000000b
/proc/device-tree/auxdisplay/rs-gpios
00000000  00 00 00 17 00 00 00 16  00 00 00 00              |............|
0000000c
/proc/device-tree/auxdisplay/rw-gpios
00000000  00 00 00 17 00 00 00 17  00 00 00 00              |............|
0000000c

I have installed 'lcd4linux' on the box, but I've not yet figured out how to make it show anything on the display. The default configuration file '/etc/lcd4linux.conf' has no entry for the Winstar WH1602G LCD display (which is probaly similar to the current WH1602A ). Without success, I have tried to adapt some of the avilable displays.

This in my adapted 'lcd4linux.conf' file with 3 different displays to choose from:
root@rn104:~# cat /etc/lcd4linux.conf
Display HD44780-16x2 {
    Driver  'HD44780'
    Model   'generic'
    UseBusy  1
    Port    '/dev/parport0'	
    Size    '16x2'
    Wire {
	RW      'AUTOFD'
	RS      'INIT'
	ENABLE  'STROBE'
	ENABLE2 'GND'
	GPO     'GND'
    }
}

# generic HD44780 display (WinAmp wiring)
Display HD44780-winamp-16x2 {
    Driver 'HD44780'
    Model 'generic'
    UseBusy 1
    Port '/dev/parports/0'      
    Size '16x2'
    asc255bug 1
    Wire {
        RW      'AUTOFD'
        RS      'INIT'
        ENABLE  'STROBE'
        ENABLE2 'GND'
        GPO     'GND'
        POWER   'GND'
    }
    Timing {
        # fuzz timings by value (100 = no change)
        fuzz 100
        # low-level communication [ns]
        CY 1000  # Enable cycle time
        PW  450  # Enable pulse width
        AS  140  # Address setup time
        AH   20  # Address hold time
        # HD44780 execution timings [us]
        INIT1 4100  # first init sequence: 4.1 msec
        INIT2  100  # second init sequence: 100 usec
        EXEC    80  # normal execution time
        WRCG   120  # CG RAM Write
        CLEAR 2250  # Clear Display
        HOME  2250  # Return Cursor Home
        ONOFF 2250  # Display On/Off Control
        # GPO timing [ns]
        GPO_ST  20  # 74HCT573 set-up time
        GPO_PW 230  # 74HCT573 enable pulse width
        # Power supply timing [ms]
        POWER  500  # power-on delay
    }
}

Display SC1602D {
    Driver 'HD44780'
    Port '/dev/parports/0'      
    Bits '8'
    Size '16x2'
    asc255bug 0
    Icons 1
    Wire {
        RW     'GND'
        RS     'AUTOFD'
        ENABLE 'STROBE'
        GPO    'INIT'
        POWER  'GND'
    }
}

Widget CPU {
    class  'Text'
    expression  uname('machine')
    prefix 'CPU '
    width  9
    align  'L'
    update tick
}

Layout Default {
    Row1 {
        Col1 'CPU'
    }
}

Variables {
   tick 500
}

Display 'HD44780-16x2'
#Display 'HD44780-winamp-16x2'
#Display 'SC1602D'

Layout  'Default'

The devices were missing, so I created them manually:
root@rn104:~# mknod /dev/parport0 c 99 0 

root@rn104:~# mkdir /dev/parports

root@rn104:~# mknod /dev/parports/0 c 99 0

root@rn104:~# chgrp lp /dev/parport0 /dev/parports/0

root@rn104:~# chmod g+rw /dev/parport0 /dev/parports/0

root@rn104:~# ls -AlF /dev/parp*
crw-rw-r-- 1 root lp   99, 0 Feb 11 12:07 /dev/parport0

/dev/parports:
total 0
crw-rw-r-- 1 root lp 99, 0 Feb 11 13:13 0

Still, 'lcd4linux' claims the devices do not exist:
root@rn104:~# grep '^Display' /etc/lcd4linux.conf | grep -v '{'
Display 'HD44780-16x2'

root@rn104:~# lcd4linux -Fv
LCD4Linux 0.11.0-SVN-1193 starting
[DBus] Error connecting to the dbus session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

[MPD] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
[raspi] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
HD44780: $Rev: 1202 $
HD44780: using model 'generic'
HD44780: using parallel port
HD44780: using 1 Controller(s)
HD44780: using 8 bit mode
udelay: using gettimeofday() delay loop
HD44780: using ppdev /dev/parport0
HD44780: open(/dev/parport0) failed: No such device or address
HD44780: could not initialize parallel port!
HD44780: start display failed!
Error initializing driver HD44780: Exit!

root@rn104:~# nano /etc/lcd4linux.conf

root@rn104:~# grep '^Display' /etc/lcd4linux.conf | grep -v '{'
Display 'HD44780-winamp-16x2'

root@rn104:~# lcd4linux -Fv
LCD4Linux 0.11.0-SVN-1193 starting
[DBus] Error connecting to the dbus session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

[MPD] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
[raspi] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
HD44780: $Rev: 1202 $
HD44780: using model 'generic'
HD44780: using parallel port
HD44780: using 1 Controller(s)
HD44780: using 8 bit mode
udelay: using gettimeofday() delay loop
HD44780: using ppdev /dev/parports/0
HD44780: open(/dev/parports/0) failed: No such device or address
HD44780: could not initialize parallel port!
HD44780: start display failed!
Error initializing driver HD44780: Exit!

root@rn104:~# nano /etc/lcd4linux.conf

root@rn104:~# grep '^Display' /etc/lcd4linux.conf | grep -v '{'
Display 'SC1602D'

root@rn104:~# lcd4linux -Fv
LCD4Linux 0.11.0-SVN-1193 starting
[DBus] Error connecting to the dbus session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

[MPD] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
[raspi] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
HD44780: $Rev: 1202 $
HD44780: using model 'generic'
HD44780: using parallel port
HD44780: using 1 Controller(s)
HD44780: using 8 bit mode
udelay: using gettimeofday() delay loop
HD44780: using ppdev /dev/parports/0
HD44780: open(/dev/parports/0) failed: No such device or address
HD44780: could not initialize parallel port!
HD44780: start display failed!
Error initializing driver HD44780: Exit!

Suspecting support for parallel port might be the cause, I did:
root@rn104:~# grep -ie 'parport*=m' /boot/config-6.1.8-mvebu-370xp-tld-1
CONFIG_PARPORT=m
CONFIG_PPS_CLIENT_PARPORT=m

root@rn104:~# insmod /lib/modules/5.19.2-mvebu-370xp-tld-1/kernel/drivers/parport/parport.ko
insmod: ERROR: could not insert module /lib/modules/5.19.2-mvebu-370xp-tld-1/kernel/drivers/parport/parport.ko: Invalid module format

root@rn104:~# dmesg | tail -1
[10666.430896] parport: disagrees about version of symbol module_layout

So how to proceed? Should the kernel be configured with 'CONFIG_PARPORT=y'?

Regards,
Trond Melen
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 09:47AM
I can't imagine you'd need /dev/parport0. I suppose that is used when you have connected an LCD display to the parallel port, and lcd4linux does the bitbanging in user mode. But you have a driver which should do that work. According to the documentation there should be a /dev/lcd.
This wiki suggests that lcd4linux can also handle that.
tme
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 10:06AM
Thanks, Mijzelf, for your advice!

I modifyed 'Port' to '/dev/lcd' for all the three displays in 'lcd4linux.conf' and tested. The error message 'No such device or address' switched to 'Operation not permitted'. So still no success:
root@drodle:~# lcd4linux -Fv
LCD4Linux 0.11.0-SVN-1193 starting
[DBus] Error connecting to the dbus session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

[MPD] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
[raspi] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
HD44780: $Rev: 1202 $
HD44780: using model 'generic'
HD44780: using parallel port
HD44780: using 1 Controller(s)
HD44780: using 8 bit mode
udelay: using gettimeofday() delay loop
HD44780: using ppdev /dev/lcd
HD44780: open(/dev/lcd) failed: Operation not permitted
HD44780: could not initialize parallel port!
HD44780: start display failed!
Error initializing driver HD44780: Exit!

I'll check your links.

Regards,
Trond Melen
tme
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 10:31AM
Hi again,

I followed you links and tried the BWCT display configuration, also without success:
root@rn104:~# ls -AlF /dev/lcd*
crw-rw---- 1 root lp 10, 156 Feb 11 12:04 /dev/lcd

root@rn104:~# head -8 /etc/lcd4linux.conf
Display BWCT-16x2 {
    Driver 'BWCT'
    Size '16x2'
    Contrast 220
    asc255bug 1
    Icons 1
#   Port 'libusb'
}

root@rn104:~# lcd4linux -Fv
LCD4Linux 0.11.0-SVN-1193 starting
[DBus] Error connecting to the dbus session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

[MPD] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
[raspi] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
BWCT: $Rev: 975 $
BWCT: scanning USB for BWCT LCD...
BWCT: could not find a BWCT USB LCD
Error initializing driver BWCT: Exit!

The picture linked to in the first post shows a bunch of wires to the display, presumably 14 or 16. What indicates that the LCD display on the RN104 is a USB device and not a parallel port device?

Regards,
Trond Melen
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 10:39AM
Quote

HD44780: open(/dev/lcd) failed: Operation not permitted
What does 'ls -l /dev/lcd*' say?
Quote

What indicates that the LCD display on the RN104 is a USB device and not a parallel port device?
It's not a patallel port device. What was the last time you saw a parallel port? It could be usb, or i2c, or gpio connected, or... . The driver should take care for that.
tme
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 10:58AM
Hi Mijzelf,

From the pictures mentioned the number of pins on the display's header connectors is 4+13=17, but the wire count of the connected flat cable is only 2+10=12. It may be very well GPIO.

Regards,
Trond Melen
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 01:35PM
You might want to take a look at HD44780 LCD I²C screen using Linux mainline charlcd driver. That appears to have enough information to be able to determine if lcd4linux already support the device and to add support to lcd4llinux if it does not.

Ray
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 03:05PM
> From the pictures mentioned the number of pins on
> the display's header connectors is 4+13=17, but
> the wire count of the connected flat cable is only
> 2+10=12. It may be very well GPIO.

The Kernel Kconfig indicates that there is some GPIO involved

Quote

config HD44780
tristate "HD44780 Character LCD support"
depends on GPIOLIB

If you can boot back to stock OS, look for some scripts that echo the Netgear messages in the init scripts during boot.

Quote

The Netgear ReadyNAS RN104 has a 2 by 16 character display. It's a Winstar WH1602G LCD. Pictures here. U-boot (v2011.12) writes "NETGEAR Storage Welcome" on the display when it starts, and "Booting.." before booting Linux. This latter text sticks since Linux makes no effort to change it.

I imagine they'd want to do this in userspace so it is not needed to hardcode it in kernel build. Also the "Booting..." message most definitely is a userspace message.

=====

Here is where the default string (kernel name) got displayed in the driver code:

drivers/auxdisplay/charlcd.c


=====

Definitely GPIO control.

https://github.com/torvalds/linux/blob/master/drivers/auxdisplay/hd44780.c

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 2 time(s). Last edit at 02/11/2023 03:22PM by bodhi.
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 04:36PM
From my earlier linked article
Quote

Now that the hard part — configuring the kernel and the device tree — is done, we can very easily print stuff on the screen by just writing to the /dev/lcd file.

Ray
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 04:45PM
> From my earlier linked article

> Now that the
> hard part — configuring the kernel and the
> device tree — is done, we can very easily print
> stuff on the screen by just writing to the
> /dev/lcd file.

Yes, I saw that it was ready.

auxdisplay {
                compatible = "hit,hd44780";
                data-gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>,
                                <&gpio1 26 GPIO_ACTIVE_HIGH>,
                                <&gpio1 27 GPIO_ACTIVE_HIGH>,
                                <&gpio1 29 GPIO_ACTIVE_HIGH>;
                enable-gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
                rs-gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
                rw-gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
                backlight-gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
                display-height-chars = <2>;
                display-width-chars = <16>;
        };


And I thought the easiest way to see how it is used is somewhere in stock OS.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 02/11/2023 04:49PM by bodhi.
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 11, 2023 05:05PM
> From my earlier linked article
Quote

Now that the
> hard part — configuring the kernel and the
> device tree — is done, we can very easily print
> stuff on the screen by just writing to the
> /dev/lcd file.
>
>

Yes. That article is clear about how you would write to the LCD. Thumbs up!

-bodhi
===========================
Forum Wiki
bodhi's corner
tme
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 12, 2023 06:16AM
Yes, '/dev/lcd' is the correct device, and yes, the hardware interface is direct GPIO.

Quote
Arnaud Ebalard
The LCD module consumes 8 GPIO of the SoC. In order to get additional GPIOs to connect to front buttons and LEDs, NETGEAR has added on the main board an iomuxer connected to the I2C bus, namely a NXP PCA9554. It provides eight additional GPIOs.

I assume 'lcd4linux' is obsolete. None of the display configurations in '/etc/lcd4linux.conf' uses '/dev/lcd' as its "port". 'apt' refused to uninstall the package because '/etc/init.d/lcd4linux stop' failed. I had to modify this script first to be able make 'apt remove' work.

The next important step to learn was how to switch on the backlight. As described in MicroJoe's adventures this may be done by sending an escape sequence to the device. I added this to '/etc/rc.local':
tme@rn104:~$ tail /etc/rc.local

# Running on a box with an LCD display?
if [ -w /dev/lcd ]; then

	# Say something optimistic and switch on the backlight
	/usr/bin/printf '-New boot, new\npossibilities!\n' > /dev/lcd
	/usr/bin/printf '\x1b[L+' > /dev/lcd
fi

exit 0

Then I had to decide what to display. CPU load, memory usage, block IO or network traffic? Very little fits on the display, so one would probably need to login anyhow and to get the real picture. IP address, network connectivity and box temperature? At least complete information fits on the display, but in stead I decided to display boot and current time in the format "2023-02-12 13:14". Boot time will tell me if there has been a crash or power outage, and current time will tell me if the system is frozen or its clock has drifted way off. These are handy pieces of information when deciding if a login is required.

The display is updated every minute through 'crontab':
tme@rn104:~$ sudo crontab -l | tail -1
* * * * * /root/lcd-uptime.sh

tme@rn104:~$ sudo cat /root/lcd-uptime.sh
#!/bin/bash
#
# Script updating the LCD
# To be run by crontab every minute

# Size of display
ncols=16
nrows=2

# Up time exceeds 10 minutes?
up=$( /usr/bin/cut -d. -f1 /proc/uptime )
if (( $up > 600 )); then

	# Info to be displayed
	boot=$( /usr/bin/uptime -s | /usr/bin/cut -c -$ncols )
	curr=$( /bin/date -Im | /usr/bin/tr 'T' ' ' | /usr/bin/cut -c -$ncols )

	# Print info on the display
	if (( $nrows > 1 )); then
		printf "$boot\n" > /dev/lcd
	fi
	printf "$curr\n"  > /dev/lcd
fi

exit 0

Boot and/or current time may of course be substituted by an error message when network connectivity is lost, when the box temperature exceeds some limit or some other issue needs attention, but that's for another post.

Thank You All for Your advice!

Regards,
Trond Melen



Edited 1 time(s). Last edit at 02/12/2023 11:50AM by tme.
tme
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 12, 2023 07:36AM
I was curious about whether there were further escape sequence codes than just '+' and '-' (back light on and off). Yes, there are:
tme@rn104:/tmp$ wget https://github.com/torvalds/linux/raw/master/drivers/auxdisplay/charlcd.c

tme@rn104:/tmp$ grep "case.**/" charlcd.c
	case 'D':	/* Display ON */
	case 'd':	/* Display OFF */
	case 'C':	/* Cursor ON */
	case 'c':	/* Cursor OFF */
	case 'B':	/* Blink ON */
	case 'b':	/* Blink OFF */
	case '+':	/* Back light ON */
	case '-':	/* Back light OFF */
	case '*':	/* Flash back light */
	case 'f':	/* Small Font */
	case 'F':	/* Large Font */
	case 'n':	/* One Line */
	case 'N':	/* Two Lines */
	case 'l':	/* Shift Cursor Left */
	case 'r':	/* shift cursor right */
	case 'L':	/* shift display left */
	case 'R':	/* shift display right */
	case 'k': {	/* kill end of line */
	case 'I':	/* reinitialize display */
	case 'x':	/* gotoxy : LxXXX[yYYY]; */
	case 'y':	/* gotoxy : LyYYY[xXXX]; */

Scrolling is not supported. Printing New Line ('\n') on the display moves the (by default invisible) cursor to the beginning of the other line (above or below). Shifting left and right works, but isn't very useful since only 16 characters per line are stored in the display.

Of course, not all sequence codes work on the Winstar WH1602G LCD. Clearing the display and moving the cursor to the beginning of the first line does not require an escape sequence, though. Just printing Form Feed ('\f') on the display does the trick.

Reagrds,
Trond Melen
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 12, 2023 02:32PM
Very nice!

/* Flash back light */ would be quite useful as a visual indicator for something above threshold that needs a login.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Build-in 2 by 16 character front display on Netgear ReadyNAS RN104
February 13, 2023 09:38PM
Added to the Wiki thread.

Quote

Display

dpf-ax
Tritton USB2VGA
HP T5325 X11 GUI (LXDE)
LED daemon for Pogoplug Debian
Netgear ReadyNAS RN104 Front LCD Display

-bodhi
===========================
Forum Wiki
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: