Tuesday, April 29, 2008

MythTV iMON server - alpha release 1

As I mentioned before, I've been working on an LCD server for mythtv in my spare time with the intention of making full use of the iMON LCD's icons. I'm happy to say that I'm ready to release the first alpha version. Its a little rough around the edges, and very basic in functionality at the moment, but it's a decent start.

Note: this application is specifically for the iMON LCD...NOT the VFD. If your display doesn't look like the photos at the bottom of this page, you have the VFD, and this program won't do you a bit of good.

How to get it
First, you will need to download 2 separate archives. The first is the application specific archive, and the second is an archive of perl libraries I've written.

mythimon:
http://www.ronfrazier.net/mythtv/downloads/mythimon.tar.gz

RFLibs:
http://www.ronfrazier.net/mythtv/downloads/RFLibs.tar.gz

Make sure the RFLibs folder exists as a subdirectory of the folder where you put the mythimon files.


Running it

The first thing you want to do is to disable any other software that is outputting to the lcd (including LCDproc). The only thing you want to keep loaded is the lirc imon lcd driver.

Next, the simpler test is to try running testAnimations.pl and make sure you get output on the LCD. If you have the older version of the iMON LCD, you will need to edit the code and change '15c2:0038' to '15c2:ffdc'. Also, if your device is setup somewhere besides /dev/lcd0, modify that setting too. If it works, you are good to go for the next test. If not, check for things like perl libraries, and make sure you are using at least perl 5.8 (needed for the thread support).

Next, you can try the mythimon.pl application. First you need to open it up and setup a few config variables. Specifically, the port numbers for the lcd server and the network control, the location of the frontend log file, the location of the lcd devices, and the iMON version.

If you don't have logging enabled for your frontend, you will need to add logging by adding the necessary paramters to the script that launches mythfrontend (ex "-l /var/log/mythtv/mythfrontend.log"). You will also need to have enabled both the network control port (found under setup->general) and the lcd port (under setup->appearance). You may need to restart the frontend for these changes to take effect.

Once that's all setup, you want to kill the existing instance of the mythlcdserver (so you can steal the port from it) and quickly start up the application. You can do this with the command:

killall mythlcdserver; ./mythimon.pl

You should now be looking at a screen with a clock. Next, you need to wait up to 10 seconds for mythfrontend to connect to the lcdserver port. When it does, you will see the output "FIRST COMMAND RECIEVED FROM MYTHLCDSERVER" appear on the command line (not on the LCD).

Now, when you go to watch TV or listen to music, you should get info on the screen and icons lit up. If not, again, check for perl libraries. Make sure you have the mythtv perl bindings installed.


Known Limitations

Being a work in progress, there is (by definition) a lot of stuff to be added or improved upon. Here are some of the known limitations, and what I plan to do:

Menu Support - This will be added most likely in the next version. I plan to integrate it with the front panel controls of the case via lirc. This way the menu's won't pop up whenever there is a menu change in myth (as mythlcdserver does). Instead, it won't display the menus until you hit the specified button on the front panel to enter menu mode. Then the menu display will override everything else until you hit the specified exit key or you let the menu timeout.

Volume Support - This will be added eventually. I plan to add a bit of configurability here...perhaps with plugin modules. One of the things I want to do for my specific setup is to integrate it with my TV, so it controls the volume via the serial port. I prefer this to adjusting the volume within mythtv. However, that's not going to work for most people, so I'll make it work both ways. With a simple plugin architecture, I'm thinking people could customize it to work with their setup (such as controlling an AV receiver).

Generic Info - This is info like photo names in the photo gallery, etc. Hopefully this will be in the next verison also.

Pausing/Stopping - There are times when myth doesn't send progress updates (like when playing music in the background). As a result, I've taken it upon myself to continuing calculating the progress on the assumption that playback is proceeding as normal. However, since myth sends no pause events, I have no way to track them. Thus, when you pause, my script doesn't know it, and keeps going. A similar problem exists with not knowing when music playback has stopped. I haven't yet figured out an ideal way to handle this. Probably some hack of monitoring the IR codes, cross reference that will the current location as reported by the network control port, etc.


Ideas for future expansion

I welcome feedback on ideas for what other types of things to do. There are some things I'm not sure about:

Uses for icons/display features - Anything interesting I can do with the top progress bar, other than just duplicating the bottom progress bar? When I add menu support at a later time, I was thinking I could use it to track progress through the menu (like a scrollbar on the side of your browser). How about the spinning disk, and the tray icon right below it? And the vol and time icons (one use is obvious, but also kind of pointless)? How about the source icons? I've taken advantage of TV and HDTV, but not SRC/SRC1/SRC2/FIT (and while we are at it...what the heck is FIT for anyway?).

