11 April 2010

LCD4Linux-TUTORIAL

Linux-Options:

lcd4linux [-c key=val] [-F] [-f config-file] [-i[i]] [-o output] [-q] [-v] 
-c key=valoverwrite entries from the config-file (key and value have to be specified)
-Fdo not fork and detach (run in foreground)
-f config-fileuse configuration from 'config-file' instead of /etc/lcd4linux.conf
-ienter 'interactive mode' (after display initialisation)
-iienter 'interactive mode' (before display initialisation)
-o outputwrite picture to 'output' (raster driver only)
-qsuppress startup and exit splash screen
-vgenerate info messages
-vvgenerate debugging messages
-hprint version number and a small help text, then exit
-llist available drivers

Start automatically during boot:

You have to create the startscript "/etc/init.d/lcd4linux" and generate the necessary runlevel entries by hand, e.g. with the command "ln -s /etc/init.d/lcd4linux /etc/rc5.d/S99lcd4linux".

Example for a startscript:

#! /bin/sh # # lcd4linux # PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin DAEMON=/usr/local/bin/lcd4linux NAME=lcd4linux DESC=lcd4linux test -f $DAEMON || exit 0 set -e case "$1" in   start)  echo -n "Starting $DESC: "  start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON  echo "$NAME."  ;;   stop)  echo -n "Stopping $DESC: "  start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON  echo "$NAME."  ;;   reload)  start-stop-daemon --stop --signal 1 --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON    ;;   restart|force-reload)  echo -n "Restarting $DESC: "  start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON  sleep 1  start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON  echo "$NAME."  ;;   *)  N=/etc/init.d/$NAME  echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2  exit 1  ;; esac exit 0 

Alternatively you can invoke LCD4Linux within the file /etc/init.d/boot.local.


HD44780 Wiring

95% of all trouble with displays connected to the parallel port are due to wrong wiring! There is no "standard", whereupon the wiring should be carried out. Thus LCD4Linux supports the so-called "soft wiring", which means that you can use (nearly) any wiring you like. You just have declare it in lcd4linux.conf. A HD44780 display typically has 16 connections (if only 14 are available, then the connections for backlight are missing). The connections have the following meaning:

PinNameComment
1GNDground
2VCCsupply voltage +5V
3LCD_DRIVEcontrast voltage (0 .. +5V)
4RSRegister Select (low=instruction, high=data)
5R/WRead / not Write (high=read, low=write)
6ENABLEstarts data read/write
7DB0Data Bit 0
8DB1Data Bit 1
9DB2Data Bit 2
10DB3Data Bit 3
11DB4Data Bit 4
12DB5Data Bit 5
13DB6Data Bit 6
14DB7Data Bit 7
15BACKLIGHTbacklight supply voltage
16BL GNDbacklight ground

The parallel port has 25 connections:

PinNameI/O
1STROBEOut
2DB0I/O
3DB1I/O
4DB2I/O
5DB3I/O
6DB4I/O
7DB5I/O
8DB6I/O
9DB7I/O
10ACKIn
11BUSYIn
12PAPEROUTIn
13SELECTIn
14AUTOFDOut
15ERRORIn
16INITOut
17SLCTINOut
18-25GNDn/a

The data lines (DB0..DB7 on the display, DB0..DB7 on the parallel port) are always connected directly (unless you are using the 4-bit mode - but that is intended for experts rather, and these are not reading this tutorial anyway :-). The interesting part is, how the display's control signal is connected with the 4 possible output lines from the parallel port:

display:

Pin 4: RS (Register Select) Pin 5: R/W (Read/Write) Pin 6: Enable 

parallel port:

Pin 1:  Strobe Pin 14: AutoFD Pin 16: Init Pin 17: SelectIn 

For each control line you have to specify, which signal of the parallel port is used. This is done by the "Wire.xy"-entries.

E.g. if you are using the popular WinAmp wiring, it has to be defined like this:

Display Pin 4 (RS)     => Parallelport Pin 16 (Init) Display Pin 5 (R/W)    => Parallelport Pin 14 (AutoFD) Display Pin 6 (Enable) => Parallelport Pin 1  (Strobe) 

The adequate soft-wiring entries have to be:

Wire.RW        'AUTOFD' Wire.RS        'INIT' Wire.ENABLE    'STROBE' Wire.ENABLE2   'GND' Wire.BACKLIGHT 'GND' Wire.GPO       'GND' 

Wiring example:

If you want to connect a standard HD44780 display to the parallel port using the WinAmp-Wiring, do it like the following:

LCDParallel PortPower Supplycontrast pot (10k)
Pin 1Pin 18GNDPin 1
Pin 2-+5VPin 3
Pin 3-Pin 2 (slider)
Pin 4Pin 16
Pin 5Pin 14
Pin 6Pin 1
Pin 7Pin 2
Pin 8Pin 3
Pin 9Pin 4
Pin 10Pin 5
Pin 11Pin 6
Pin 12Pin 7
Pin 13Pin 8
Pin 14Pin 9
Pin 15-100 ohm resistor to +5V
Pin 16-GND

