View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 3 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Tue Jun 15, 2004 6:43 am 
Offline
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location: Adelaide, Australia
Quote:
# This is the script that I run once I have done a fresh install of
# KnoppMyth R4V3 to get everything working on my system. If you read some of
# the comments you will see that I did not have an easy time getting all
# things going, but since this script does almost everything that is required
# to take the Auto Install to a working system I hope that it is helpful to
# someone else trying to get the same or a similar thing going.
#
# My system consists of:
# TV Excel PV-BT878P+ w/FM (aka Pixelview Pro or something.)
# MSI K7T266 Pro2 Mobo
# Athlon 1700+ XP processon
# 120Gbyte 8M cache Western Digital HDD
# GeForce2 Mx 400 Graphics Card
#
# I have this script on a USB key drive which I mount from the root account
# using the command:
#
# mount /dev/sda1 /mnt
#
# I then change directory to the directory containing this script and run it
# from the root account.
#
# cd /mnt/GregsStuff
# ./myth_post_install.bash
#
# The following is a list of files that are used by the script that I have
# on the pen drive:
#
# nvtv-0.4.7.tar.gz
# (nvtv didnt seem to be on KnoppMyth which I found a bit mystifying?)
# joe_2.9.8-1_i386.deb
# (an editor that I now like to use)
# tv-icons-au.tar.gz
# (Icons for the tv stations in my area)
# .xawtv
# (Channel info for tv stations in my area for xawtv)
# .lircrc
# (Remote control key mappings for my remote)

# Start by copying the contents of the directory to /tmp.

echo -e "\a"
echo "====================="
echo "Copying stuff to /tmp"
echo "====================="
sleep 1

cp -fv * /tmp
cp -fv .* /tmp

# Also copy .xawtv which defines the channels in my local area for use with
# xawtv. This was the easiest way I could find to check that the tv card
# driver was working properly.

cp -fv /tmp/.xawtv /home/mythtv

# My first problem when I tried to play with things to get them working was
# that I am used to using a modeless editor like emacs. The only editor I
# could find was vi which I am not familiar with and hence not comfortable
# with. I saw a discussion on Slashdot about the joe editor. Most people that
# liked it said it was because they could use it without being familiar with
# it (the instructions for getting help are displayed on the top line yadda
# yadda), so I downloaded it and have used it happily since.

echo -e "\a"
echo "================================="
echo "Installing joe (Joe's own editor)"
echo "================================="
dpkg -i /tmp/joe_2.9.8-1_i386.deb

# My next problem was that the box I am using does not have internet
# connectivity and I live in Australia anyway, so the tv_grab_* scripts are
# not much use. I was a little dismayed to find that unless the channels
# database is correctly setup mythtv doesent work at all. Once I came to grips
# with what the mythtv-setup program was trying to do, and after finding some
# references on the web about manually entering channels into the database I
# set about making a script that would insert the required entries into the
# database for me. This would allow me to re-install my box with as little
# pain as possible (rather than having to mandrolically enter the channel
# data). For the record, I still rip thright the "1. General" section of the
# mythtv-setup manually as this seems to put a fair amount of stuff in the
# database that I didnt want to script (because if the database format changed
# in future versions this would presumably break my script).

echo -e "\a"
echo "============================================"
echo "Entering Channel info in the MythTV database"
echo "============================================"

if ! mysqldump mythconverg | grep "capturecard VALUES" ; then
echo Inserting capture card
echo "INSERT INTO capturecard VALUES (1,'/dev/video','/dev/dsp','/dev/vbi','V4L','Television',0,'mythtv',0,0,0,1,8192,8192);" | mysql mythconverg
fi

if ! mysqldump mythconverg | grep "videosource VALUES" ; then
echo Inserting video source
echo "INSERT INTO videosource VALUES (1,'Television','tv_grab_au','','australia');" | mysql mythconverg
fi

if ! mysqldump mythconverg | grep "cardinput VALUES" ; then
echo Inserting card input
echo "INSERT INTO cardinput VALUES (1,1,1,'Television','',NULL,'N','','10');" | mysql mythconverg
fi

