Page MenuHomeVyOS Platform

Extend support for Lanner appliances with serial LCDs
Open, LowPublicENHANCEMENT

Description

Older Lanner 1U appliances feature a small LCD display wired to the parallel port. These older models are well supported by the sdeclcd driver, already part of the "system lcd" VyOS CLI.

Newer Lanner appliances with an LCD seem to have switched the wiring to a serial port. Lanner provides source code in effect documenting the inner working of these serial-mounted LCDs. A cursory read through the code suggests a match wih the pre-existing CwLnx driver part of the lcdproc package.

This task proposes to add CLI support for this driver as part of "system lcd".

  1. Simple approach consists of simply adding the CwLnx driver to the CLI in parallel with sdeclcd, etc.
  2. Another approach consists of porting the CwLnx "protocol" to the more comprehensive HD44780 driver, which is as close to a "universal" driver as lcdproc has. I have already added the serial EZIO LCDs to this driver in the past.
  3. Another much more comprehensive approach is to look at the source code provided by Lanner for these appliances and provide some form of optional package, including CLI to support all the special features documented in the code, like LAN bypass, fan speed, etc, etc.

NOTE#1: VyOS seem to have partnered with Lanner and offering support for the LCD would seem to be an effort well spent

NOTE#2: I do not own a serial LCD like this possibly complicating development

Details

Difficulty level
Normal (likely a few hours)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Improvement (missing useful functionality)

Related Objects

Event Timeline

fmertz triaged this task as Low priority.

I can probably help with this in August when I'll have access to one of these appliances again.

I now have an appliance to use for testing. Tried setting the driver to hd44780 and nothing seems to happen. Set ReportLevel to 5 on both lcdproc and LCDd.
On lcdproc the only output is

Using Configuration File: /run/lcdproc/lcdproc.conf
sock_connect: Creating socket

The log output from LCDd is

LCDd 0.5.9, LCDproc Protocol 0.3
Part of the LCDproc suite
Copyright (C) 1998-2017 William Ferrell, Selene Scriven
                        and many other contributors

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

I also tried the changes from your fork at https://github.com/vyos/vyos-1x/compare/current...fmertz:vyos-1x:T6458-Lanner-serial-LCD in which case what happens is that LCDd outputs the same block of text as above, but instead of continuing to run in the foreground, the process simply exits with an error code of 1, but no indication I can find of what the error is.
Confirmed that /usr/lib/x86_64-linux-gnu/lcdproc/ does contain CwLnx.so.

Here is the current LCDd.conf file I'm using.

### Autogenerted by system-display.py ##

# LCDd.conf -- configuration file for the LCDproc server daemon LCDd
#
# This file contains the configuration for the LCDd server.
#
# The format is ini-file-like. It is divided into sections that start at
# markers that look like [section]. Comments are all line-based comments,
# and are lines that start with '#' or ';'.
#
# The server has a 'central' section named [server]. For the menu there is
# a section called [menu]. Further each driver has a section which
# defines how the driver acts.
#
# The drivers are activated by specifying them in a driver= line in the
# server section, like:
#
#   Driver=curses
#
# This tells LCDd to use the curses driver.
# The first driver that is loaded and is capable of output defines the
# size of the display. The default driver to use is curses.
# If the driver is specified using the -d <driver> command line option,
# the Driver= options in the config file are ignored.
#
# The drivers read their own options from the respective sections.

## Server section with all kinds of settings for the LCDd server ##
[server]

# Where can we find the driver modules ?
# NOTE: Always place a slash as last character !
DriverPath=/usr/lib/x86_64-linux-gnu/lcdproc/

# Tells the server to load the given drivers. Multiple lines can be given.
# The name of the driver is case sensitive and determines the section
# where to look for further configuration options of the specific driver
# as well as the name of the dynamic driver module to load at runtime.
# The latter one can be changed by giving a File= directive in the
# driver specific section.
#
# The following drivers are supported:
#   bayrad, CFontz, CFontzPacket, curses, CwLnx, ea65, EyeboxOne, futaba,
#   g15, glcd, glcdlib, glk, hd44780, icp_a106, imon, imonlcd,, IOWarrior,
#   irman, joy, lb216, lcdm001, lcterm, linux_input, lirc, lis, MD8800,
#   mdm166a, ms6931, mtc_s16209x, MtxOrb, mx5000, NoritakeVFD,
#   Olimex_MOD_LCD1x9, picolcd, pyramid, rawserial, sdeclcd, sed1330,
#   sed1520, serialPOS, serialVFD, shuttleVFD, sli, stv5730, svga, t6963,
#   text, tyan, ula200, vlsys_m428, xosd, yard2LCD

