Getting my Hauppauge IR Blaster (aka remote) that came with my Hauppauge WinTV PVR 150 to work has been the bane of my existance since my last MythTV post. When I first started, I saw that Jarod Wilson explained how to set up LIRC using YUM here and suggested using the following:
yum -y install lirc-kmdl-$KVER
yum -y install lirc
yum -y install lirc
I ran that and it seemed to install properly. I then ran the following:
cp /usr/share/doc/lirc-*/remotes/hauppauge/lircd.conf.hauppauge /etc/lircd.conf
and that too worked. Then as per the instructions I added code to my /etc/modprobe.conf so that lirc would load before ivtv. Now my /etc/modprobe.conf looks like the following:
alias eth0 tulip
alias snd-card-0 snd-emu10k1
options snd-card-0 index=0
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-emu10k1 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-emu10k1
alias usb-controller ohci-hcd
# LIRC stuff
alias char-major-61 lirc_i2c
# ivtv modules setup
alias char-major-81 ivtv
alias char-major-81-0 ivtv
# LIRC stuff
install lirc_i2c /sbin/modprobe ivtv; /sbin/modprobe --ignore-install lirc_i2c
alias snd-card-0 snd-emu10k1
options snd-card-0 index=0
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-emu10k1 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-emu10k1
alias usb-controller ohci-hcd
# LIRC stuff
alias char-major-61 lirc_i2c
# ivtv modules setup
alias char-major-81 ivtv
alias char-major-81-0 ivtv
# LIRC stuff
install lirc_i2c /sbin/modprobe ivtv; /sbin/modprobe --ignore-install lirc_i2c
Then finally I tried to run:
/sbin/depmod -a
/sbin/modprobe lirc_i2c
/sbin/modprobe lirc_i2c
to start up the lirc stuff and no dice, I received the following errors:
lircd: could not open /dev/lirc
lircd: default_init(): No such device
lircd: default_init(): No such device
After much searching it turns out that the version of lirc_i2c that you use must be compiled with the same compiler that your os was compiled with (or something to that effect). So then I thought that I should take the plunge and compile it myself. Nothing like rolling up the sleeves to get down and dirty. But before I try to get down and dirty, I want to know what I'm getting into so after uninstalling the lirc stuff via yum, I proceeded to check out this very skimpy how to guide by mythtv.org - here. I was hoping for something a little more in depth so I then checked out the install guide provided by LIRC themselves here and that was great. I downloaded version: lirc-0.8.0 (the latest stable at the time). NOTE: 9/2/2007 - these instructions work with lirc-0.8.2 as well) After extracting all of the files to a folder on my desktop (yep the desktop - it's the Windows in me), I then proceeded to follow the "Compiling" instructions on the LIRC site listed above. I ran:
./setup.sh
and the wizard popped up and I populated all of the necessary fields and chose to have it run the configure (since it autopopulates the config options). Now it was either at the "make" step where I received an error something to the effect: "lirc_dev: class_create failed" This was bad. I spent many an hour searching for the fix to this. Then I tried just going into the code of the installer where it said it had the problem and just commented out the lines. What's the worst that could happen - well it bombed in a second point and I killed that line too. Then it worked! Well before I get too happy I tried "make install" and that ran. This was too good to be true, but there had to be a reason for those lines of code so I tried to run:
/sbin/depmod -a
/sbin/modprobe lirc_i2c
/sbin/modprobe lirc_i2c
but that bombed out too. Ok it looks like those lines were really meant for something. So I backed out:
make uninstall
make clean
make clean
and Googled some more.
Then I finally came across: RE: Centos 4.3/4.4 unable to compile any LIRC version (0.7.2, 0.8.0, CVS). It wasn't my version, but heck it was worth a look. The problem as I found out was in the installer scripts on the lines I commented out. "...the recent kernel has two new functions and macros (named class_create and class_destroy) which conflict with the same lirc functions." His suggestion was renaming the functions by prefixing it with "lirc_" in every instance and wouldn't you know it, that worked!
The two files that needed changing are:
[installer location]/drivers/kcompat.h
[installer location]/drivers/lirc_dev/lirc_dev.c
[installer location]/drivers/lirc_dev/lirc_dev.c
I ran configure/make/make install and everything went smoothly. Then I tried:
/sbin/depmod -a
/sbin/modprobe lirc_i2c
/sbin/modprobe lirc_i2c
and no errors in /var/log/lircd !!! This was jolly good. I went back to the LIRC site and continued on to installation. They mentioned this and it happened to me - when you first get this running you'll find the lirc running in /dev/lirc but after a restart of services/computer etc, for me it is now running in /dev/lirc0 . This is important, because when you want to start up the daemon later you need to point to the device like this:
lircd -d /dev/lirc0
After testing with mode2 and irw it was back to Jarod's guide to continue with getting it to work with MythTV.
wget http://wilsonet.com/mythtv/lircrc-haupgrey-g3.txt
mkdir ~/.mythtv
mv lircrc-haupgrey.txt ~/.mythtv/lircrc
ln -s ~/.mythtv/lircrc ~/.lircrc
mkdir ~/.mythtv
mv lircrc-haupgrey.txt ~/.mythtv/lircrc
ln -s ~/.mythtv/lircrc ~/.lircrc
This is great at this point I tried running MythTV and my remote was working! Ok so the next logical step is to make sure this works after a restart - well for me it was a bust. I have a feeling that it has to do with order of startup and using something like rc3.d (which I don't know about yet). So what I did when I got the machine up and running was open a terminal and run the following commands manually:
/sbin/depmod -a
/sbin/modprobe lirc_i2c
lircd -d /dev/lirc0
echo 16384 > /proc/sys/vm/min_free_kbytes
/sbin/depmod -a
/sbin/modprobe ivtv
/sbin/modprobe lirc_i2c
lircd -d /dev/lirc0
echo 16384 > /proc/sys/vm/min_free_kbytes
/sbin/depmod -a
/sbin/modprobe ivtv
This seemed to work sometimes (sometimes the remote would only work with mode2 but not MythTV). So then I thought about doing something like a startup script and putting them in there. After searching, it appears that there is a startup script area within ~/.kde/Autostart where you can throw an executable .sh file and it will run at some point during start up (I'm not really sure when). I created: myth-load.sh with the following:
#!/bin/bash
# Only do this stuff if we're on the main display
# (i.e., don't do this in a vnc session)
if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ]
then
echo "myth-load.sh starting..."
echo "loading lirc..."
# Load LIRC (remote control)
echo "running: /sbin/depmod -a"
/sbin/depmod -a
sleep 4s
echo "running: /sbin/modprobe lirc_i2c"
/sbin/modprobe lirc_i2c
sleep 4s
echo "running: lircd -d /dev/lirc0"
lircd -d /dev/lirc0
sleep 4s
echo "loading ivtv..."
# Load IVTV (capture card)
echo 16384 > /proc/sys/vm/min_free_kbytes
echo "running: /sbin/depmod -a"
/sbin/depmod -a
sleep 4s
echo "running: /sbin/modprobe ivtv"
/sbin/modprobe ivtv
sleep 4s
echo "myth-load.sh completed"
fi
exit
# Only do this stuff if we're on the main display
# (i.e., don't do this in a vnc session)
if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ]
then
echo "myth-load.sh starting..."
echo "loading lirc..."
# Load LIRC (remote control)
echo "running: /sbin/depmod -a"
/sbin/depmod -a
sleep 4s
echo "running: /sbin/modprobe lirc_i2c"
/sbin/modprobe lirc_i2c
sleep 4s
echo "running: lircd -d /dev/lirc0"
lircd -d /dev/lirc0
sleep 4s
echo "loading ivtv..."
# Load IVTV (capture card)
echo 16384 > /proc/sys/vm/min_free_kbytes
echo "running: /sbin/depmod -a"
/sbin/depmod -a
sleep 4s
echo "running: /sbin/modprobe ivtv"
/sbin/modprobe ivtv
sleep 4s
echo "myth-load.sh completed"
fi
exit
Now I have the "sleep" in there just to make sure everything has a good enough amount of time to run. It is probabaly not needed. Now one note about shell scripting that I fell prey to because I was borrowing an example without fully understanding what a command does - If you use an "&" after a command like this:
/sbin/depmod -a &
lircd -d /dev/lirc0
lircd -d /dev/lirc0
then BOTH command will run simultaneously. The one with the "&" is set as a background process. This was messing me up for a long time. As of tonight and a couple restarts later I am not having any problems with my remote.
WHEW!
No comments:
Post a Comment