More lucky frogs

Last year I found a Lucky Frog in the grass cuttings.

In August I spotted this frog on the lawn before mowing over it.

This weekend I found a larger frog in our green bin, we hadn't been doing any mowing.


Installing Mythbuntu

The K45 doesn't have a slot for a CD drive, so I decided to install from a USB drive (my MP3 player).

I downloaded the Mythbuntu 8.10 x86 ISO, and tried to use usb-creator to write it to the MP3 player. Nothing happened. The program just hung.
I gave up on usb-creator and used UNetbootin instead. This worked first time and didn't delete my MP3s.

The K45 booted from the MP3 player and X11 appeared on the TV.
The resolution was the TV's native 1360x768 with a 60Hz refresh rate, but the display was shifted to the right so I can't see the clock. The controls on the TV are unable to correct this.
The picture is also slightly wobbly. These problems disappear when the resolution is changed to 1024x768.

I ran the installer, it partitioned the hard drive with a small ext3 / partition and the rest as an xfs /var.

The installer asked for mysql and mythweb passwords, but these were ignored.

Mythbuntu automatically logs in as the user that was created during install and mythfrontend is started. No keyboard or mouse are required.

I used NetworkManager to connect to my wireless network. It asked for a password to secure the
keyring with. In normal Ubuntu, you should use the same password as your user account, so that the keyring can be unlocked automatically when logging in. As Mythbuntu logs in automatically without a password, it doesn't know the password to use to unlock the keyring. So when setting the password for the keyring you need to use an empty password.

A PC uses more power than a set-top box, so it's a good idea to turn it off when not using it. But the PC needs to be on to record a scheduled programme, so an alarm has to be set to turn the computer back on a few minutes before the recording. The alarm is set by writing the required time to /sys/class/rtc/rtc0/wakealarm. Mythbackend can be configured to automatically set the alarm and turn the computer off when it is idle and there are no clients connected. There is a problem here - mythfrontend is started every boot, so there will always be a client connected, and the computer will not be turned off. The solution is to start mythwelcome instead of mythfrontend. Mythwelcome can start mythfrontend when requested using a remote control. To start mythwelcome at boot edit /etc/mythtv/session-settings and set MYTHWELCOME=true.

Now that the PC isn't on all the time, cron processes do not run, so the weekly database backup doesn't happen. To fix this, just install the anacron package.

The driver for the remote control I use converts the IR signals into key presses.
The keyboard controls for MythTV can be configured.
So you'd think that it should be possible to configure MythTV to use the key presses from the remote, without having to go through LIRC. It isn't, I'm not sure if this is a bug in MythTV or in the QT library it uses.

When using the arrow keys on my remote, I noticed that the key presses were being duplicated.
It turned out that the IR sensors on both DVB tuners were receiving and understanding the signals.

In Mythbuntu 8.10, HAL automatically configures the X11 server with all connected keyboards.
This includes the remote controls, so LIRC is unable to get exclusive access to the remote control. This bug has been fixed by creating a HAL configuration file to tell it to ignore
some keyboards that are known to be remote controls. This also allows me to ignore the IR sensor on one of the tuners.

When Mythbuntu installs LIRC, it automatically creates the LIRC configuration files for MythTV, Mplayer, Vlc and Xine that are tailored for the remote control you're using. These are a useful starting point, but I've had to tweak them.

MythTV hardware setup

The Shuttle K45 assembly instructions were usable. They say to apply thermal paste to the heatsink, but Intel supply the heatsink with thermal paste already applied.

It was a bit of a fiddle to get my DVB tuner card in the case, as the aerial socket near the top got in the way.

The Celeron comes with a CPU fan with a 3 pin connector, but the K45 motherboard has 4 pins.
The 4th pin is used to control the fan speed. A 3 pin fan can be connected to a 4 pin motherboard, but the fan runs at full speed all the time.

At full speed, this fan is very noisy, so I had to replace the heatsink and fan,
There isn't much room in the K45, so most heatsinks designed for low noise don't fit.
I selected an "Arctic Cooling Freezer 7 Low Profile", which has reduced the noise to bearable levels.
The heatsink is bigger than the supplied Intel heatsink, so the mount holes on the motherboard are too close, and small plastic extensions have to be fitted.
The motherboard has some SMD components near the mount holes, so the extensions do not fit flat, but they do still work.

I think the power supply fan is currently the loudest noise source, but I don't feel like replacing it at the moment.

The K45 has a clear face plate so that you can customise the case with your own images. I've used the MythTV logo for mine.


Choosing MythTV Hardware

Continued from previous post.