Any good way to get the recording status out of the backend for the rec icon? I could also try monitoring the backend log, but that won't always be available on the remote frontend.

Anyone know a way to get codec data out of the music player to light up those icons?

How about getting weather data out of mythweather?

Is there any easy way to get spectrum analyzer data out of myth or the linux audio system?


Custom Fonts

I've created 2 different fonts for the application. The first is a normal font, 16 pixel tall (currently used for the clock). The other is an 8 pixel tall font with small caps instead of lowercase letters. OK...technically I made a 3rd font, but it only consists of 1 charachter (space), and is only meant as a vertical spacer in the display.


If you would like to make your own fonts, you can use this utility
http://www.ronfrazier.net/mythtv/imon_fontedit.html

If you come up with some good fonts, please feel free to share them with me.


Screenshots





























12 comments:

Unknown said...

Very nice piece of software, thanks very much. What's the best way to report bugs? Just post them as a comment here?

Unknown said...

Hi Ron. This looks like some really promising code. I was trying to get it running on the latest MythBuntu 8.04 (hardy) with the DH-101 case without much luck. Do you have any pointers that could help get your code running on the latest mythbuntu with the dh-101 case? thanks .
Andy

Nias said...

nice work,
your testanimations.pl was the only program which with i can get some (more or less) usefull output on my 0038er lcd display (silverstone grandia case).

i've tried the various patches from Codeka for LCDd (i've read your blog entry too) but it seems there are some errors inside this LCDd patches. (send_packet: packet tx failed (-32) most of the time)

It looks like some wrong casts for the 64bit defines could be the reason:

i.e.
#define COMMANDS_SET_ICONS (uint64_t) 0x0100000000000000

compiler (32bit gcc-4.1 .. 4.3 (debian/sid)) complains about values shorted to long.
i've changed to
#define COMMANDS_SET_ICONS (uint64_t) 0x0100000000000000LL //LL for long long
on all from compiler mentioned places, but won't help really. Perhaps missed some places where compiler not complains about?

Unknown said...

Good stuff! If I may it could do with a contrast setting like used in LCDd.conf. My sceen is a little dark.

I get an "Net::UPnP::ControlPoint is not installed!" message when mythimon.pl starts even though Net::UPnP is installed. But seems to work no problems. Cheers.
Jai

Ryan said...

I like the font tool. In the realm of flash authoring, there are probably hundreds of people who have created pixel fonts that should be able to convert over directly into fonts for the imon screen.

Perhaps a tool to create a pixel-font over to iMon would help make fonts faster?

There are many freeware pixel fonts available here:

http://www.bestflashanimationsite.com/pixel-fonts/

Although... I suppose I could just spend hours copying each character into your tool too :)

Simon said...

Thanks for this and your instructions for setting up the LCD screen. I've found both very useful! Please keep us up to date on the progress of this tool, I'm looking forward to playing with some of the new features.

Unknown said...

Are you still working on this very nice software? :)

William said...

Great work on this project. I'm impatient about the next release

Unknown said...

Dude, You rock! This is ver cool. I'd been stuggling with my Antec Fusion LCD for a few hours before stumbling upon your blog. I got it working with LCD proc thanks to your previous blog posts and now i've got all these fun perl libraries to play with!

thanks a lot!

ict said...

Very nice. Are you working on a way to turn off the backlight? Is it even possible? I really hate that the backlight stays on even if the machine is powered off and I read somewhere that in Windows the Backlight will switch off.

antgel said...

Hi, thanks for this. Just one thing. On my system, /dev/lcd0 isn't world read/writeable, and running mythimon.pl as root causes myth not to be able to use the socket (and is probably not secure).

All I've done so far is to chmod a+rw /dev/lcd0, but I don't really like that either. Any ideas on how to best solve this? I thought of making /dev/lcd0 owned by the mythtv group.

I'm surprised you didn't see this issue.

Sumant said...

LCDproc is the software used to drive either LCD or VFD Displays on your MythTV Case.

LCDproc consists of a server daemon called LCDd that drives the LCD/VFD, and a collection of client applications tells the server what to display. There are also a collection of driver stubs for different LCD/VFD's. The stubs talk to the driver for your specific display.

Many Home Theater PC Cases now include VFDs from SoundGraph's iMon family of VFD displays. These typically are connected to your system through a USB port.

The Driver for the SoundGraph iMon comes bundled with the latest LIRC package which most modern Linux distributions will have installers for. The driver name is lirc_imon.

Recently I just came across a good article on " Windows Server"
Here is its link.