[Lancaster] trouble interfacing an LCD display

andy baxter andy at earthsong.free-online.co.uk
Fri Aug 8 00:05:01 2003


hello all,

Can anyone help with the following problem?
I'm trying to set up a 4x20 char LCD display I bought as a terminal display 
for an old linux machine I have, so I can run it in my living room as a 
combined mp3 jukebox, net radio player, and internet firewall. I want to be 
able to use a standard keyboard together with the display so I can see what 
I'm typing in a console session without having to have a big monitor, and 
hopefully eventually write a nice front end with menus and so on.
So far what I've done is to decompile the standard linux console's terminfo 
description, change all the display-related bits to use the control codes for 
the LCD, then add another getty in inittab which uses snooptty to echo 
everything from the console to the serial port the lcd is on (Thanks to max 
and mark for help with this). This works in that I can see characters I type 
appear on the lcd, and erase characters, move the cursor backwards and 
forwards, and clear the screen, but the hardware control codes for the lcd 
are so minimal that it's barely useable. Problems are - no hardware 
scrolling, no newline characters (just get a wierd squiggle and it carrys on 
on the same line). Also when you go off the end of line 1 it moves to line 3, 
then back to 2 and on to 4. (This is apparently common to all lcds, due to 
their strange memory maps)
I'd hoped that the way terminfo and curses worked was that any capabilities 
which couldn't be done in hardware were emulated in software - e.g. scrolling 
by manually redrawing the screen using the 'move cursor to x,y' codes which 
_are_ available. But it doesn't seem to work this way - when I try to page a 
file with less, it just says something like 'terminal not capable'.
So what I'm looking for is some kind of intermediate driver which will sit 
between curses/terminfo and the serial connection, emulating in software the 
basic capabilities I want the display to have (mainly scrolling and 
newlines), but still allowing applications to access the display through the 
standard terminfo codes, rather than having to write a custom api.
If anyone knows of anything like this, or where would be good to look for it, 
it would be a help. I've looked on sourceforge, and there are a few 
applications with custom lcd display drivers, but no generic curses 
compatible driver as far as I can see. If not, I'll have to try to write one 
some time, but I'm not sure my head is up to this at the moment.

thanks, andy.