if ! mysqldump mythconverg | grep "channel VALUES" ; then
echo "INSERT INTO channel VALUES (2002,'2','46',1,'ABC 2','ABC 2','/usr/share/icons/2.gif',NULL,NULL,'abc.com.au',0,32768,32768,32768,32768,'Default');" | mysql mythconverg
echo "INSERT INTO channel VALUES (2007,'7','49',1,'SAS 7','SAS 7','/usr/share/icons/7.gif',NULL,NULL,'seven.com.au',0,32768,32768,32768,32768,'Default');" | mysql mythconverg
echo "INSERT INTO channel VALUES (2009,'9','52',1,'NWS 9','NWS 9','/usr/share/icons/9.gif',NULL,NULL,'nine.com.au',0,32768,32768,32768,32768,'Default');" | mysql mythconverg
echo "INSERT INTO channel VALUES (2010,'10','55',1,'ADS 10','ADS 10','/usr/share/icons/10.gif',NULL,NULL,'ten.com.au',0,32768,32768,32768,32768,'Default');" | mysql mythconverg
echo "INSERT INTO channel VALUES (2028,'28','43',1,'SBS 28','SBS 28','/usr/share/icons/28.gif',NULL,NULL,'sbs.com.au',0,32768,32768,32768,32768,'Default');" | mysql mythconverg
fi

if ! mysqldump mythconverg | grep "codecparams VALUES" ; then
echo setting vertical resolution of recording profiles to 576/288
echo "INSERT INTO codecparams VALUES (1,'height','576');" | mysql mythconverg
echo "INSERT INTO codecparams VALUES (2,'height','576');" | mysql mythconverg
echo "INSERT INTO codecparams VALUES (3,'height','576');" | mysql mythconverg
echo "INSERT INTO codecparams VALUES (4,'height','288');" | mysql mythconverg
fi

# I have inserted references to channel icons in the database. These are
# little images that are displayed with the channel number when you change
# channels in mythtv. I found these images conveniently packaged by someone
# for download on the web.

echo -e "\a"
echo "========================"
echo "Installing channel icons"
echo "========================"
sleep 1

cd /usr/share/icons
cat /tmp/tv-icons-au.tar.gz | tar xzv

# If you want to look in the /var/log/messages file as user mythtv, the
# permissions need to be changed.

echo -e "\a"
echo "==========================="
echo "Setting permission on files"
echo "==========================="
sleep 1

chmod -v 644 /var/log/messages

# Once I had gotten this far, I found that all I got from the tv card was
# fuzz and it didnt seem to want to change channels.
# Relevant messages from dmesg were as follows:
#
# bttv0: using: *** UNKNOWN/GENERIC *** [card=0,autodetected]
# bttv0: using tuner=-1
# tuner: tuner type not set
# tuner: tuner type not set
# tuner: tuner type not set
#
# After a lot of searching of the web, I found someone saying that for my tv
# card some options needed to be specified in the /etc/modules.conf file. I
# dont know why the card can't be autodetected. Should I submit details to
# someone so that future versions of Bttv or the KnoppMyth installer handle
# this automatically???

echo -e "\a"
echo "===================================="
echo "Setting up BTTV/Tuner Module Options"
echo "===================================="
sleep 1

if ! grep -q "options bttv card=72 radio=1 pll=1" /etc/modules.conf ; then
echo Inserting card and tuner options into /etc/modules.conf
cp -f /etc/modules.conf /etc/modules.conf.pre_card_options
cat /etc/modules.conf.pre_card_options | awk '{print $0}/alias[ \n\t]char-major-81[ \n\t]bttv/{print "options bttv card=72 radio=1 pll=1\noptions tuner type=5"}' > /etc/modules.conf
else
echo Card and tuner options already in /etc/modules.conf
fi

# After a reboot, I could now use xawtv to change channels and display a
# decent tv picture. MythTV could also watch tv and change channels. The next
# problem was that the remote didn't work. The relevant lines from
# /var/log/lircd aftre running irw which exited immediately were as follows:
#
# May 16 16:07:15 mythtv lircd 0.7.0pre4: lircd(hauppauge) ready
# May 16 16:08:42 mythtv lircd 0.7.0pre4: accepted new client on /dev/lircd
# May 16 16:08:42 mythtv lircd 0.7.0pre4: could not open /dev/lirc
# May 16 16:08:42 mythtv lircd 0.7.0pre4: default_init(): No such device
# May 16 16:08:42 mythtv lircd 0.7.0pre4: caught signal
#
# At this point, lircd had crashed. I read somewhere (on the LIRC
# site I think that for remotes that are integrated with TV tuner cards, you
# need to use the lirc_gpio module. The following section makes the required
# changes to /etc/modules.conf to change the lirc device from lirc_i2c to
# lirc_gpio. This was only the start of getting the remote to work, because as
# I later found that LIRC needed to be rebuilt after specifying the device
# type as a pixelview_pro.

