Alphacool LCD support in serdisplib, lcd4linux - the hard way
The Alphacool LCD is nice: 320x200 pixels, graphical, brushed aluminium with a blue back-light. I've got one in my main PC, and it's been sitting there - inactive - since I upgraded from Ubuntu Feisty. Yesterday I (finally) got it going again, with only a little mucking about.
The display is now officially in serdisplib, provided you've got libusb (and specify it in the configure), and there is a serdisplib-based driver in lcd4linux ... although it's not compiled in the standard lcd4linux package that comes with Ubuntu Intrepid.
So, first thing was to download serdisplib and compile it. To do this in a slightly-more sensible way I use checkinstall to create a .deb package. It's a good idea, because it means the software is controlled by the packaging system (and can therefore be removed or reinstalled as necessary). Install checkinstall if you don't have it
sudo apt-get install checkinstall
So, I gunzipped the serdisplib package then opened a terminal and navigated to the appropriate directory:
cd ~/serdisplib-1.97.8
This is the source-code of serdisplib, so I need to configure and make it to compile it for my system. Make sure you scroll back up and check the output of the configure, because the first time I tried it didn't compile libusb because I didn't have the libusb-dev package. This was resolved by installing it in the usual way:
sudo apt-get install libusb libusb-dev
So then, configure and make:
./configure --enable-libusb
make
Alright, at this point I had compiled the binaries, but they're still sitting in this directory (rather than the /usr/bin and other system directories). It's a good time to test out the display:
testserdisp -n alphacool -p 'USB:060C/04EB'
It's a bit weird, but the display shows up as an "EEH Datalink GmbH". Try:
lsusb
... and you can see an entry like
Bus 004 Device 002: ID 060c:04eb EEH Datalink GmbH
Anyway, my test worked - the LCD was activated and displayed a test pattern. You can run a few tests with this one, but I was just happy to see it running again. Time to install serdisplib to the system!
Normally, this is done by running something like "sudo make install", which copies the compiled files and libraries to the appropriate locations, but as I said earlier this would mean serdisplib was entirely outside the packaging system. Instead, run:
checkinstall
This will ask a couple of questions (a description) and then create a .deb package which can be installed (and removed) like any other package. Find the .deb in the same directory and either double-click it in the file manager or install it from the terminal with
sudo dpkg -i serdisplib_1.97.8-1_i386.deb
What I didn't realise, but probably should have, is that this installs to /usr/local (e.g. /usr/local/bin, /usr/local/lib) rather than /usr. This isn't really a problem, but lcd4linux had trouble a little further on finding the libraries in /usr/local/lib rather than /usr/lib. At the time, I just copied the serdisplib stuff from /usr/local/lib to /usr/lib, but it would probably be better to either configure serdisplib to use /usr, or configure lcd4linux to look in /usr/local/lib. Oh well.
So, onto lcd4linux. I already had lcd4linux installed from the Ubuntu repositories, but it didn't include the serdisplib driver. You can check what drivers are included with
lcd4linux -l
So it was time to download the source code for lcd4linux too. Gunzip this in the same way as serdisplib. After attempting to compile this a couple of times I found I needed to patch the source code. Download the patch to your home directory and apply it
cd ~
patch -p0 < lcd4linux-0.10.1_rc2-nordtsc.patch
then we can compile and install it
cd lcd4linux-0.10.1-RC2
./configure
make
checkinstall
sudo dpkg -i lcd4linux-0.10.1_RC2-1_i386.deb
Cool! So now I had the new lcd4linux AND it had serdisplib support. Because I had the Ubuntu repository one too, I could test the two:
/usr/sbin/lcd4linux -l
That's the Ubuntu repo one
/usr/local/bin/lcd4linux -l
and that's the new one. Importantly, this has the line
serdisplib : any
showing that it has the serdisplib support compiled in.
Because I had installed the repo one first, I already had an init.d script for starting lcd4linux at boot time. However, you want to edit /etc/init.d/lcd4linux and specify the absolute path to the new lcd4linux executable. i.e. change the DAEMON line to:
DAEMON=/usr/local/bin/lcd4linux
Also, you need an lcd4linux config file in /etc/lcd4linux.conf. The easiest way to get this is copy the sample one
sudo cp /usr/share/doc/lcd4linux/lcd4linux.conf.sample.gz /etc/
cd /etc
sudo gunzip lcd4linux.conf.sample.gz
sudo mv lcd4linux.conf.sample lcd4linux.conf
Now edit /etc/lcd4linux.conf with your favourite text editor. Find the SerDispLib display section and replace it with this:
Display SerDispLib {
Driver 'serdisplib'
Port 'USB:060C/04EB'
Model 'ALPHACOOL'
}
Then go to the end of the file and comment/uncomment the appropriate line to specify the SerDispLib display
Display 'SerDispLib'
#Display 'LCD-Linux'
#Display 'LCD2041'
#Display 'LK202'
#Display 'LK204'
#Display 'MI240'
#Display 'CW12232'
#Display 'HD44780-generic'
#Display 'HD44780-WinAmp'
... and a layout
Layout 'Default'
#Layout 'TestLayer'
#Layout 'TestImage'
#Layout 'L8x2'
All being well, you should be able to start up lcd4linux and have the display activate with
sudo /etc/init.d/lcd4linux start
Cool!
There's a lot of tweaking and playing that you can do with lcd4linux layouts, so go nuts.