DvicoDualExpressMythTVUseCase

From LinuxTVWiki
Jump to navigation Jump to search

DViCO MythTV CentOS Use Case

My wife and I have been using the DViCO FusionHDTV DVB-T Dual Express with mythtv on CentOS x86_64 as our PVR and TV since Feb2008. MythTv is configured to program the motherboard Real Time Clock interrupt to powerup the pc from an off state to record programs, and poweroff the pc once a recording is complete. The motherboard is an Asus p5K, Core2 Q6600 2.40GHz, ATI Radeon 1950 pro, Silverstone LC20B, SeaSonic 650W PSU. The setup is dual head using 2 22inch wide screen lcds, great for running the TV on one screen while reading email etc on the other. A small usb keyboard with a long cable has been a successful replacement for IR remote control. The screens are only 1.5m from our lounge chair. At 1.5m a larger screen would be perfect for reading small text in a browser at 1680x1050. Would like to investigate xorg multiseat as addition to this setup.

Tasks: -Finish the key mapping for the IR controller. -Develop a fix for the EIT. EIT uses the networkid in table dtv_multiplex and populating this breaks reception ABCHDTV. XMLTV works fine. On several occasions the programming from xmltv was incorrect so I have disabled it and used the tv guide from the paper since! -Investigate a live TV display problem when switching from an SD to HD channel. From SD to SD and HD to HD ok. The work around is to exit the display and re-enter. Some sort of initialisation problem and is probably poor configuration on my part. (Utilities/Setup -> Setup -> TV Settings -> Playback -> Playback Profiles (3/9)). -Investigate a LiveTV freeze problem. Only occasional on our worst 2 channels for reception. Due to errors in the transport stream due to interference. If watching prerecorded the freeze does not occur (only screen jumps etc). Work around is to exit live tv and re enter.

Well worth the effort to configure!

Resources

 - Centos 5.1 installation
 - linux-2.6.23 kernel source
 - Attansic_L.rar lan driver from asus.
 - ati-driver-installer-8.443.1-x86.x86_64.run
 - linuxtv-dvb-apps-1.1.1
 - xc-test-d4f7804a393c Chris Pascoe v4l source

Would have been nice to put all this in a tar:

config2.6.23 - Kernel config file
MythTV channel config files and scripts
MythTV operation scripts

Installing CentOS 5.1 on Asus p5k

Customised disk layout.

 Filesystem                1K-blocks Available Use% Mounted on
 /dev/mapper/vg00-LogVol00   1967952   1135592  40% /
 /dev/mapper/vg00-LogVol06  99190192  91472936   3% /u01 -media storage
 /dev/mapper/vg00-LogVol02    983960    915452   2% /tmp
 /dev/mapper/vg00-LogVol03   9903432   4664116  51% /usr
 /dev/mapper/vg00-LogVol04   1967952   1718760   8% /var
 /dev/mapper/vg00-LogVol05   9903432   9238588   2% /opt  -optional software
 /dev/mapper/vg00-LogVol01    983960    910608   3% /home
 /dev/sda1                    194442    165788  11% /boot
 tmpfs                       1029924   1029924   0% /dev/shm
 /dev/mapper/vg01-LogVol00 300687608  17459444  94% /mnt/old -old mythtv install
 /dev/sdb1                    101086     72220  25% /mnt/old/boot

Install everything short of xen, clustering etc.

When installing a second redhat installation remember to rename the volume group so it does not clash with the original installation so you can mount both volume groups at the same time. Also check the partitions mounted by the label name are the right ones eg boot sda1 my be mounted instead of sdb1 because both labels=boot. Just remove the label in fstab and use the device instead of the label.

Build eth driver(onboard P5K lan adapter) and configure eth0.

unrar x Attansic_L.rar cd src as root

 make install

rebuild module dependancies to include new atl1.ko library

 depmod -A

test the module load into the kernel

 insmod atl1.ko