TROUBLESHOOTING

Problems when compiling:

  • problems with user rights? install as root user
  • error in configure.log? try different configure options

e.g. errormessage

#error "gd.h not found!" make: *** [Raster.o] Error 1 

workaround: configure --with-drivers=all,\!PNG

Problems starting LCD4Linux:

  • rights on /etc/lcd4linux.conf set correctly?
  • is the display initialised when starting LCD4Linux?
  • invoke LCD4Linux with the options "-Fvvq" and have a look at the debug-output
  • check syntax in lcd4linux.conf

USB Monitor

  • Hardware
  • Software
    • Binaries (extract to /)
    • Building for OpenWRT
      • gcc 4.1.2 as 8.09 compiler (with libboost, gcc 3.4.6 and 7.09 I got defined in discarded section while linking, with gcc 4.2.4 and trunk can't resolve symbol '_Unwind_GetIPInfo' at runtime if an exception happens; the SVN trunk package gave some compile error, too.)
      • packages: libstdcpp_4.1.2 (brcm*), libusb, libfreetype
      • modules: 2.4: input.o, evdev.o, hid.o; 2.6: input-core.ko, evdev.ko, usbhid.ko (for brcm-2.4 a patch is necessary, but even then hid.o doesn't get built for me.)
      • libboost_program_options-gcc41-mt-1_34_1.so.1.34.1, libboost_thread-gcc41-mt-1_34_1.so.1.34.1 from the Boost C++ library package from BTG
      • ROTE-256
      • SlugTerm and my modifications (based on tubecable; 26C3: Reverse-Engineering DisplayLink devices)
      • font: I recommend FNTs (FON2FNT). BDFs. PCFs don't have line drawing characters and are slow; no cache yet. Scalable fonts are not layed out correctly yet.

Command line switch help

root@OpenWrt:~# slugterm --help Options:   --help                show help message   -k [ --keyboard ] arg keyboard event source   -p [ --pid ] arg      USB product ID [4]   -i [ --init ] arg     initialization sequence [58]   -f [ --fpath ] arg    font   -w [ --fwidth ] arg   font width for scalable fonts   -h [ --fheight ] arg  font height for scalable fonts   -c [ --commands ] arg command(s) to run in terminal 
You can grab the initialization sequence for yourself from the Windows driver with an USB sniffer and dldecrypt.c or use one of the dl_register_init_* in dldemo.c. Some modes I captured:
Samsung U70800×48000203c7ac9f26c48f97053ffff2127032091f3fffffff901e00102c819
Samsung 244T @ Lenovo 45K5296 (DL-195)1920×120000ca2115426c15f466c536ffff6c150780a335ffffffca04b004025078

Example

root@OpenWrt:~# slugterm -k /dev/input/event0 -p 0103 -i 00203c7ac9f26c48f97053ffff2127032091f3fffffff901e00102c819 -f /usr/local/share/fonts/FON2FNT/dosapp_18.FNT -c "/bin/ash --login"
4D Systems OLED version4-x64.

24 March 2010

NYUMPIT LAGI

Hanya yg ada asas buleh baco...... kalu x dop tekan START >>>>>

ITINERARY FOR SARAWAK TRIP:
-----------------------
ALIAS/SALANMR



DAY DATE STOPOVER CITY TIME STATUS SERVICES
--- ----- --- ------------------------------------ ---- ------------ -------------------------------
TUE 30MAR DEP KUALA LUMPUR INT 1140 MH 2510 NON-STOP
MAIN TERMINAL ECONOMY (V) BOEING 737-400 ARR KUCHING 1325 CONFIRMED 01HR 45MIN
ALIAS/SALANMR SEAT RESERVED 06C/CONFIRM

MH - MALAYSIA AIRLINES REF:KQZ9C
THU 01APR DEP KUCHING 1635 MH 3154 NON-STOP
ECONOMY (M) ATR 72 ARR SIBU 1720 CONFIRMED 00HR 45MIN
ALIAS/SALANMR SEAT RESERVED 05A/CONFIRM
MH - MALAYSIA AIRLINES REF:KQZ9C

SAT 03APR DEP SIBU 1510 MH 3266 ARR BINTULU 1545 CONFIRMED 00HR 35MIN
SIBU - BINTULU OPERATED BY: MASWINGS
ALIAS/SALANMR SEAT RESERVED 05A/CONFIRM
MH - MALAYSIA AIRLINES REF:KQZ9C

MON 05APR DEP BINTULU 1430 MH 2743
ARR KUALA LUMPUR INT 1635 CONFIRMED 02HR 05MIN
ALIAS/SALANMR SEAT RESERVED 05C/CONFIRM
MH - MALAYSIA AIRLINES REF:KQZ9C