PicoLCD

From Lundman Wiki
Jump to: navigation, search

pico LCD

The picoLCD I purchased is ther 256x64 CDROM bay LCD panel. This means if I were to use good old C64 8x8 fonts, that I have a 32x8 display panel.

Template
  01234567890123456789012345678901
 +--------------------------------+
0|                                |
1|                                |
2|                                |
3|                                |
4|                                |
5|                                |
6|                                |
7|                                |
 +--------------------------------+
  Main page
  01234567890123456789012345678901
 +--------------------------------+
0| LRAID 5 OpenSolaris svn117     |
1| CPU:   2%  Load: 0.00 0.04 0.04|
2| Uptime: 23d 52m                |
3| nic: 500KB/s   54KB/s          |
4| io:  600KB/s   12KB/s          |
5| zpool:70.7G 20.3T    1% ONLINE |
6| zboot:464G  43.96G   9% ONLINE |
7|                                |
 +--------------------------------+
  Hard disk status detail
  01234567890123456789012345678901
 +--------------------------------+
0| Disk :   1   2   3   4   5     |
1| Read :   0  12   0   0   0     |
2| Write:   0   0   0   0   0     |
3| CKSUM:   0   0   0   0   0     |
4| TempC:  20  22  21  21  20     |
5| Status ONL DEG ONL ONL ONL     |
6|                                |
7|                                |
 +--------------------------------+

MRTG graphs of network, zpool iostat, loadavg picoLCD_2.jpg

Naturally, some sort of weather report is required.

The buttons need to be considered, they are:

               up
goBack         OK
home           dn


lcd4linux

To get the PicoLCD to work with Solaris, and ZFS we need /etc/lcd4linux.conf as well as the main lcd4linux binary. But before that will work we need to attach the ugen device to the USB node.

To do this we need to pull out the device info from prtconf:

# prtconf -v
                   name='usb-product-name' type=string items=1
                       value='USB-LCD-256x64'
                   name='usb-vendor-name' type=string items=1
                       value='ITUNER INC'
                   name='compatible' type=string items=9
                       value='usb4d8,c002.2' + usb4d8,c002 + 'usbif4d8,class3.0.0' + 'usbif4d8,class3.0' + 'usbif4d8,class3' + 'usbif,class3.0.0' + 'usbif,class3.0' + 'usbif,class3' + 'usb,device'

# /usr/sbin/update_drv -a -i '"usb4d8,c002"' ugen

this attaches the ugen device to the LCD panel.


When I compiled the PicoLCD version of lcd4linux on my Solaris server I used the following configure line:

 ./configure --with-drivers=picoLCDGraphic,X11 --with-plugins=button_exec,cpuinfo,exec,fifo,file,uptime,loadavg,statfs,netdev,diskstats,uname,meminfo LIBS=-lkstat

Technically the X11 driver is not required, it was just helpful when I was porting over the various plugins (so I didn't have to sit next to the LCD to test it).

During the porting work of lcd4linux, there are some changes required to the autoconf file configure.ac which I did not do. These include:

test                                 define
------------------------------------------------------------
kstat_open in libkstat               LIBS=-lkstat
kstat.h                              HAVE_KSTAT_H
statvfs.h                            HAVE_STATVFS
statfs.h                             HAVE_STATFS
ctype.h                              HAVE_CTYPE_H
/proc/uptime                         HAVE_PROC_UPTIME
/proc/net/dev                        HAVE_PROC_NET_DEV
/proc/meminfo                        HAVE_PROC_MEMINFO
/proc/diskstats                      HAVE_PROC_DISKSTATS
getloadavg()                         HAVE_GETLOADAVG
strcasestr()                         HAVE_STRCASESTR
linux/sem.h                          _SEM_SEMUN_UNDEFINED

The last one has reverse logic, which could probably be changed, but either way on Solaris, we need to add in the "union semun" for it to compile.

There are some issues in the porting that I did. For example, if you happen to be on a System with both /proc/net/dev and kstat.h it will not go well. This is trivial to fix though, if needed.

Now as for the Solaris porting, I initially tried to emulate the Linux values as much as possible, but near the end added the useful Solaris bits as well. So as it is now, not all things are supported, and some new information exist.

diskstats(reads, read_bytes, read_sectors, writes, write_bytes, write_sectors) - but the sectors value is the same as reads/writes. All other fields are 0.
meminfo(MemTotal, MemFree) - All other fields are 0. But tempted to add Swap fields.
netdev(Rx_bytes Rx_packets Tx_bytes Tx_packets) - All other fields are 0.
statfs(*) - For some reason needs "/ 256" on ZFS filesystems to report correct values.

The Solaris patch against are here

lcd4linux-lundman-patch1 First patch.

My GENERIC lcd4linux.conf changes are here:

Widget HDDTemp {
+    expression 'IDE Temp'.exec ('/usr/bin/hd hd -e c0t0|grep "194 Temperature"|sed "s|[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *\([^/]*\)/.*|\1|"', 1000)

Widget IDEIn {
+    expression (diskstats('sd2', 'read_bytes', 500))/1024/1024

+Widget IDEOut {
+    expression (diskstats('sd2', 'write_bytes', 500))/1024/1024

+Widget ETHIn {
+    expression (netdev('e1000g1', 'Tx_bytes', 500))/1024

+Widget ETHOut {
+    expression (netdev('e1000g1', 'Rx_bytes', 500))/1024

For example.


LRAID5 LCD Panel


New commands:

I am also tempted to add a few Solaris specific commands. For example zpool stats for disk usage instead of statfs, but also zpool iostat for reads/writes which is much interesting that diskstat() for an individual disk.