MythTV Ubuntu Installation Guide



Introduction

Here are some general tips to get the most out of your Ubuntu or MythTV system.

Log in Automatically

To log in automatically on startup (handy for a MythTV box), change your /etc/gdm/gdm.conf-custom file:

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=mythtv

Run MythTV Frontend Automatically

mythfrontend can be run automatically by adding it to your .gnomerc file. If this file exists in your home directory, it is run on login. Create the file:

gedit /home/mythtv/.gnomerc

Add the following lines:

sleep 10 && mythfrontend > /tmp/mythfrontend.log 2>&1 &

Save the script and make it executable:

chmod 755 .gnomerc

Protecting MythWeb

I use simple apache security to prevent unauthorised access to my MythWeb connection. It presents a dialog box asking for a username and password.

Do the following as root or using sudo. Edit the file: /etc/apache2/apache2.conf. Add the following section (just search for Directory and add it somewhere near there). "ripley" is the name of my MythTV box:

<Directory /var/www>
  AuthType Basic
  AuthName "ripley"
  AuthUserFile /etc/apache2/htpasswd
  Require valid-user
</Directory>

Create a password file:

cd /etc/apache2
htpasswd -c htpasswd garry

Make the LIRC Device Static

If your remote control uses a /dev/input/eventN device, you may have a problem where the event number is assigned differently after each reboot, forcing you to change your LIRC config each time. To get around this, you can tell udev to identify the device and create a symbolic link to it each time. This not quite as hard as it sounds...

First of, all determine your IR device:

$ cat /proc/bus/input/devices

I: Bus=0001 Vendor=0070 Product=9002 Version=0001
N: Name="cx88 IR (Hauppauge Nova-T DVB-T"
P: Phys=pci-0000:02:09.0/ir0
S: Sysfs=/class/input/input3
H: Handlers=kbd event3
B: EV=100003
B: KEY=100fc312 214a802 0 0 0 0 18000 41a8 4801 9e1680 7bb80 0 10000000

We can see that my remote is currently using /class/input/input3 (/dev/input/event3). We now need to find the vendor ID of the device by using the following command (be sure to change the device number to the one identified in the previous step):

$ udevinfo -a -p $(udevinfo -q path -n /dev/input/event3)

udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.

device '/sys/class/input/input3/event3' has major:minor 13:67
  looking at class device '/sys/class/input/input3/event3':
    KERNEL=="event3"
    SUBSYSTEM=="input"
    SYSFS{dev}=="13:67"

follow the "device"-link to the physical device:
  looking at the device chain at '/sys/devices/pci0000:00/0000:00:0e.0/0000:02:09.0':
    BUS=="pci"
    ID=="0000:02:09.0"
    DRIVER=="cx8800"
    SYSFS{class}=="0x040000"
    SYSFS{device}=="0x8800"
    SYSFS{irq}=="209"
    SYSFS{local_cpus}=="1"
    SYSFS{modalias}=="pci:v000014F1d00008800sv00000070sd00009002bc04sc00i00"
    SYSFS{subsystem_device}=="0x9002"
    SYSFS{subsystem_vendor}=="0x0070"
    SYSFS{vendor}=="0x14f1"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:0e.0':
    BUS=="pci"
    ID=="0000:00:0e.0"
    DRIVER=="unknown"
    SYSFS{class}=="0x060400"
    SYSFS{device}=="0x00ed"
    SYSFS{irq}=="0"
    SYSFS{local_cpus}=="1"
    SYSFS{modalias}=="pci:v000010DEd000000EDsv00000000sd00000000bc06sc04i00"
    SYSFS{subsystem_device}=="0x0000"
    SYSFS{subsystem_vendor}=="0x0000"
    SYSFS{vendor}=="0x10de"

  looking at the device chain at '/sys/devices/pci0000:00':
    BUS==""
    ID=="pci0000:00"
    DRIVER=="unknown"

The output is a bit confusing, but you should be able to see your device and get the vendor ID. Now all you need to do is create a file called /etc/udev/rules.d/10-local.rules and add the following (using your vendor ID):

KERNEL=="event*",SYSFS{vendor}=="0x14f1",SYMLINK="input/irremote"

Restart udev using:

/etc/init.d/udev restart

You should now see a symlink to your event device:

$ ls -l /dev/input
total 0
crw-rw---- 1 root root 13,  64 2006-10-02 22:27 event0
crw-rw---- 1 root root 13,  65 2006-10-02 22:27 event1
crw-rw---- 1 root root 13,  66 2006-10-02 22:27 event2
crw-rw---- 1 root root 13,  67 2006-10-02 22:27 event3
crw-rw---- 1 root root 13,  68 2006-10-02 22:27 event4
lrwxrwxrwx 1 root root       6 2006-10-02 22:27 irremote -> event3
crw-rw---- 1 root root 13,  63 2006-10-02 22:27 mice
crw-rw---- 1 root root 13,  32 2006-10-02 22:27 mouse0
crw-rw---- 1 root root 13, 128 2006-10-02 22:27 ts0

Now simply change your LIRC config (/etc/lirc/hardware.conf) to use the new device:

LIRCD_ARGS=""

#Don't start lircmd even if there seems to be a good config file
START_LIRCMD=false

#Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="dev/input"
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
#DEVICE="/dev/input/event2"
DEVICE="/dev/input/irremote"
MODULES=""

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""

Reboot and check that the symlink is created and that LIRC is working.


Leave a comment.