#Driver=hd44780
Driver=cwlnx

# Tells the driver to bind to the given interface. [default: 127.0.0.1]
Bind=127.0.0.1

# Listen on this specified port. [default: 13666]
Port=13666

# Sets the reporting level; defaults to warnings and errors only.
# [default: 2; legal: 0-5]
ReportLevel=5

# Should we report to syslog instead of stderr? [default: no; legal: yes, no]
#ReportToSyslog=yes

# User to run as.  LCDd will drop its root privileges and run as this user
# instead. [default: nobody]
User=nobody

# The server will stay in the foreground if set to yes.
# [default: no, legal: yes, no]
Foreground=yes

# Hello message: each entry represents a display line; default: builtin
Hello="Starting VyOS..."

# GoodBye message: each entry represents a display line; default: builtin
GoodBye="VyOS shutdown..."

# Sets the interval in microseconds for updating the display.
# [default: 125000 meaning 8Hz]
FrameInterval=500000 # 2 updates per second

# Sets the default time in seconds to displays a screen. [default: 4]
WaitTime=1

# If set to no, LCDd will start with screen rotation disabled. This has the
# same effect as if the ToggleRotateKey had been pressed. Rotation will start
# if the ToggleRotateKey is pressed. Note that this setting does not turn off
# priority sorting of screens. [default: on; legal: on, off]
AutoRotate=on

# If yes, the the serverscreen will be rotated as a usual info screen. If no,
# it will be a background screen, only visible when no other screens are
# active. The special value 'blank' is similar to no, but only a blank screen
# is displayed. [default: on; legal: on, off, blank]
ServerScreen=blank

# Set master backlight setting. If set to 'open' a client may control the
# backlight for its own screens (only). [default: open; legal: off, open, on]
Backlight=on

# Set master heartbeat setting. If set to 'open' a client may control the
# heartbeat for its own screens (only). [default: open; legal: off, open, on]
Heartbeat=off

# set title scrolling speed [default: 10; legal: 0-10]
TitleSpeed=10

[hd44780]
ConnectionType=ezio
Device=/dev/ttyS2
Size=2x20

[CwLnx]

# Select the LCD model [default: 12232; legal: 12232, 12832, 1602]
Model=12232

# Select the output device to use [default: /dev/lcd]
Device=/dev/ttyS2

# Select the LCD size. Default depends on model:
# 12232: 20x4
# 12832: 21x4
# 1602: 16x2
#Size=16x2
Size=2x20

# Set the communication speed [default: 19200; legal: 9600, 19200]
Speed=19200

# Reinitialize the LCD's BIOS [default: no; legal: yes, no]
# normally you shouldn't need this
Reboot=no

# If you have a keypad connected. Keypad layout is currently not
# configureable from the config file.
Keypad=yes

# If you have a non-standard keypad you can associate any keystrings to keys.
# There are 6 input keys in the CwLnx hardware that generate characters
# from 'A' to 'F'.
#
# The following is the built-in default mapping hardcoded in the driver.
# You can leave those unchanged if you have a standard keypad.
# You can change it if you want to report other keystrings or have a non
# standard keypad.
# KeyMap_A=Up
# KeyMap_B=Down
# KeyMap_C=Left
# KeyMap_D=Right
# KeyMap_E=Enter
# KeyMap_F=Escape

# keypad_test_mode permits one to test keypad assignment
# Default value is no
#keypad_test_mode=yes

@fmertz let me know if you have any ideas for me to try. You had mentioned several things in Slack but VyOS kicked everyone off so I've lost our conversations there.

The LCDd exit with code 1 was resolved by simply changing Driver=cwlnx to Driver=CwLnx

Tried tweaking a few things but so far have not gotten anything to display on the LCD, here's the current config I'm using.

## Server section with all kinds of settings for the LCDd server ##
[server]

# Where can we find the driver modules ?
# NOTE: Always place a slash as last character !
DriverPath=/usr/lib/x86_64-linux-gnu/lcdproc/

Driver=CwLnx

# Tells the driver to bind to the given interface. [default: 127.0.0.1]
Bind=127.0.0.1

# Listen on this specified port. [default: 13666]
Port=13666

# Sets the reporting level; defaults to warnings and errors only.
# [default: 2; legal: 0-5]
ReportLevel=5

# Should we report to syslog instead of stderr? [default: no; legal: yes, no]
#ReportToSyslog=yes