echo -e "\a"
echo "==================================="
echo "Setting up IR Remote Module Options"
echo "==================================="
sleep 1

if ! grep -q "lirc_gpio" /etc/modules.conf ; then
echo Inserting card and tuner options into /etc/modules.conf
cp -f /etc/modules.conf /etc/modules.conf.pre_ir_remote_option
cat /etc/modules.conf.pre_ir_remote_option | sed 's/lirc_i2c/lirc_gpio/g' > /etc/modules.conf
else
echo IR Remote option already in /etc/modules.conf
fi

# Rebuilding LIRC was not as easy as one might expect. I tried extracting
# the LIRC sources from /usr/src/lirc-0.7.0pre4.tar.bz2 which came with the
# KnoppMyth distribution but it would not build properly. In desparation, I
# tried rebuilding the Kernel first and that seemed to help. The steps to
# follow to rebuild the kernel and LIRC are shown below.

echo -e "\a"
echo "============================="
echo "Extracting the Kernel Sources"
echo "============================="

if [ -d /usr/src/linux-2.4.25-chw ] ; then
echo Kernel sources already extracted. Kernel must have been built.
else
sleep 1

cd /usr/src
cat /usr/src/linux-2.4.25-chw.tar.bz2 | tar xjv

echo -e "\a"
echo "======================================="
echo "Setting up the Kernel Sources and links"
echo "======================================="
sleep 1

if [ -d /usr/include/asm ] ; then
rm -Rvf /usr/include/asm
fi

if [ -d /usr/include/linux ] ; then
rm -Rvf /usr/include/linux
fi
rm /usr/src/linux
ln -svf linux-2.4.25-chw /usr/src/linux
ln -svf /usr/src/linux/include/asm-i386 /usr/include/asm
ln -svf /usr/src/linux/include/linux /usr/include/linux
cd /usr/src/linux
make mrproper

echo -e "\a"
echo "============================="
echo "Configuring the Kernel Build"
echo "============================="
sleep 1

cp /usr/src/kernel-headers-2.4.25-chw/.config /usr/src/linux
cd /usr/src/linux
make oldconfig

echo -e "\a"
echo "================"
echo "Doing 'make dep'"
echo "================"
sleep 1
cd /usr/src/linux
make dep

echo -e "\a"
echo "===================="
echo "Doing 'make bzImage'"
echo "===================="
sleep 1
cd /usr/src/linux
make bzImage

echo -e "\a"
echo "===================="
echo "Doing 'make modules'"
echo "===================="
sleep 1
cd /usr/src/linux
make modules

echo -e "\a"
echo "============================"
echo "Doing 'make modules_install'"
echo "============================"
sleep 1
cd /usr/src/linux
make modules_install

echo -e "\a"
echo "================="
echo "Installing Kernel"
echo "================="
sleep 1
cp -fv /boot/vmlinuz-2.4.25-chw /boot/vmlinuz-2.4.25-chw.old
cp -fv /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.25-chw
cp -fv /etc/lilo.conf /etc/lilo.conf~
sed 's@vmlinuz.old@boot/vmlinuz-2.4.25-chw.old@g' /etc/lilo.conf~ > /etc/lilo.conf
/sbin/lilo
fi

echo -e "\a"
echo "==========================="
echo "Extracting the LIRC Sources"
echo "==========================="

if [ -d /usr/src/lirc-0.7.0pre4 ] ; then
echo LIRC sources already extracted. LIRC must have been built already.
else
sleep 1
cd /usr/src
cat lirc-0.7.0pre4.tar.bz2 | tar xjv
fi

echo -e "\a"
echo "=============================================================="
echo "Copying the config file for the remote that comes with my card"
echo "=============================================================="
sleep 1

cp -fv /usr/src/lirc-0.7.0pre4/remotes/pixelview/lircd.conf.playtv_pro /etc/lircd.conf

# I havent had time to work out how to configure the LIRC build from this
# script. The call to /usr/src/lirc-0.7.0pre4/configure will run an
# interactive program from which I have to select the tv card and then
# request it to exit and run configure.

echo -e "\a"
echo "============================================="
echo "Configuring LIRC for the Pixelview Pro Remote"
echo "============================================="