Dell sells a Studio Hybrid computer which is very small and power efficient, but is too small for a PCI TV tuner card, and too expensive for what I want.

The Sonata Desktop mATX Media Center Style Case, Silverstone LC02 Media Center Case and Hiper Black Media Center Case, etc are all too big.

Shuttle make a K45 barebones computer which is small, power efficient, cheap and has space for a PCI tuner card.
It doesn't have TV output, but as we now have a Samsung LCD TV with VGA input, this isn't a problem.
It would be nice if it had S/PDIF output for connecting to a surround sound system, but it's not required for current UK DVB-T broadcasts.

I chose the K45. I hope it's quiet.

That's the case, PSU, motherboard, GFX and audio sorted, and I already have 2 DVB-T tuners, which leaves CPU, RAM and HDD to choose.

The motherboard has an Intel LGA775 slot, so it could be fitted with a Pentium Dual-core, a Celeron, a Core 2 Duo, etc. The Celeron is much cheaper than the others and has more than enough processing power for playback of DVB video. It also has a 35W TDP, so it shouldn't need lots of cooling.

1GB of RAM should be enough.

A 250GB hard drive would be plenty, but 500GB is only a few pounds more, so you'd be silly not to.

Shuttle KPC K45£75.81
Corsaid 1GB DDR2 RAM£16.67
Seagate 500GB SATA HDD£48.95
Intel Celeron 430£23.74

To be continued.


Why I'm switching back to MythTV

I used to run MythTV on my desktop computer. I had a dual head Nvidia graphics card with TV output connected to a widescreen CRT TV. It recorded Freeview using a Hauppauge DVB-T tuner card.
The computer was in the lounge and was on all the time. The computer's fans were rather noisy.

When we moved into our current house in 2007, the computer was moved into the study. The study doesn't have a television aerial, so we stopped using MythTV.

We purchased a Thomson Top Up TV Freeview recorder from Tesco.
This has two tuners, so it can record two channels at once. It's not silent, but is much quieter than my computer was. It doesn't require a subscription, but it can record Top Up TV if you do have a subscription.
It has a 14 day programme guide.

We've been using this recorder for over a year, and have decided that it's time to switch back to MythTV.


Because the software sucks.

It has a series link function, but the planned recordings page doesn't show all the episodes it will record, just the next one. This means that you can't see programme conflicts. When that episode has been recorded it finds the next one and schedules it. If the next episode isn't in the 14 day programme guide, because the show is missing a week, then it forgets the series link.

It has a global setting to record the 5 minutes before and after a programme. You have to fast forward through these 5 minutes when starting to watch the programme. The scheduler isn't aware of this setting, and doesn't flag conflicts between programmes that start and end at the same time. The setting is remembered per planned recording, but you can't see or change it on existing planned recordings.

It has 2 tuners, but the series link scheduler sends a conflict message when both tuners will be used.
The conflict message often displays garbage for the name of the program it conflicts with.
If you use the record 5 minutes before and after setting, then you get the conflict message 6 times.
Messages cannot be deleted until they have been read.

The series link scheduler won't record a programme in a different time slot or from a different channel if there are conflicts with other recordings. The user has to resolve conflicts manually.

If you watch a programme and don't finish it, it remembers where you got to, but when you start watching the programme again, you have to remember to press a different button.

When fast forwarding through a recording, it sometimes forgets where it is and jumps back to the start of the recording.

When deleting a recording, it sometimes hangs and reboots itself.

If it reboots during a recording, it doesn't keep the part of the show it had been recording.

If you are watching live interactive TV from a channel with a recording planned, then the recording is of the interactive stream, not the programme you wanted to record.

The software was changed recently so that the recording of some Top Up TV content cannot be disabled.

Even my wife is annoyed with it enough to want to replace it.

So our requirements for a new MythTV box are:
  • Small (must fit underneath TV)
  • Quiet (the lounge is for relaxing)
  • No keyboard/mouse (wife doesn't want a "computer" in the lounge).
  • Low power (Electricity isn't getting cheaper).
  • Cheap (or we'd just try a different set top box)
  • 2 tuners (we regularly record a BBC and ITV programme at the same time)
To be continued...


Debugging child processes

Program A executes program B.
You want to debug program B.
B exits before you can attach your debugger.

Insert an infinite loop in main() in program B:

while(1) {}

Run program A.
Attach debugger to program B.
Set the program counter to the next line:

In gdb, use the "jump" command.
In Visual Studio, use the "Set next statement" command on the context menu.


My First YouTube video

I used kino to edit the video and speed up the middle bit. The audio was a bit noisy after the speedup, but after exporting to FLV the audio had disappeared anyway.