• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

Linux Software for 633 Serial Display: TCPIP info displayed

JamesScottJr

New member
Folks,

With the help of prior post to this forum I was able to write a linux daemon for Ubuntu that does what I needed; display the appliance tpcip info via our 633 display. If permitted, I will attach a tarball (ok only zip files are support:eek:) that will compile on both 32 and 64bit systems, and has been tested on Fedora and Ubuntu systems. A readme is included with al the details.

I start with the code from "635 Linux Demonstration Code, Written by Brent A. Crosby" and wrapped it in a daemon shell, along with a few other improvements or simplifications.

James,

Code:
  README.debian Ubuntu 8.0.4
  
DESCRIPTION:
  LCD_Manager 
  A demonstration program and utility for displaying 
  TCP/IP information on a Crystalfontz 633 16x2 LCD Display.

AUTHORS:   
  Major portions of this package were modeled after the following:
  "635 Linux Demonstration Code"    
  "Copyright 2005, Crystalfontz America, Inc. Written by Brent A. Crosby"
  "www.crystalfontz.com, [email]brent@crystalfontz.com[/email]"
    
  Author: James Scott Jr <james.scott@tripractix.com>, 8/2008

PACKAGE DETAILS:  
  The package is composed of the following files:
   * LCD_Manager-<version>.tar.bz2  -- Distribution file.
   * LCDManager            -- Package main directory     
     - README.debian       -- this file
     - Makefile            -- standard C makefile, with all/clean/install/refresh/uninstall targets
     - lcd_manager.initd   -- Debian styled init.d script to supportthe runtime as a daemon
     - lcd_manager.h       -- Package header with required constants
     - lcd_manager         -- Executable produced by compile operation
     - lcd_daemon.c        -- Daemon management signal handling routines
     - lcd_controller.c|h  -- Management logic or progam mainline 
                              (note: could be used a main() if daemon is removed)
     - lcd_getip.c|h       -- TCPIP information gathering routines
     - lcd_link.c|h        -- 633 Serial Communication and packet management routines
     
INSTALLATION:
  1. Unpack distribution file
    $ tar -jxvf LCD_Manager-<version>.tar.bz2
  2. Change into that Directory 
    $ cd ./LCDManager
  3. Compile the program
    $ make clean all
  4. Install the program
    $ sudo make install
    ** effects: /usr/bin/lcd_manager       -- binary
                /etc/init.d/lcd_manager    -- debian init script (supports /etc/init.d/lcd_manager [start|stop]
                /etc/rcS.d/S91lcd_manager  -- debian startup soft link, to start daemon during machine bootup
  5. Observe and press buttons


RUNTIME OPTIONS:
  lcd_manager -- manage CrystalFontz 633 16x2 LCD.
       triPRACTIX, LLC <James.Scott@triPRACTIX.com>

  Usage:
    lcd_manager [-v] [-i] [-s dev-portname] [-d 1|88] [-h|--help]

  Options:
    -d 1|88 --debug=1 Debug mode=1, Debug & no demonize=88
    -f, --forcepid  Overwrite pid file.
    -p, --pidfile   fname default is /var/run/lcd_manager.pid
    -s, --serial    port for LCD defaults to /dev/ttyS1
    -i, --upstart   Do not fork off
    -v, --version   Version printout.
    -h, --help      Show this help screen.

  
FUNCTIONAL DESCRIPTION:
 Objective:
  * Establish a robust daemon environment with an options fork/no fork
  * Support linux signals SIGHUP to cause a ip info refresh
                          SIGQUIT to cause an orderly shutdown of program
  * Gather and display TCP/IP Information from LINUX OS 
       applying a preference for info from one interface via this order "bond0", "eth0", "eth1"
        > Hostname:   some.host.name
        > Interface:  bond0
        > IP Address: ddd.ddd.ddd.ddd
        > HW Address: xxxx.xxxx.xxxx   
        > Netmask:    ddd.ddd.ddd.ddd
        > Broadcast:  ddd.ddd.ddd.ddd
        > Gateway:    ddd.ddd.ddd.ddd
  * Collect external application status by query key files to determine state
       >    License Status: Enabled! | Setup Required!
       >Application Status: Not Started | Starting | Ready
  * Organize IP info and Status info into seven seperate displays, navigitable from the keypad
      - Up/Down key rolls thru panels virtically
      - Left/Right keys move to the top or bottom
      - OK, causes a ip info refresh on each press
  * Have a regular ip info and status polling cycle of about 20 seconds
  * Have a status polling cycle of 2 seconds during program startup, until Application Status is Ready
      - disabled in this demo
  * Minimal use of globals provides the ability to support multiple 633 from one program in the future
      
REQUIREMENTS:
  Standard Linux 2.6+ Kernel and gcc development tools with pthread support  
  Developed as both a 32bit and 64bit program, works in either mode.
  Should work as is in debian, ubuntu, and red-hat/rpm based systems.


PROGRAM LOGIC:
  1. Parse the commandline options and setup defaults and selections
  2. Preform the demonize double-fork step if requested
  3. Start a signal handling thread to process all signals for the app, and prevent main thread
     from being interrupted, and create pidfile.
  4. Call lctrl_controller() to handle primary function
     A. Initial the 633 serial port to speed and 300ms wait times for first char x_cc[VTIME]
     B. Perform a read to ring buffer for clean the serial channel
     C. Call the getip() routine which collect ip info and application state into an array
        of LCD_IPINFO structures (allocated per call)
     D. Review the status cycle 
     E. Query and process any keypress
     F. Loop to (B) until exit_signal
     G. Write final page, "System Restarting"
     H. return from lctrl_controller()
  5. release allocated storage, shutdown signal thread, unlink_pidfile and exit.
     
DEBUG:
  The commandline options cause extension debug logging to the system log /var/log/messages
    --debug=1    -- send debugging messages to the system log

     
SUPPORT: 
 Type:  Best Effort
 email: Author [email]james.scott@tripractix.com[/email]
 forum: Crystalfontz LCD Forum, [url]https://forum.crystalfontz.com/[/url]
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Attachments

Last edited:

CF Support

Administrator
Is there any chance you purchased the CFA635 with a SCAB and WRPWRY14 or minus SCAB and with a WRPWRY25 cable? If that's the case, then the module is not configured to power off of USB alone, but off of your standby voltage.
 

CF Tech

Administrator
Please attach some pictures to a post so we can see what you have. Use a lot of light (full sun is awesome), so they are clear.
 

CF Support2

Administrator
Does your system "see" the CFA635? The module should show up as a TTYUSB0 if it's the first virtual COM port. This may vary depending on your Linux release.

The module should be powered up, is it?

I'm not sure off hand if the code needs to be pointed to your device. The code and scripts look to be coded for a Debian release.

As of 2.4.26, the FTDI_SIO files have been part of the kernel. Prior to that, you will need to get the FTDI_SIO files from SourceForge.net, and then re-compile your kernel in order to
communicate with your USB Module.

http://sourceforge.net/projects/ftdi-usb-sio/

In case you need to recompile or do some tweaking here is a list of our VID and PID:

VID_0403&PID_FC08.DeviceDesc="Crystalfontz CFA632-USB"
VID_0403&PID_FC09.DeviceDesc="Crystalfontz CFA634-USB"
VID_0403&PID_FC0B.DeviceDesc="Crystalfontz CFA633-USB"
VID_0403&PID_FC0C.DeviceDesc="Crystalfontz CFA631-USB"
VID_0403&PID_FC0D.DeviceDesc="Crystalfontz CFA635-USB"

A link another customer has sent with some good information:
http://www.mini-box.com/picoLCD-20x2-OEM?sc=8&category=490

You might want to take a look at these Linux programs:

http://lcdproc.omnipotent.net/

http://ssl.bulix.org/projects/lcd4linux/

Our demonstration code is in C as that is what we are familiar with. I a few threads in our tech forums regarding Python:
https://forum.crystalfontz.com/showthread.php?t=5060&highlight=python
https://forum.crystalfontz.com/showthread.php?t=5012&highlight=python
https://forum.crystalfontz.com/showthread.php?t=5006&highlight=python

And a few referencing PERL:
https://forum.crystalfontz.com/showthread.php?t=5003&highlight=PERL
https://forum.crystalfontz.com/showthread.php?t=4602&highlight=PERL

Please let me know if you have any questions.
 
Top