if [ ! -f /usr/src/lirc-0.7.0pre4/.setup.config ] ; then
echo Configuring for LIRC compile.
cd /usr/src/lirc-0.7.0pre4
/usr/src/lirc-0.7.0pre4/configure
fi

echo -e "\a"
echo "==========================="
echo "Building LIRC for my remote"
echo "==========================="
sleep 1

cd /usr/src/lirc-0.7.0pre4

if [ ! -f ./drivers/lirc_dev/lirc_dev.o ] ; then
echo Compiling LIRC.
make
make install
fi

# Phew... After all of that, I can run irw and see the remote codes being
# displayed as I press buttons on my remote. mythtv however still seems to be
# blissfully unaware that I am trying to change channels or do anything else.
# A quick look at the howto indicates that if lirc isn't compiled in to myth
# you need to run irxevents in the background to pass the IR codes to
# mythtv. To get irxevents to run in the background, I modified the
# /home/mythtv/.fvwm/.fvwm2rc (where there was already a commented line to
# run irxevents - I just uncommented it.)

echo -e "\a"
echo "======================================"
echo "Getting irxevents to run automatically"
echo "======================================"
sleep 1

if grep -q "#exec irxevents &" /home/mythtv/.fvwm/.fvwm2rc ; then
echo uncommenting irxevents line
cp -f /home/mythtv/.fvwm/.fvwm2rc /home/mythtv/.fvwm/.fvwm2rc.no_irxevents
cat /home/mythtv/.fvwm/.fvwm2rc.no_irxevents | sed 's/#exec irxevents &/exec irxevent \&/g' > /home/mythtv/.fvwm/.fvwm2rc
else
echo No commented irxevents line fiound
fi

# The irxevents program uses /home/mythtv/.lircrc to define the remote
# control keymappings. I have created a file to work with my remote.

echo -e "\a"
echo "==========================================="
echo "Copying .lircrc remote control confiog file"
echo "==========================================="
sleep 1

cp -fv /tmp/.lircrc /home/mythtv/.lircrc

# The next problem is that my tv out isnt enabled. After some web searches,
# It seems that I need to use something called nvtv to control the tv out of
# my GeForce2 Mx 400. I couldn't find reference to it on my KnoppMyth
# distribution, so I downloaded it and built it as follows

echo -e "\a"
echo "============="
echo "Building nvtv"
echo "============="
sleep 1

if [ ! -d /usr/src/nvtv-0.4.7 ] ; then
cd /usr/src
tar xzvf /tmp/nvtv-0.4.7.tar.gz
cd /usr/src/nvtv-0.4.7
./configure
make
make install
fi

# You need superuser privileges to run nvtv but it can also be run by an
# unprivileged user if the nvtvd daemon is running. The following commands
# configure the system so that nvtvd is activated at boot time.

echo -e "\a"
echo "==============================="
echo "Get nvtvd to start at boot time"
echo "==============================="
sleep 1

if [ ! -x /etc/init.d/nvtvd ] ; then
echo Creating nvtv daemon startup script in /etc/init.d
echo "#!/bin/bash" > /etc/init.d/nvtvd
echo /usr/local/bin/nvtvd >> /etc/init.d/nvtvd
chmod 755 /etc/init.d/nvtvd
fi

if [ ! -h /etc/rc5.d/S99nvtvd ] ; then
ln -svf ../init.d/nvtvd /etc/rc5.d/S99nvtvd
fi

# Now ntvtd runs at boot time, we want the nvtv command that enables the
# tv output to be run when the machine boot too. The best place I could find
# for this was in the /home/mythtv/.fvwm/.fvwm2rc file just before it executes
# the KnoppMyth-run command. You can play with the parameters to nvtv to get
# the image to fit on your TV screen better.

echo -e "\a"
echo "=========================================================="
echo "Use nvtv at x startup to enable tv out on GeForce 2 MX 400"
echo "=========================================================="
sleep 1

if ! grep /usr/local/bin/nvtv /home/mythtv/.fvwm/.fvwm2rc ; then
cp -fv /home/mythtv/.fvwm/.fvwm2rc /home/mythtv/.fvwm/.fvwm2rc~
cat /home/mythtv/.fvwm/.fvwm2rc~ | awk '/exec KnoppMyth-run/{print "exec /usr/local/bin/nvtv -S PAL -r 800,600 -s Large -t"}{print $0}' > /home/mythtv/.fvwm/.fvwm2rc
fi