# User to run as.  LCDd will drop its root privileges and run as this user
# instead. [default: nobody]
User=nobody

# The server will stay in the foreground if set to yes.
# [default: no, legal: yes, no]
Foreground=yes

# Hello message: each entry represents a display line; default: builtin
Hello="Starting VyOS..."

# GoodBye message: each entry represents a display line; default: builtin
GoodBye="VyOS shutdown..."

# Sets the interval in microseconds for updating the display.
# [default: 125000 meaning 8Hz]
FrameInterval=500000 # 2 updates per second

# Sets the default time in seconds to displays a screen. [default: 4]
WaitTime=1

# If set to no, LCDd will start with screen rotation disabled. This has the
# same effect as if the ToggleRotateKey had been pressed. Rotation will start
# if the ToggleRotateKey is pressed. Note that this setting does not turn off
# priority sorting of screens. [default: on; legal: on, off]
AutoRotate=on

# If yes, the the serverscreen will be rotated as a usual info screen. If no,
# it will be a background screen, only visible when no other screens are
# active. The special value 'blank' is similar to no, but only a blank screen
# is displayed. [default: on; legal: on, off, blank]
ServerScreen=blank

# Set master backlight setting. If set to 'open' a client may control the
# backlight for its own screens (only). [default: open; legal: off, open, on]
Backlight=on

# Set master heartbeat setting. If set to 'open' a client may control the
# heartbeat for its own screens (only). [default: open; legal: off, open, on]
Heartbeat=off

# set title scrolling speed [default: 10; legal: 0-10]
TitleSpeed=10

[CwLnx]
Model=1602
Device=/dev/ttyS2
Size=20x2
Speed=19200
Keypad=yes
This comment was removed by fmertz.

I need to reopen the code from the lcdproc project as well as the platform package from Lanner and "compare".

Did you make sure there was a client running, like "lcdproc"?

Yeah I was running lcdproc in a separate window in the foreground as well, and restarted it each time I change a setting in LCDd

It looks like you are already running this with a high reporting level. Are you seeing any/all the messages on stderr? I would try all of this on the command line first, and do the VyOS cli later.

I would try the "second" serial port on /dev/ttyS1 (console might be on the "first" port /dev/ttyS0).

Other option would be to see if you can open some form of terminal on that serial port to confirm it. It looks like characters just typed should show on the display. IOW, there is no "command" to display a few characters.

The documentation is not great at listing the defaults, but 19200 and possibly 9600 bds seem like good initial guesses for the port speed. 8-bit and no parity. Looks like no stop bit is expected.

Best of luck, keep us posted.

I messed around with it today, and made some progress!

On pfSense the LCDd config below works great using CwLnx. But on VyOS getting some junk. Here's a photo of the top being pfSense and the bottom VyOS. Exact same hardware. Also both are using LCDd v0.5.9

image.png (750×1 px, 931 KB)

pfSense LCDd.conf

[server]
DriverPath=/usr/local/lib/lcdproc/
Driver=CwLnx
Bind=127.0.0.1
Port=13666
ReportLevel=2
ReportToSyslog=yes
User=nobody
Foreground=no
ServerScreen=no
GoodBye="Thanks for using"
GoodBye="    pfSense     "
WaitTime=5
ToggleRotateKey=Enter
PrevScreenKey=Left
NextScreenKey=Right
ScrollUpKey=Up
ScrollDownKey=Down
[menu]
MenuKey=Escape
EnterKey=Enter
UpKey=Up
DownKey=Down
[CwLnx]
Model=12232
Device=/dev/cuau1
Size=20x2
Reboot=no
Speed=115200

VyOS LCDd.conf

[server]
DriverPath=/usr/lib/x86_64-linux-gnu/lcdproc/
Driver=CwLnx
Bind=127.0.0.1
Port=13666
ReportLevel=2
ReportToSyslog=yes
User=nobody
Foreground=no
ServerScreen=no
GoodBye="Thanks for using"
GoodBye="    VyOS        "
WaitTime=5
ToggleRotateKey=Enter
PrevScreenKey=Left
NextScreenKey=Right
ScrollUpKey=Up
ScrollDownKey=Down
[menu]
MenuKey=Escape
EnterKey=Enter
UpKey=Up
DownKey=Down
[CwLnx]
Model=12232
Device=/dev/ttyS1
Size=20x2
Reboot=no
Speed=115200

Have you tried running the lcdproc client just for load average? It is just text. Maybe the more complex displays involving histograms, etc. are not working quite right.

Best of luck, keep us posted.