configure modprobe with the module for auto install at startup

 alias eth0 atl1

setup ifcfg-eth0 in /etc/sysconfig/network-scripts

 DEVICE=eth0
 IPADDR=192.168.1.4
 NETMASK=255.255.255.0
 NETWORK=192.168.1.0
 GATEWAY=192.168.1.254
 BROADCAST=255.255.255.255
 ONBOOT=yes

setup /etc/resolv.conf

 nameserver 192.168.1.254
 search daisy

setup /etc/hosts:

 192.168.1.4     daisy daisy.localdomain

bring up eth0 interface:

 ifup eth0

Kernel Compile

Compile 2.6.23 kernel Needed for compatiblility with the new dvico dvb driver.

 1. copy config2.6.23 to .config in new unziped kernel directory
 2. make oldconfig
 3. make
 4. sudo make modules_install install

DViCO Driver Installation

Installation of drivers for Dvico HDTV tuner and test.

 sudo cp xc3028-dvico-au-01.fw /lib/firmware

Untar the experimental driver source from Chris Pascoe.

 tar -xvf xc-test-d4f7804a393c.tar
 cd xc-test-....
 make

Either run

 make install

or manually copy only the required modules into place:

 sudo mkdir                   /lib/modules/2.6.23/kernel/drivers/media/video
 sudo mkdir                   /lib/modules/2.6.23/kernel/drivers/media/video/cx23885
 sudo cp  v4l/cx23885.ko      /lib/modules/2.6.23/kernel/drivers/media/video/cx23885/cx23885.ko
 sudo cp  v4l/tuner-xc2028.ko /lib/modules/2.6.23/kernel/drivers/media/video/tuner-xc2028.ko
 sudo mkdir                   /lib/modules/2.6.23/kernel/drivers/media/dvb
 sudo mkdir                   /lib/modules/2.6.23/kernel/drivers/media/dvb/dvb-core
 sudo cp  v4l/dvb-core.ko     /lib/modules/2.6.23/kernel/drivers/media/dvb/dvb-core
 sudo mkdir                   /lib/modules/2.6.23/kernel/drivers/media/dvb/frontends
 sudo cp  v4l/zl10353.ko      /lib/modules/2.6.23/kernel/drivers/media/dvb/frontends/zl10353.ko
 sudo cp  v4l/videobuf-dvb.ko     /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/videobuf-core.ko    /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/videobuf-dma-sg.ko  /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/videobuf-vmalloc.ko /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/videocodec.ko       /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/videodev.ko         /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/v4l2-common.ko      /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/v4l1-compat.ko      /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/btcx-risc.ko        /lib/modules/2.6.23/kernel/drivers/media/video
 sudo cp  v4l/tveeprom.ko         /lib/modules/2.6.23/kernel/drivers/media/video
 sudo mkdir                       /lib/modules/2.6.23/kernel/drivers/media/common
 sudo cp  v4l/ir-common.ko        /lib/modules/2.6.23/kernel/drivers/media/common
 sudo cp  v4l/ir-kbd-i2c.ko       /lib/modules/2.6.23/kernel/drivers/media/common
 sudo mv /lib/modules/2.6.23/kernel/drivers/media/video/video-buf-dvb.ko /tmp
 sudo mv /lib/modules/2.6.23/kernel/drivers/media/video/video-buf.ko /tmp

rejig the kernel dependancies:

 sudo depmod  -a

Look in /lib/modules/<kernelver>/kernel/modules.dep for the dependancies of a module, or run:

 sudo modprobe --show-depends <modulename>

insert the new modules into the kernel:

 sudo modprobe -a cx23885 tuner-xc2028 zl10353