# Well, I thought I had things pretty well setup now, but I found that
# whenever I went to watch live TV, there was no sound until I changed
# channels for the first time. This would not be too much of a problem but I
# found that any scheduled recording also has no sound. This is a big
# problem. I searched the myth forums for ages until I finally in desparation
# started playing with the bttv card= settings in /etc/modules.conf. I
# couldn't work out how to properly remove and re-load the driver so I was
# rebooting each time I changed modules.conf. I tried the cards in
# /usr/src/linux/Documentation/video4linux/bttv/CARDLIST that has PV-BT or
# /Pixelview in the name. This included cards 16, 37, 50, 70 and 72. 72 was
# /the one that I found recommended somewhere and that I have been using
# /with some success to date. When I tried 16, the channel would not change
# /at all. When I tries 37, the channel would not change but I got audio
# when entering live TV. When I tried 70, everything seemed to work! I had
# /sound immediately on entering Live TV and my recordings also has sound. I
# /have left this section here rather than setting the correct card above in
# /the hope that it might be a helpful for someone to see a problem that can
# occur with the wrong card= parameter.

echo -e "\a"
echo "==================================================="
echo "Chosing a better match for the bttv card= parameter"
echo "==================================================="
sleep 1

if grep "options bttv card=72 radio=1 pll=1" /etc/modules.conf ; then
echo Changing card=72 to card=70
cp -f /etc/modules.conf /etc/modules.conf.wrong_card_option
cat /etc/modules.conf.wrong_card_option | sed 's/bttv card=72/bttv card=70/g' > /etc/modules.conf
else
echo Correct card=option already in /etc/modules.conf
fi


Top
 Profile  
 
PostPosted: Tue Nov 04, 2008 8:25 am 
Offline
Joined: Tue Jan 08, 2008 11:38 am
Posts: 14
Location: Weymouth, MA
Hi Greg,

I'm still not able to get the NVTV command that fixes my display to run at startup. It is in the .fluxbox/apps script, but it still doesn't seem to run.

I ran the following segment of your script...
Quote:
echo -e "\a"
echo "==============================="
echo "Get nvtvd to start at boot time"
echo "==============================="
sleep 1

if [ ! -x /etc/init.d/nvtvd ] ; then
echo Creating nvtv daemon startup script in /etc/init.d
echo "#!/bin/bash" > /etc/init.d/nvtvd
echo /usr/local/bin/nvtvd >> /etc/init.d/nvtvd
chmod 755 /etc/init.d/nvtvd
fi

if [ ! -h /etc/rc5.d/S99nvtvd ] ; then
ln -svf ../init.d/nvtvd /etc/rc5.d/S99nvtvd
fi

# Now ntvtd runs at boot time, we want the nvtv command that enables the
# tv output to be run when the machine boot too. The best place I could find
# for this was in the /home/mythtv/.fvwm/.fvwm2rc file just before it executes
# the KnoppMyth-run command. You can play with the parameters to nvtv to get
# the image to fit on your TV screen better.

echo -e "\a"
echo "=========================================================="
echo "Use nvtv at x startup to enable tv out on GeForce 2 MX 400"
echo "=========================================================="
sleep 1

if ! grep /usr/local/bin/nvtv /home/mythtv/.fvwm/.fvwm2rc ; then
cp -fv /home/mythtv/.fvwm/.fvwm2rc /home/mythtv/.fvwm/.fvwm2rc~
cat /home/mythtv/.fvwm/.fvwm2rc~ | awk '/exec KnoppMyth-run/{print "exec /usr/local/bin/nvtv -S PAL -r 800,600 -s Large -t"}{print $0}' > /home/mythtv/.fvwm/.fvwm2rc
fi


The second part regarding .fvwm just returns an error because I don't have that component installed.

I thought that by having the line
Quote:
[startup] {/usr/bin/nvtv -S NTSC -t -r 800,600 -s Huge}


in the...
/home/mythtv/.fluxbox/apps
would work, if I had the nvtvd running, but it doesn't seem to be.

I am an inexperienced linux user, so I was wondering if you could provide me with some additional explicit instructions about how I might be able to get the display to show up properly on boot.

Thank You.


Top
 Profile  
 
PostPosted: Tue Nov 04, 2008 4:39 pm 
Offline
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location: Adelaide, Australia
Does running as the mythtv user:
Code:
/usr/bin/nvtv -S NTSC -t -r 800,600 -s Huge

from an xterm work?
Did nvtvd actually start and is it running?


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: Baidu [Spider] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu