Saturday, April 5, 2008

Getting iMON 0038 LCD working with LCDproc

Yesterday I discussed how to get the iMON display working in LIRC. The next step after that is to get the LCD display working. The most popular program for controlling the LCD is probably LCDproc. As it turns out, once you've got LIRC running the LCD properly, it's relatively easy to get LCDproc going too.

Once again, these instructions are specific to the 0038 version of the iMON LCD. Other versions may need slightly different instruction. Check over at the codeka.com forums for details.


Step 1 - Making sure your LIRC installation is good

LCDproc relies on the lirc_imon driver that is part of LIRC. If that isn't properly configured and installed, you have little hope of getting LCDproc going. Well, I've heard it's possible to have LCDproc control the LCD directly without LIRC, but I haven't tried it so I don't know if it's true, and even if you were to do so you'd lose its IR and front panel button capabilities. For this reason, LIRC is really the right way to go.

To test if your LIRC installation is correct, you can run the following command:

perl -e 'print pack "H*", "80000000091e0088"' > /dev/lcd0

When you run this command you should see the LCD clear itself and then display a clock with the time "AM 09:30" (in an ugly font, where the 4's look like 9's, and are only different by a single pixel, but I digress). If that's what you get, then lirc_imon is configured fine. You can proceed to step 2 after resetting the LCD with the following command:

perl -e 'print pack "H*", "4000000000000088"' > /dev/lcd0


If you weren't so lucky, then you might have a problem. First thing you want to do is make sure the driver is loaded:

lsmod | grep lirc_imon

You should get back a few lines of text that contain the lirc_imon driver and some other drivers (lirc_dev, usbcore, etc). If you get back nothing, try loading the driver manually:

modprobe lirc_imon

Then try running the command to set the clock again. If it works now, you may need to find a way to load the lirc_imon driver automatically (possibly by putting lirc_imon in /etc/modules). After that, you can proceed to step 2 (turn off the clock, first).

If it STILL isn't working, go back again and test whether the iMONs IR and/or front panel buttons are still working with LIRC. If not, somehow you don't have LIRC built correctly, with the correct patches, so you need to fix that first. Check out yesterday's post on that topic. However, if it does work, then my best guess is that LIRC thinks you have the VFD rather than the LCD and built the lirc_imon module for that device.

If you configured LIRC for only a single device (the Soundgraph iMON IR/LCD), then it should have handled everything for you. However, if you are like me, and have a separate IR receiver that you are using, and thus need to install LIRC with multiple drivers, you probably configured it something like:

./configure --with-driver=all

As I covered in an update to my post on setting up LIRC with multiple devices, the --with-driver=all option will configure it to use the VFD rather than the LCD. You will need to change config.h so that the line:
/* #undef LIRC_IMON_LCD */

becomes:
#define LIRC_IMON_LCD 1

and then recompile and reinstall LIRC. Then unload and reload the lirc_imon driver. Then once again try the perl command to set the clock. It should now work (once again, be sure to turn off the clock before proceeding). If you still have problems...I have no clue. You are on your own. Try posting over at the codeka.com forums.

Step 2 - Configuring LCDproc

This is actually a much simpler process than it was configuring lirc. Once again, you will want to follow the basic instructions post by Dean at the codeka.com forums. However, you will want to make the following changes.

1) Instead of using dean's lcdproc-0.5.2-imonlcd-0.3.patch patch, download my slightly modified version. I've made a few tweaks where he forgot to set an icon flag or set the wrong icon flag.

2) After running automake but before running configure, you will want to download my slightly modified version of madCoder's patch for the 0038 model, and apply it by running

patch -p1 <../lcdproc-imon_0038-v2.patch

3) When you get to the part about modifying the /usr/local/etc/LCDd.conf file, rather than changing the file manually, you might want to start by downloading my patch for the conf file and applying it with:

patch /usr/local/etc/LCDd.conf ../LCDd.conf.patch

This saves you from the error prone process of modifying it manually, especially since it's easy to leave off the leading or trailing slash on the DriverPath setting (in fact, deans instructions even left off the trailing slash).

4) Dean mentions changing the RENDER_FREQ from 8 to 1. You might want to experiment with other values in between (2 to 4). While I found 8 to be too fast, 1 update per second was too slow for my tastes. If you decide to play around with it, you will need to recompile each time (it would be better to move this to the config file, but I didn't find it important enough to waste the effort on). After making a change, you do NOT need to rerun configure or any of the previous commands. Just make and make install.

Step 3 - Testing LCDproc

This part is quite easy. Just run the following command:

LCDd -f -r 4

The display should light up with some text from LCDproc. If not...well, I really don't know what could have went wrong. Just make sure you carefully followed all of the instructions in the proper order (are you sure you ran the command to turn off the clock in step 1)?


Thats it!

See, it was quite easy. In fact, if you take a look at my instructions, you'll see that there was more detail involved with debugging your lirc_imon setup than there actually was getting LCDproc going.

You can now go on to configure your other applications to interface with LCDproc. Sorry, I have no advice on that part yet. I'm actually working on my own interface program at the moment (it seems I've got more things going on than I have time to write about). I'm sure I'll talk about that at some point.




10 comments:

Vincent Gelders said...

Hello Ron,

I've encountered a problem while using your patch.
patching file drivers/lirc_imon/lirc_imon.c
Hunk #3 FAILED at 199.

I'm using Ubuntu 8.04 with kernel 2.6.24-17-generic in a zalman hd160 plus case with imon lcd. There are no drivers loaded for the imon
What could be the problem ?

Greetings from Belgium,
Vincent

Erik said...

Hi Ron,

I have the 15c2:0038 SoundGraph Inc version. I'm running Hardy 8.0.4 AMD64. I followed your instructions for LIRC and Lcdproc carefully. Lirc is working fine now; my remote does everything I want. The LCD remains a problem: LCDd and lcdproc seem to work fine and give the right reactions in debugging mode, but the LCD keeps showing the time, it blinks now and then but does nothing else.It only show garbage output. I don't have any ideas left. Who does?

grmmlzwrg said...

erik, this sounds like my problem. I fixed it with luismc's trick here: Re: getting send packet failed errors from Lirc

Hope that helps. Although those are two excellent guides, Rons LIRC instructions did not work for me. I used a recent, plain CVS checkout instead.

Γιώργος said...

Help needed!!!!
I have the thermaltake dh 101
and i was in mythbuntu 8.04
after i made many efforts to install new lirc drivers (lirc-0.8.3)
nothing better even folowing th how to ( http://mythtvblog.blogspot.com/2008/...with-lirc.html )
Finally decide to upgrade to mythbuntu 8.10
but UNFORTUNATELY after
Code:

sudo /etc/init.d/lirc restart --verbose

i take back the message.....
Unable to load LIRC kernel modules. Verify your
* selected kernel modules in /etc/lirc/hardware.conf
Any ideas will be very very use full....

Gerbert said...

Hello Ron,

I have followed your instruction, but when I apply the lcdproc-0.5.2-imonlcd-0.3-v2.patch I get the following error:

patch: **** strip count l is not a number

I use openSUSE 11.0 with kernel 2.6.25.18-0.2-pae
What can be wrong?
Gerbert

Anant said...

Hi Ron,

Thanks a lot for the wonderful guide. Few months back when I tried configure the remote on Ubuntu 8.04, it didn't work. Later, I found the Ubuntu specific fix and it worked like charm. After owning this device (Silverstone ML02) for more than a year, now I am able to configure the remote and enjoy the MythTV sitting on my couch.

Anant

sober said...

Thansk for the article, additional info
perl -e 'print pack "H*", "8800000000000088"' > /dev/lcd0 turn off lcd

fw_crocodile said...

i've a 0038 model too.

But the commands ont the patch seems to be incorrect as the LCD doesn't work correctly.

And if gived directly with the perl command line they doesn't work.

For example the two COMMANDS_DISPLAY_ON
5000000000000040
0000000000000040

The second one should be the right one buth both doesn't work.

How did you get those commands? How can i found those for mine?

Marc said...

On Ubuntu 9.10, when you run:

sudo perl -e 'print pack "H*", "80000000091e0088"' > /dev/lcd0

I got:

bash: /dev/lcd0: Permission denied

chmod the file and then the command functions.

John said...

bash: /dev/lcd0: Permission denied
quick fix sudo su then type the command.
the permission for lcd0 are:
crw-rw---- 1 root root 180, 144 2009-12-29 15:49 /dev/lcd0

So no-one but root read and write. The redirection in bash is done with your current permissions not the the sudo permission not sure if this behavior changed between 8.04 and current versions.