lsmod should show the modules loaded. The new devices are: tree /dev/dvb /dev/dvb

 |-- adapter0
 |   |-- demux0
 |   |-- dvr0
 |   |-- frontend0
 |   `-- net0
 `-- adapter1
     |-- demux0
     |-- dvr0
     |-- frontend0
     `-- net0

To test the operation of the devices load install linuxtv-dvb-apps-1.1.1

 cd /u01/install/linuxtv-dvb-apps-1.1.1/util/scan/
 ./scan ./dvb-t/au-goldcoast

The output is used to build a channels.conf eg for channel SC10HD

 SC10HD:634625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:2511:2512:2095:12812

To tune into the channel run

 ./tzap -r -c channels.conf SC10HD
 using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
 tuning to 634625000 Hz
 video pid 0x09cf, audio pid 0x09d0
 status 00 | signal 2888 | snr 0000 | ber 00000000 | unc 00000000 |
 status 1e | signal b314 | snr cdcd | ber 00000000 | unc 00000000 | FE_HAS_LOCK
 status 1e | signal b310 | snr cccc | ber 00000000 | unc 00000000 | FE_HAS_LOCK
 status 1e | signal b364 | snr cccc | ber 00000000 | unc 00000000 | FE_HAS_LOCK

Channel SC10HD is now locked and the mpeg transport stream is available on /dev/dvb/adapter0/dvr0 and can be played with mplayer. channels.conf may require tweaking so the correct the correct pid is demultiplexed from the transport stream.

 mplayer /dev/dvb/adapter0/dvr0

YUM Configuration

For installation of mplayer and mythtv.

Configure yum - rpm package installer

Check yum installer has disabled the removal of rpms in /var/cache/yum after the install. (you may need in future)

 sudo vi /etc/yum.conf

set:

 keepcache=1

These directions are from the centos website:

Configure yum with priorities so core CentOS libraries are not overwritten:

 yum install yum-priorities

Make sure that yum-priorities is enabled by editing the /etc/yum/pluginconf.d/priorities.conf file, and ensuring that it contains the following lines:

 [main]
 enabled=1

Edit the .repo files in /etc/yum.repos.d/ and set up priorities by adding the line:

 priority=N

to a repository entry, where N is an integer number from 1 to 99.

The recommended settings are:

 [base], [addons], [updates], [extras] ... priority=1
 [centosplus],[contrib] ... priority=2

Third Party Repos such as rpmforge ... priority=N (where N is > 10 and based on your preference)

Download:

 http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Install DAG's GPG key:

 rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

Verify the package you have downloaded

 rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm

Security warning: The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the package and trust Dag then it should be safe.

Install the package

rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm

This will add a yum repository config file and import the appropriate GPG keys. At this point, you can set the priority of the RPMForge repository, and also of the CentOS repositories if you have not done so yet.

Set the priority=10 for [rpmforge] in /etc/yum.repos.d/rpmforge.repo

Test with this command:

 yum check-update

It should output these two lines:

 Loading "priorities" plugin ...
 76 packages excluded due to repository priority protections

The number above may differ, but there should be several packages shown as being excluded.

If so then it looks like things are working so try installing something like this

 yum install mplayer

MythTv Installation

Install mplayer and test.

 yum install mplayer

Add to /etc/yum.conf - Axel Thimms is the only mythtv packager.

 [atrpms]
 enabled=1
 priority=10
 name=CentOS el$releasever - $basearch - ATrpms
 baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/stable
      http://www.mirrorservice.org/sites/download.atrpms.net/el$releasever-$basearch/atrpms/stable
      http://wftp.tu-chemnitz.de/pub/linux/ATrpms/el$releasever-$basearch/atrpms/stable
      http://mirrors.ircam.fr/pub/atrpms/el$releasever-$basearch/atrpms/stable
 gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
 gpgcheck=1

You can also include the test repo as suggested by:

 http://www.mythtv.org/wiki/index.php/RHEL_Installation

This will avoid the missing dependancies in the next step.

 yum install mythtv

Could not resolve these:

 libFLAC8-1.2.1-1_14.el5.x86_64.rpm
 PIL-1.1.6-8.0.el5.x86_64.rpm
 perl-XML-Twig-3.29-11.el5.noarch.rpm

So manually installed with these dependancies:

 tk-8.4.13-5.el5_1.1.x86_64.rpm
 atrpms-71-1.noarch.rpm
 perl-XML-Parser-2.36-1.el5.rf.x86_64.rpm
 atrpms-71-1.noarch.rpm

Got this error. No problems with mythtv.

 yum install mythtv error:
 Installing: perl-XML-LibXML              ##################### [ 59/105]
 could not find ParserDetails.ini in /usr/lib/perl5/vendor_perl/5.8.8/XML/SAX
 Installing: perl-MailTools               ##################### [ 60/105]


MythTv Configuration

Configuration is for one machine (mythfrontend and mythbackend both run on the same machine.)

configure mysql:

 $ su
 # chkconfig --level 35 mysql on
 # /etc/rc.d/init.d/mysql start
 # exit

set the root password for mysql

 mysqladmin -u root password 'xxxxx'

create the mythtv database by running the mc script

 mysql -u root -p
 mysql> source /usr/share/doc/mythtv-docs-0.21/database/mc.sql

run

 mythtv-setup

If resoulution is a problem try mythtv -geometry 800x600. (my screen is configured for 1680x1050 and need to set the geometry to 1680x1049. Is this a bug in mythtv?)

 1.General
 Host Address Backend Setup -> Leave defaults -> Next
 Locale Settings -> TV Format -> PAL
 VBI format: PAL Teletext
   Channel Frequency Table -> australia
 Miscellaneous Settings -> Leave defaults -> Next
 EIT Scanner Options -> Leave defaults -> Next
 Shutdown/Wakeup Options
   Startup command : blank
   Block shutdown before client connected: off
   iidle timeout(sec): 35
   Max wait 5min
   Start up before rec: 120sec
   Wakeup time format: time_t
   Set wakeuptime command: /u01/vault/mythtv/mythSetTime.sh $time
   Server halt command: /u01/vault/mythtv/mythDoShut.sh
   Pre shutdown check-command: /u01/vault/mythtv/mythCheck.sh
 Backend Wakeup settings -> Leave defaults -> Next
 Job Queue(Backend Specific) -> Leave defaults -> Next
 Job Queue(Global) -> Leave defaults -> Next
 Job Queue(Job Commands) -> Leave defaults -> Finish
 2. Capture Cards
 New capture card ->
 Card type: DVB DTV capture card (v3.x)
 Finish.
 Repeat for the second tuner. The result is [DVB:0] and [DVB:1]
 3. Video Sources
 New video source ->
 Video source name: Antenna
 Listings grabber: Transmitted guide only (EIT)
 Channel frequency table: australia
 4. Input Connections
 [DVB:0] -> Display Name: Tuner1
 Video Source: Antenna
 [DVB:1] -> Display Name: Tuner2
 Video Source: Antenna
 5. Storage Directories
 Default /u01/video/

The mythtv channel scanner did not do a good job on some channels so I manually configured all my channels in channels.conf, tested with tzap and mplayer until correct. I then created channel2myth0.21 to convert channel.conf to a sql update script for upload into the mythconverg mysql database.

Create a sql insert script for mythtv channels:

 ./channel2myth0.21.sh > channel.sql

Run mysql, backup the original channel data, and do the update.

 mysql -u root -p
 use mythconverg
 select * from channel into outfile '/tmp/channel.data';
 select * from dtv_multiplex into outfile '/tmp/dtv_multiplex.data';
 delete from channels;
 delete from dtv_multiplex;
 source ./channel.sql
 commit;

The only data missing is dtv_multiplex.networkid for operation of EIT and can be found by running dvbsnoop. Entering a networkid for ABCHDTV seems to break the tuner locking mechanism for this channel. If this happens follow the note below for channel tuning failure.

May need to update the default startup channel under because we just clobbered the original channels:

 mythtv-setup -> Input Connections DVB0 and DVB1 -> Starting Channel.

Run mythfrontend. I set the option: -geometry 1680x1049

 Utilities/Setup -> Setup -> Appearance -> Screen settings
 Gui width (px): 1680
 Gui height(px); 1049

Utilities/Setup -> Setup -> TV Settings -> Playback -> Playback Profiles (3/9))

 Create a new profile:
 Match Criteria: > W: 1 H: 1
 Match Criteria: > W: 1 H: 1
 Decoder: Standard MaxCPUs: 4
 VideoRenderer: xv-blit OSDRenderer: chromakey OSDFade off
 (This probably needs adjusting to fix a problem when changing from a HD
 channel to an SD channel and vis-versa.)

Channel Tuning Failure

If something goes wrong with channel tuning -> Delete all cards,video sources, etc in mythtv-setup and start again. (There is a bug with deleting selections - need to delete all.)

Automatic Program Recording Machine Power Up/Down

Setup start scripts for mysqld and mythbackend: The scripts should be installed in /etc/rc.d/init.d on installation.

 chkconfig --list mysqld
 chkconfig --list mythbackend

If not set to start, set startup for runlevel 5

 sudo chkconfig --level 5 mythbackend on
 sudo chkconfig --level 5 mysqld on

Copy mythCheck.sh, mythSetTime.sh, mythDoShut.sh matching the configuration of mythtv-setup for these scripts.

 cp mythCheck.sh mythSetTime.sh mythDoShut.sh /u01/vault/mythtv

Rename /usr/bin/mythfrontend

 sudo mv /usr/bin/mythfrontend /usr/bin/mythfrontend.bin

Copy the mythfrontend bash script into place.

 sudo cp mythfrontend /usr/bin/mythfrontend.

Setup sudoers for mythbackend see notes in /usr/bin/mythfrontend script.

Setup mythfrontend with icon under kde with the command:

 kstart --ontop mythfrontend

(doesn't seem run fullscreen under gnome, unless you set it manually from the task bar.)

Operation:

 1) At machine startup mythbackend starts and will terminate if it is not
 required eg.no program recording.
 2) If no program is recording the script mythCheck.sh is called to check for
 active mythfrontend sessions.
 3) When mythbackend terminates (no frontend running, no recording):
 a) first mythSetTime.sh is called and sets:
 - the realtime clock interrupt to start the machine at the time of the next recording from a powered off state.
 - an 'at' job to startup mythbackend for when the machine is on and mythbackend has terminated.
 b) second mythDoShut.sh is called to shutdown the machine. The backend will
 not shutdown if a process called 'gnome-session' is found or the machine has
 been up for less than 5min.

IRC Config

(from http://www.users.on.net/~jani/dvico-mythtv-8.html)

To test that everything is working, plug in the USB receiver and do a 'dmesg |grep hiddev' to make sure it's been picked up fine. Run lircd and check that the remote is being picked up:

 # /usr/local/sbin/lircd --device=/dev/hiddev0
 # irw

Point your remote at the receiver, press some buttons and you should see some action on the screen. Once you're happy your remote works, press CTRL-C to exit irw. Add the following lines to /etc/rc.d/rc.local to have lircd start up automaticall every boot.

 echo "Starting lircd"
 /usr/local/sbin/lircd --driver=dvico --device=/dev/hiddev0

Grab this lircrc.example file and save it as /home/mythtv/.lircrc

 $ wget http://www.users.on.net/~jani/lircrc.example.DVICO-irxevent
 $ mv lircrc.example.DVICO-irxevent ~/.lircrc

And to get irxevent to automatically start when user 'mythtv' logs in, run the following command as mythtv.

 $ ln -s /usr/local/bin/irxevent ~/.kde/Autostart/irxevent